diff options
author | Dennis Eriksen <d@ennis.no> | 2023-02-04 14:18:18 +0100 |
---|---|---|
committer | Dennis Eriksen <d@ennis.no> | 2023-02-04 14:18:18 +0100 |
commit | eb5e90aded9a7259ddecc94d9244393fa5abd2e6 (patch) | |
tree | 8e166a3bec6435c1490cff04cd704ae847b47eba /scripts/neohub.py | |
parent | queue sleep as variable (diff) | |
download | energyscripts-eb5e90aded9a7259ddecc94d9244393fa5abd2e6.tar.gz |
moving some variables around
Diffstat (limited to 'scripts/neohub.py')
-rw-r--r-- | scripts/neohub.py | 5 |
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()) |