openhab / openhab-core

Core framework of openHAB
https://www.openhab.org/
Eclipse Public License 2.0
932 stars 429 forks source link

Sitemap editor: Fix color and icon rules #4449

Closed mherwege closed 1 week ago

mherwege commented 1 week ago

Closes https://github.com/openhab/openhab-core/issues/4431

This closes an issue with color and icon rules when no item and comparator was provided in the rule (should default to item of the widget and == comparator) and the rule condition started with an alpha character.

lolodomo commented 1 week ago

I don't understand the case that was wrong. Can you please provide an example of sitemap element that was not matched ?

mherwege commented 1 week ago

I don't understand the case that was wrong. Can you please provide an example of sitemap element that was not matched ?

@lolodomo Look at the linked issue.

Switch icon=if:mdi:lightbulb item=licht_nachthal label="Nachthal" mappings=[ON="Aan", OFF="Uit"] iconcolor=[ON="yellow"]

The ON in the iconcolor was split by the regex in O and N, the O being interpreted as the item.

lolodomo commented 1 week ago

Ok. If you tested it, it is fine for me. I see that it is a change only for sitemap generator.

mherwege commented 1 week ago

Ok. If you rested it, it is fine for me. I see that it is a change only for sitemap generator.

Indeed, only relevant to the sitemap generator, that was using a regex to split the rule in its parts. I tested with the examples from the linked issue.