From b317b018d8060599ae1f7dfb49800894a5b60696 Mon Sep 17 00:00:00 2001 From: Bob Carroll Date: Tue, 3 Jan 2023 14:45:49 -0600 Subject: [PATCH] fix updating setpoint when changing the operation mode --- cherry/thermostat/zwave.py | 6 +++--- setup.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cherry/thermostat/zwave.py b/cherry/thermostat/zwave.py index e66cfea..5ade1b4 100644 --- a/cherry/thermostat/zwave.py +++ b/cherry/thermostat/zwave.py @@ -40,7 +40,7 @@ def to_celsius(payload): :returns: temperature value in Celsius """ value = payload.get('value') - if payload.get('unit')[-1] == 'F': + if payload.get('unit', 'C')[-1] == 'F': value = (int(value) - 32) / 1.8 return value @@ -300,8 +300,8 @@ async def send_oper_mode(client, id_, name, value): logging.debug(f'Setting tstat {id_} oper mode to {value}') await client.publish(f'zwave/{id_}/64/0/mode/set', int(value)) - setpoint = await get_setpoint_value(client, id_, convert_aux_heat(int(value))) - await client.publish(f'thermostat/{name}/setpoint', to_celsius(setpoint), retain=True) + payload = {'value': await get_setpoint_value(client, id_, convert_aux_heat(int(value)))} + await client.publish(f'thermostat/{name}/setpoint', to_celsius(payload), retain=True) async def set(client, id_, name, event, value): diff --git a/setup.py b/setup.py index a68972e..192b663 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages setup(name='cherry-thermostat', - version='0.2', + version='0.3', description='Provides an abstraction for thermostat devices', author='Bob Carroll', author_email='bob.carroll@alum.rit.edu',