aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/neohub.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/neohub.py')
-rw-r--r--scripts/neohub.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/scripts/neohub.py b/scripts/neohub.py
index 7cc1160..2a61a21 100644
--- a/scripts/neohub.py
+++ b/scripts/neohub.py
@@ -6,7 +6,7 @@ import asyncio
from datetime import datetime
import neohubapi.neohub as neohub
-from common import dbi
+import common
neohub_ip = os.environ['el_neohub_ip']
neohub_port = os.environ['el_neohub_port']
@@ -21,8 +21,7 @@ async def run():
hub_data, devices = await hub.get_live_data()
for device in devices['thermostats']:
print(f"Temperature in zone {device.name}: {device}")
- sql = "INSERT INTO neohub (timestamp, time, device_id, away, heat_mode, heat_on, current_floor_temperature, target_temperature, temperature) VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s)"
values = (datetime.utcnow(), device.time, device.device_id, device.away, device.heat_mode, device.heat_on, device.current_floor_temperature, device.target_temperature, device.temperature)
- dbi(sql, values)
+ common.dbi(common.sql[common.name], values)
asyncio.run(run())