ScratMan / HASmartThermostat

Smart Thermostat with PID controller for HomeAssistant
336 stars 48 forks source link

ability to manually set target temperature from controlled thermostat #99

Open edgimar opened 1 year ago

edgimar commented 1 year ago

I am currently using the Smart Thermostat component in order to control a physical (Z-wave) thermostat by using a configuration like what is described in https://github.com/ScratMan/HASmartThermostat/discussions/35#discussioncomment-1746936. The way this works is by creating a virtual switch that either sets the physical thermostat temperature high or low (i.e. a temperature much higher or lower than the setpoint temperature).

What I would like to be able to do is to manually adjust the setpoint on the physical thermostat, and for this modified setpoint to be used to set the HASmartThermostat setpoint.

My suggestion on how to do this would be to have an option to monitor the physical thermostat setpoint, and when it is differs from "whatever the physical setpoint was shortly after the PWM state last changed", then: (1) any state transitions of the PWM output are suspended temporarily, and (2) the physical thermostat setpoint is monitored until the setpoint hasn't changed for say 5 seconds. After this "stable setpoint" condition is met, the final physical setpoint is used to update the HASmartThermostat setpoint, and PWM output is again allowed to change.

ScratMan commented 1 year ago

I undesrtand your physical thermostat controls the heater. Why not using a dedicated relay to control the heater directly with the Smart Thermostat, and then use an automation to sync the physical thermostat and the (virtual) smart thermostat ? Then your physical thermostat setpoint would reflect the Smart Thermostat setpoint.

edgimar commented 1 year ago

That's not a bad idea, and I agree that it would be nice to be able to always see the setpoint, but part of the reason I haven't done that is for the sake of redundancy. If for some reason my HA instance dies (and I would guess that it is more fragile than the physical thermostat), having the physical thermostat connected as a relay serves as a fallback.

Also, as a way to get a rough idea of what the setpoint is by looking at the physical thermostat, one could have an automation that updates the "on" and "off" temperatures to be (smart therm. setpoint + 10) and (smart therm. setpoint - 10), so any time you look at the thermostat, you either add or subtract 10 in order to know what the real setpoint is.