cyberjunky / home-assistant-toon_climate

This component provides a climate device for rooted Toon thermostats.
MIT License
32 stars 8 forks source link

Improved logging #28

Closed rbak69 closed 3 years ago

rbak69 commented 3 years ago

Improved the logging as follows:

Changed the basic logging to log as info messages. Due to this messages with respect to standard requests will show in the logs when at least set to info level (default).

Added additional debug log details to provide messages with more detail about the request send to the Toon device. These messages will only be available when the log level for the Toon component is at least set to debug level.

Added the actual name for the respective Toon instance to the log messages. This way it is clear in the logs which instance of the Toon the log messages are related to. Especially usefull when more than one Toon instance is configured.

Made sure the log will show the messages in the following order:

  1. standard request message (info)
  2. detailed request information (debug)
  3. detailed response information (debug)

This way it is easy to understand from the logs what the result is for each individual request.

cyberjunky commented 3 years ago

@rbak69 I think this many info log entries is the max. we must not overdo it. because this information is also available in logbook.

rbak69 commented 3 years ago

@cyberjunky I am a bit confused as the my logbook definately does not contain this information. If I check my logbook entries I can only see the manual changes to the hvac state. In my case that means the changes between 'heat" (Verwarmen) and auto. See an example below:

Logbook entry toon component

In the example I requested the Google assistant to change my thermostat to "Verwarmen" and than changed it back to "Auto" mode with the Home Assistant GUI. I also made multiple changes to the setpoint with the GUI and changed the presets several times but none of that information ends up in my logbook. So it seems it does not provide any datails about manual overwrites of the temperature setpoint etc.

From a logging perspective I made sure the relevant basic requests (changing hvac states, presets and manual temperature changes) are added as info messages to the logs. This only happens ocasionally and is valuable information to show in the logs. I do not see this is an issue at all. Especially if I look at the log polution some of the standard home assistant components add to the logs.

When the logger for the toon component is set to debug it will provide the additional information that supports debugging the component. In that case the log details I have added are only added to the log when the manual changes are requested. So again that should only be ocasionally.

The part that results most of the log entries when in the toon component is in debug mode are the constant polling requests in combination with the data that is being returned by the Toon for each request. But again this seems very useful to me when running in debug mode. I guess the users should not put the logging level for the toon component in log level "debug" by default but instead keep it on log level "info" unless they need to debug any issues. Might be worth adding that comment to teh README.md and info.md files.

Have I overlooked something? Let me know your thoughts

cyberjunky commented 3 years ago

@rbak69 It's no big deal, I only wanted to make a comment of not adding to much 'by default enabled' logging, I never looked at my HA log if I'm not debugging something, and this component exists for years, you are doing a good job ;-)

rbak69 commented 3 years ago

@cyberjunky thanks for the appreciation of my contributions. I have a few more code improvements I am working on. It is actaully good fun as it has been an while since I have been programming and this way I get to learn Python and improving one of the custome components I use at the same time ;-) My goal is to make sure that in debug mode you get the information you need to debug potential errors. I suggest to advise the users to set the log level to "info" by default and only change it to "debug" when actually debugging issues. Hence why in log level "info" I only provide minimal information. In the next update I will add that also to the README.md and info.md files.