Hello Community!
I have following setup to control my lights (on, off)
- Detached Shelly Relays using Esphome
- when connected to API and WiFi I used to call a
homeassistant.service
from Esphome toservice: light.toggle
and pass on the entity id of the light each Esphome relay controls in Homeassistant - this way I could just change the entity id as a variable and flash the corresponding Shelly
- the controlled lights are mostly dimmable Zigbee lights
- when connected to API and WiFi I used to call a
Recently I wanted to implement dimming when using long click; I could successfully test a blueprint from notherealmarco
- because of a Zigbee limitation, this blueprint also needs to know the IEEE address of the Zigbee light.
- I changed the blueprint after looking through the forums, and replaced the blueprint IEEE input with the following template
variables:
l1ieee: "{{ device_attr('light.target_entity', 'identifiers') | selectattr(0,'eq','zha') | map(attribute=1) | first }}"
- this worked well and motivated me to further work on it
- the mentioned blueprint uses script calls from Esphome:
*Esphome on Shelly device, on_multi_click -> single click -> action toggle*
- homeassistant.service:
service: script.smart_dimmer_test_victor
data:
action: toggle
controlled_light_id: "${controlled_light}"
controlled_light
is the variable each Esphome device was given when flashing
Homeassistant receives the event and message, I can see this in the logs, but how can I use controlled_light_id
in a script or blueprint ?
from notherealmarco blueprint
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ action == "toggle" }}'
- condition: template
value_template: '{{ is_state(main_light_eid, "off") }}'
sequence:
- service: light.turn_on
target: !input light
I would like to change !input light
to something like "{trigger.event.data.controlled_light_id}"
. Unfortunately however, this does not work…
Using the blueprint as is, would mean I have to create a script based on that blueprint for each of my light switch. That is the reason why I would like to use one script, that parses the data passed on from Esphome.
One reason I cannot make this work the way I want is maybe because I don’t really understand the way the blueprint from notherealmarco
works.
I am also grateful if somebody can point out a better way to get esphome devices to work with Zigbee lights
Any help is appreciated!
Best regards from Germany!