trigger:
- platform: template
value_template: >-
{{ states('sensor.ns_panel_last_click_va') | regex_findall("\d+,\d+,\d+")
}}
id: color change
- platform: state
entity_id: sensor.ns_panel_last_click_va
- platform: state
entity_id: sensor.ns_panel_current_display_page
to: '13.00'
id: thermostat
- platform: state
entity_id: sensor.ns_panel_brightness_slider
id: brightness change
- platform: template
value_template: >-
{{ states('sensor.ns_panel_last_click_va') != "" and
states('sensor.ns_panel_last_click_va') != "newtxt"}}
for: '00:00:02'
id: long
I use the “long” to enter a color/brightness change screen, and when I click on a color the rgb color is passed back to ESP-Home in a variable sensor.ns_panel_last_click_va.
You have 3 triggers on sensor.ns_panel_last_click_va, so the three of them will be evaluated each time its state changes.
The plain state trigger will always be true, and you cannot determine whether it’s that one or one of the others that will end up in trigger..
It seems the issue is not what I thought.
I replaced the state trigger with a template regex trigger that matches on the other states, which is entity IDs.
This doesn’t trigger either and looking in the template tools it’s obvious.
It doesn’t evaluate to true/false.
It returns the match, either the RGB code or the entity ID depending on the trigger.
But how can I make an regex match return true/false?
I currently have these two patterns that does not conflict with each other:
If RGB:
{{ "255,125,3" | regex_findall("\d+,\d+,\d+") }} # works
{{ "light.davids_lampa" | regex_findall("\d+,\d+,\d+") }} # fails
If entity
{{ "light.davids_lampa" | regex_findall("light.*|switch.*|climate.*" ) }} # works
{{ "255,125,3" | regex_findall("light.*|switch.*|climate.*" ) }} # fails