From eb5e90aded9a7259ddecc94d9244393fa5abd2e6 Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Sat, 4 Feb 2023 14:18:18 +0100 Subject: moving some variables around --- scripts/neohub.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'scripts/neohub.py') 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()) -- cgit v1.2.3