jmcollin78 / versatile_thermostat

A full featured Thermostat for Home Assistant: presets, window, motion, presence and overpowering management
MIT License
330 stars 35 forks source link

[serious issue] the integration would switch ac on and off rapidly and lock up home assistant if outside temp is NaN #95

Closed aboodvan closed 1 year ago

aboodvan commented 1 year ago

I setup the integration today for a/c and left 0 for heater for eco, comfort, and boost. Also, I unckecked all options such as window, power, etc...

Once the outside temp timed out, the integration started switching ac on and off rapidly and lock up home assistant and I had to unplug the IR blaster and restart home assistant from docker. luckily, the a/c survived.

settings: (all not mentioned settings left as is)

Thermostat over another thermostat

cycle duration: 10 min temp allowed: 25 max temp allowed 28

presence, power, motion, and window unchecked.

A/c temp: Eco: 28 Comfort: 27 Boost: 25

Heater Temp: left as is 0

a/c mode checked

-->

Version of the custom_component

3.3.4

-->

Configuration

yaml related configuration: default_config:

smartir:

climate:


Log file is 1.5mb so I'd included preview here.

Logs preview: 2023-08-04 18:20:34.524 ERROR (MainThread) [homeassistant.components.rest.data] Timeout while fetching data: https://ncm.gov.sa/Ar/Weather/RegionWeather/Pages/Riyadh.aspx 2023-08-04 18:20:34.601 WARNING (MainThread) [homeassistant.config_entries] Config entry 'https://ncm.gov.sa/Ar/Weather/RegionWeather/Pages/Riyadh.aspx' for scrape integration not ready yet: REST data is not available; Retrying in background 2023-08-04 18:25:10.532 WARNING (Recorder) [homeassistant.components.sensor.recorder] The unit of sensor.outside_temp (°C) cannot be converted to the unit of previously compiled statistics (None). Generation of long term statistics will be suppressed unless the unit changes back to None or a compatible unit. Go to https://my.home-assistant.io/redirect/developer_statistics to fix this 2023-08-04 18:57:44.877 WARNING (SyncWorker_4) [custom_components.xiaomi_cloud_map_extractor.camera] Unable to retrieve map data 2023-08-04 19:24:44.885 WARNING (SyncWorker_8) [custom_components.xiaomi_cloud_map_extractor.camera] Unable to retrieve map data 2023-08-04 19:36:44.898 WARNING (SyncWorker_23) [custom_components.xiaomi_cloud_map_extractor.camera] Unable to retrieve map data 2023-08-04 19:57:44.902 WARNING (SyncWorker_5) [custom_components.xiaomi_cloud_map_extractor.camera] Unable to retrieve map data 2023-08-04 21:12:40.124 WARNING (MainThread) [custom_components.versatile_thermostat.climate] VersatileThermostat-VS - No temperature received for more than 60.0 minutes (dt=0.0, dext=60.2) and underlying climate is True. Set it into security mode 2023-08-04 21:12:40.179 WARNING (MainThread) [custom_components.versatile_thermostat.climate] VersatileThermostat-VS - End of security mode. restoring hvac_mode to cool and preset_mode to comfort 2023-08-04 21:12:40.209 WARNING (MainThread) [custom_components.versatile_thermostat.climate] VersatileThermostat-VS - No temperature received for more than 60.0 minutes (dt=0.0, dext=60.2) and underlying climate is True. Set it into security mode 2023-08-04 21:12:40.228 WARNING (MainThread) [custom_components.versatile_thermostat.climate] VersatileThermostat-VS - End of security mode. restoring hvac_mode to cool and preset_mode to comfort 2023-08-04 21:12:40.246 WARNING (MainThread) [custom_components.versatile_thermostat.climate] VersatileThermostat-VS - No temperature received for more than 60.0 minutes (dt=0.0, dext=60.2) and underlying climate is True. Set it into security mode 2023-08-04 21:12:40.265 WARNING (MainThread) [custom_components.versatile_thermostat.climate] VersatileThermostat-VS - End of security mode. restoring hvac_mode to cool and preset_mode to comfort 2023-08-04 21:12:40.292 WARNING (MainThread) [custom_components.versatile_thermostat.climate] VersatileThermostat-VS - No temperature received for more than 60.0 minutes (dt=0.0, dext=60.2) and underlying climate is True. Set it into security mode 2023-08-04 21:12:40.319 WARNING (MainThread) [custom_components.versatile_thermostat.climate] VersatileThermostat-VS - End of security mode. restoring hvac_mode to cool and preset_mode to comfort 2023-08-04 21:12:40.345 WARNING (MainThread) [custom_components.versatile_thermostat.climate] VersatileThermostat-VS - No temperature received for more than 60.0 minutes (dt=0.0, dext=60.2) and underlying climate is True. Set it into security mode 2023-08-04 21:12:40.367 WARNING (MainThread) [custom_components.versatile_thermostat.climate] VersatileThermostat-VS - End of security mode. restoring hvac_mode to cool and preset_mode to comfort 2023-08-04 21:12:40.390 WARNING (MainThread) [custom_components.versatile_thermostat.climate] VersatileThermostat-VS - No temperature received for more than 60.0 minutes (dt=0.0, dext=60.2) and underlying climate is True. Set it into security mode 2023-08-04 21:12:40.411 WARNING (MainThread) [custom_components.versatile_thermostat.climate] VersatileThermostat-VS - End of security mode. restoring hvac_mode to cool and preset_mode to comfort home-assistant (2).log

