Make my value template search in a string for a on/off value? how? :-)

Hey, i have a bunch of template lights/switches … i want to create now a value template so HA knows my light/switch is on or off

if you look in my screenshot below, every light/switch has a unique ID, like 4401 or 4502 or …
the value can be 00 or 01 for off/on

how can i make a value template to look for a specific unique id?

before i had a sensor, based on fixed values in a string, now it different

i had :
value_template: "{{ states.sensor.prog.state[12:14] == '01' }}"

But that was static , i want it dynamic to look for a value like 4401 , if thats on/off
so i need to search in a string and get the substring

image

It doesn’t look like there’s anything dynamic about that. Simply use:

state_attr('sensor.dobiss', '4100') == '01'

or


state_attr('sensor.dobiss', 4100) == '01'

depending on if the key is a string or int.

Omg, indeed, i was making it too difficult

Thnx