1
0
Fork 0

fix updating setpoint when changing the operation mode

Bob Carroll 2023-01-03 14:45:49 -06:00
parent d631835544
commit b317b018d8
2 changed files with 4 additions and 4 deletions

View File

@ -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):

View File

@ -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',