Friday, September 4, 2026
The Indigo SQL Logger plugin can save device states to a local SQLite database that is stored in Indigo’s current version support directory. But where is that directory and how can our scripts access it agnostic of the current version of Indigo?
It turns out that the server exposes its log directory path:
indigo.server.getLogsFolderPath()
Then to get the path to the device state database:
import os
db_path = os.path.join(indigo.server.getLogsFolderPath(),
"indigo_history.sqlite")And as an example:
import os
import sqlite3
db_path = os.path.join(
indigo.server.getLogsFolderPath(),
"indigo_history.sqlite"
)
conn = sqlite3.connect(
f"file:{db_path}?mode=ro",
uri=True
)
cursor = conn.cursor()
cursor.execute("""
SELECT
AVG(actual_state)
FROM
device_history_1691183344
WHERE
actual_state IS NOT NULL
AND actual_state != ''
AND actual_state != 0
""")
result = cursor.fetchone()[0]
conn.close()
if result is not None:
indigo.server.log(
f"Average actual_state: "
f"{result:.2f}"
)
else:
indigo.server.log(
"No valid rows found "
"for average calculation."
)no way