jmcollin78 commented 1 year ago

Very strange issue, I will have a look now. If I understand correclty this is due to the scraping of the outside temperature which is not available. Am I right ?

The VTherm tries to put itself in "security mode" (a mode activated when temperature is not available):

2023-08-04 21:12:40.124 WARNING (MainThread) [custom_components.versatile_thermostat.climate] VersatileThermostat-VS - No temperature received for more than 60.0 minutes (dt=0.0, dext=60.2) and underlying climate is True. Set it into security mode This security mode tries to turn_off the underlying thermostat (your smartir thermostat ?), I guess.

And then don't know why but the VTherm stops the security mode: 2023-08-04 21:12:40.319 WARNING (MainThread) [custom_components.versatile_thermostat.climate] VersatileThermostat-VS - End of security mode. restoring hvac_mode to cool and preset_mode to comfort

and it is looping. Is there anything special with your smartir thermostat ? Is it responding to the turn_off normaly ? During the loop did you notice that the AC really turns on and off (or is it just a log effect) ?

aboodvan commented 1 year ago

Yes, and once I restarted home assistant, the outside temperature got back to normal and the integration seems to be functioning normally again. Also, nothing suspicious happened in the logs before the issue. I'll include some events just in case. Based on these facts, I'd say the issue was likely to be outside temperature.

Smart IR is the underlying thermostat. Actually it's an integation that would substitutes air conditioner remote.

And yes it was turning the ac on and off as it's was looping. This is how I knew something is wrong.

I already deleted the integration. I don't know if I can share logs or more configurations.

Please let me know if you need more information as I'll be glad to help.

jmcollin78 commented 1 year ago

I try to reproduce without success on my dev environment. I guess this is due to your smartIR climate which is not a real climate and may be its behaviour is special. I don't have this device to test so it will be not easy to understand.

When you turn off your smartIR climate, does its state (HVACAction and HVACMode) change to OFF ? You should be able to see this in a dashboard or in the Dev tools. May be you can put here a screen copy of the debug view of your climate. Like this: Capture d’écran 2023-08-05 à 18 25 52

If possible, put your versatile_themostat in debug mode with the following lines in your configuration.yaml:

logger:
  ...
  logs:
    custom_components.versatile_thermostat: info
    custom_components.versatile_thermostat.underlyings: debug
    custom_components.versatile_thermostat.climate: debug

and try to reproduce the problem. Then send me the logs, with that I'm pretty sure to see what happens.

Note: I think you don't have to suppress the all integration but only deactivate the versatile_thermostat climate entity to stop the loop.

jmcollin78 commented 1 year ago

Ok now I succeed to reproduce the problem with exactly the same symptom. Don't take my previous message into account.

jmcollin78 commented 1 year ago

I have push a fix. Let me test on my production environment and if close the issue, it means you can go.

jmcollin78 commented 1 year ago

it is ok ! Thank you for your report, it helps me a lot to find