ScratMan / HASmartThermostat

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

Need to detect if switch failed to change state #134

Open edgimar opened 1 year ago

edgimar commented 1 year ago

Describe the bug It appears that if a switch doesn't provide feedback about it's current state (e.g. maybe it's a template defined switch), and if the switch for some reason doesn't end up in the desired state, smart thermostat isn't able to detect this and try to correct it (e.g by toggling the switch state).

I've attached a screenshot that illustrates this scenario having occurred.

Screenshots Screenshot_20230226-084813_1

Andrzej21372137 commented 1 year ago

I have exactly the same issues and i thought that i messed something up.

ScratMan commented 1 year ago

Is your configuration using the keep_alive parameter ? His role is to regularly check the state of the switch is aligned with the thermostat.

Andrzej21372137 commented 1 year ago

Yes i have it set to 60 sec.

zarebski-m commented 1 year ago

Is your configuration using the keep_alive parameter ? His role is to regularly check the state of the switch is aligned with the thermostat.

Hi, I know it's unrelated to this issue, but this is the first time I've seen the keep_alive parameter being succinctly explained. The README says that:

keep_alive (Required): sets update interval for the PWM pulse width. If interval is too big, the PWM granularity will be reduced, leading to lower accuracy of temperature control, can be float in seconds, or time hh:mm:ss.

edgimar commented 1 year ago

I also have the keep_alive parameter set to 60 seconds, but I believe this issue is not addressed by that parameter (as it currently behaves). Based on the description, it influences the frequency that the PWM output value is updated, but I wonder what happens if the computed output does not differ from the previous output. In this case, is a command issued to the switch telling it to be in a particular state? If not, then this could explain the screenshot I included (assuming that there was one time that a "turn on" command wasn't correctly received/processed by the switch, and the PWM state after that time was only ever "on").