ScratMan / HASmartThermostat

Smart Thermostat with PID controller for HomeAssistant
352 stars 50 forks source link

Failsafe don't work when sensor not available / output_safety & sensor_stall #220

Open gryzli133 opened 4 months ago

gryzli133 commented 4 months ago

Describe the bug When a temperature sensor is working and later loose the connection (sensor_stall), then safety value will be set to output (output_safety). But when the sensor is not available since HA startup, then sensor_stall is not working.

To Reproduce Steps to reproduce the behavior:

  1. Start HA with a temp sensor unavailable
  2. Wait sensor_stall (as set in config - 10 min in my setup)
  3. Nothing happens

Expected behavior I would expect, that when sensor is unavailable from beginning, or lately after sensor_stall time, the output will be set to output_safety

Screenshots

Desktop (please complete the following information):

ScratMan commented 4 months ago

Hello, that's a really strange bug, as the safety feature is based on an internal variable called _last_sensor_update. This variable is initialized at the init of the thermostat (during HA boot), and then is refreshed only if the sensor returns a new valid value (a float). So if your sensor is down, it should never refresh and the safety should.

I'd rather think the thermostat should not start. Could you please enable the debug logs by adding the following lines in your HA configuration.yaml ?

logger:
  logs:
    custom_components.smart_thermostat: debug

Please check if you see this line at the thermostat startup: <thermostat entity ID>: Unable to update from sensor <sensor entity id> or if you have this one: <thermostat entity ID>: Received new temperature or this one: <thermostat entity ID>: Obtained temperature