ScratMan / HASmartThermostat

Smart Thermostat with PID controller for HomeAssistant
338 stars 49 forks source link

Sync switch state #84

Closed TTLucian closed 1 year ago

TTLucian commented 2 years ago

Describe the bug Switch entity state does not sync with climate entity state

To Reproduce Steps to reproduce the behavior:

  1. Turn on switch used in config by other means (manually or through home assistant).
  2. Smart thermostat entity shows as being off.

The switch was accidentally turned on and the boiler started heating. There were no changes in the smart thermostat state.

Expected behavior Climate entity should be in sync with the switch entity used in config. If the switch is turned on by other means, the smart thermostat should reflect this and behave accordingly with it's settings.

T81 commented 1 year ago

The switch and the thermostat are two different entities. Turning on the switch manually shouldn't reflect that to the thermostat in my opinion. In case you do not want to accidentally mess with the switch then hide it so it doesn't show up in the UI

ScratMan commented 1 year ago

Describe the bug Switch entity state does not sync with climate entity state

To Reproduce Steps to reproduce the behavior:

  1. Turn on switch used in config by other means (manually or through home assistant).
  2. Smart thermostat entity shows as being off.

The switch was accidentally turned on and the boiler started heating. There were no changes in the smart thermostat state.

Expected behavior Climate entity should be in sync with the switch entity used in config. If the switch is turned on by other means, the smart thermostat should reflect this and behave accordingly with it's settings.

Is your keep_alive parameter set ? it should force the switch back to the state defined by the thermostat.

TTLucian commented 1 year ago

Yes, keep_alive is set 60. Indeed, the switch reverts to the state defined by the thermostat if the thermostat is set to on. But if the thermostat is set to off and I turn on the switch manually, it stays on. I would expect either to be forced off by the thermostat (like you said) or the thermostat itself should turn on (this behaviour would allow the thermostat to be turned on manually by using the physical switch which would be useful in some situations).

T81 commented 1 year ago

I would try to set the keep_alive to 1 second. Which shouldn't have any implications. Otherwise, a setting of 60 seconds means that if turned on then the controller will check again if should turn off after 60 seconds