Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

template_value with spaces in them are not recognised #55

Open
rrozema opened this issue Feb 21, 2023 · 1 comment
Open

template_value with spaces in them are not recognised #55

rrozema opened this issue Feb 21, 2023 · 1 comment

Comments

@rrozema
Copy link

rrozema commented Feb 21, 2023

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.

rrozema added a commit to rrozema/domoticz_mqtt_discovery that referenced this issue Feb 21, 2023
fix the matching regular expression for value_template to accept surrounding spaces.
@rrozema
Copy link
Author

rrozema commented Feb 21, 2023

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...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant