domoticz_mqtt_discovery
domoticz_mqtt_discovery copied to clipboard
template_value with spaces in them are not recognised
When a "value_template" is formatted for example as : "{{ value_json.state_l1 }}", this is not recognized because of the unexpected spaces between "{" and "v" and between "1" and "}". O.a. zigbee2mqtt returns this format for my lidl power switches.
I have added extra whitespace patterns in the regular expressions for all calls matching the value_template string to fix the issue. Will try to create a PR to upload my changes.
In my 1st revision I also changed the match pattern for the value to look for \w+, which is actually not correct: all characters -except "/"- seem to be allowed in topic names. This does however present us with an issue: is any whitespace after the topic name also to be considered to be part of the topic name or not?
(I shot myself in the foot with this change, because several topics for a device I'm building have "-" in their topic name. Those devices were no longer added nor updated after my change...)