jmcollin78 / versatile_thermostat

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

Change log level of “Window auto event is ignored” log message #350

Closed pdcastro closed 10 months ago

pdcastro commented 10 months ago

Since updating to a recent version of Versatile Thermostat (I think v5.2.1 or later), my Home Assistant logs are flooded with the following info log messages (printed every 30 seconds), even when the “Use window detection” checkbox is unticked in the configuration:

2024-01-19 14:41:36.655 INFO (MainThread) [custom_components.versatile_thermostat.base_thermostat] ... - Window auto event is ignored because bypass is ON or window auto detection is disabled
2024-01-19 14:42:06.693 INFO (MainThread) [custom_components.versatile_thermostat.base_thermostat] ... - Window auto event is ignored because bypass is ON or window auto detection is disabled
2024-01-19 14:42:36.613 INFO (MainThread) [custom_components.versatile_thermostat.base_thermostat] ... - Window auto event is ignored because bypass is ON or window auto detection is disabled
2024-01-19 14:43:06.631 INFO (MainThread) [custom_components.versatile_thermostat.base_thermostat] ... - Window auto event is ignored because bypass is ON or window auto detection is disabled
...

I reckon that this log message is not needed when the window detection feature is not enabled by the user (my case). Interestingly, I also observed that if the “Use window detection” checkbox was ticked, the message above was not printed (or at least it was not printed every 30 seconds).

This PR proposes a fix to this issue.

pdcastro commented 10 months ago

This is not what we should do. If we do that I the slope will not be calculated at all. I know the slope calculation is done in a window part for historical reason. I'm pretty sure tests don't work with this code. Are they ?

I see, I hadn’t noticed the side effects on the slope calculation, sorry! (The tests did pass.)

For this PR, you could: [...] change the log level to .debug to remove the recurrent log.

So, would you be happy with the log level being changed from info to debug? My core motivation for this PR was preventing that info log message being repeatedly printed while I was not even using the window feature. :-) I could edit the title of this PR to something like “Amend log level for window auto event log message“ and make it a single-line PR changing just the log level.

Thanks for the review. 👍

jmcollin78 commented 10 months ago

Sorry you have conflict now, because I have done much work this week-end. What you can do, is to merge or close this PR and open a new one, just with the log level change. I will merge it rapidly to avoid more conflict.