maximvelichko / pyvera

A python library to control devices via the Vera hub
GNU General Public License v2.0
26 stars 30 forks source link

VeraThermostat support thermostats with two setpoints #156

Closed maximvelichko closed 10 months ago

maximvelichko commented 1 year ago

Adding compatibility layer for VeraThermostat to allow thermostats with Heat and Cool setpoints working with Home Assistant.

(At least) my Honeywell thermostat manages cool and heat temperatures independently.

Setting a new value is done via urn:upnp-org:serviceId:TemperatureSetpoint1_Cool and urn:upnp-org:serviceId:TemperatureSetpoint1_Heat, not urn:upnp-org:serviceId:TemperatureSetpoint1. This pair already declared but not used in pyvera.

Actual values are returned in dev_info as coolsp and heatsp, not setpoint.

My change looks at the presence of "setpoint" in device_info, if it's there then there is no change in how pyvera behaves. If no, but there are "coolsp" and "heatsp", then it use these values to retrieve setpoints, and urn:upnp-org:serviceId:TemperatureSetpoint1_Cool and urn:upnp-org:serviceId:TemperatureSetpoint1_Heat to update it. Which one is chosen depends on the mode the thermostat is running in (I admit, it has its week sides, though it allows properly controlling of thermostat without changing Home Assistant and existing controls). Though of course I am open for suggestions!

I tested it with my own thermostat, just replacing in stock pyvera with my changed one made Thermostat control perfectly functioning!