cgarwood / homeassistant-zwave_mqtt

Limited Pre-Release of the new OZW1.6 Z-Wave component. Currently has limited platform support. Check the README for more details.
72 stars 8 forks source link

More consistent logging #85

Closed kpine closed 4 years ago

kpine commented 4 years ago

This is minor, but just a though for some improvement, would it be possible to have more of a consistent format for the logging? Looking through the logs, I see node id being formatted in different ways.

2020-04-15 11:16:45 DEBUG (MainThread) [custom_components.zwave_mqtt] NODE ADDED: <OZWNode 1> - node id 1
2020-04-15 11:16:45 DEBUG (MainThread) [custom_components.zwave_mqtt] VALUE ADDED: node 1 - value label Loaded Config Revision - value 0 -- id 31227923 -- cc CommandClass.MANUFACTURER_SPECIFIC
2020-04-15 11:16:45 DEBUG (MainThread) [custom_components.zwave_mqtt.entity] Adding Node_id=2 Generic_command_class=7, Specific_command_class=1, Command_class=CommandClass.SENSOR_BINARY, Index=0, Value type=ValueType.BOOL, Genre=ValueGenre.USER as binary_sensor

Maybe something like:

NODE ADDED: node 1 - <OZWNode 1>
VALUE ADDED: node 1 - value label Loaded Config Revision - value 0 -- id 31227923 -- cc CommandClass.MANUFACTURER_SPECIFIC
ENTITY ADDED: node 2 - Generic_command_class=7, Specific_command_class=1, Command_class=CommandClass.SENSOR_BINARY, Index=0, Value type=ValueType.BOOL, Genre=ValueGenre.USER as binary_sensor

or prepend node id to the front:

[node 1] NODE ADDED: <OZWNode 1>
[node 1] VALUE ADDED: value label Loaded Config Revision - value 0 -- id 31227923 -- cc CommandClass.MANUFACTURER_SPECIFIC
[node 1] ENTITY ADDED: Generic_command_class=7, Specific_command_class=1, Command_class=CommandClass.SENSOR_BINARY, Index=0, Value type=ValueType.BOOL, Genre=ValueGenre.USER as binary_sensor

It would make it easier to filter the log messages to a single node if needed.

Otherwise, to filter on a specific node like 11 I'm using a regex node(\s|_id=)?11.