Hello,
I’d like to receive a notification when a webhook is received that reports all the lights that actually are on (for example).
I was abe o receive a notification for each light is turned ON by doing this:
alias: Test notification
trigger:
- platform: state
entity_id: >-
switch.luce_penisola, switch.luce_tavola, switch.piattaia, switch.divano,
switch.presa_ikea_1, switch.presa_ikea_2, switch.terrazza,
switch.specchio, switch.bagno, switch.camera_da_letto,
switch.terrazza_camera, switch.neo, switch.conigli, switch.corridoio,
switch.ingresso, switch.lavanderia, switch.sgabuzzino, light.binic,
light.led_strip, light.fornelli, light.fornelli_1, light.fornelli_2,
light.luce_lato_bene, light.luce_lato_sandro
from: 'off'
to: 'on'
condition: []
action:
- service: notify.mobile_app_oneplus_8_pro
data_template:
message: ' {{ trigger.to_state.attributes.friendly_name }} '
Unfortunately I can’t get it to work if I use the webhook as trigger and every entity as OR condition (I used only 2 conditions to test):
alias: Test notification
trigger:
- platform: webhook
webhook_id: testwebhook
condition:
- condition: or
conditions:
- condition: state
entity_id: switch.luce_penisola
state: 'on'
- condition: state
entity_id: switch.luce_tavola
state: 'on'
action:
- service: notify.mobile_app_oneplus_8_pro
data_template:
message: ' {{ trigger.to_state.attributes.friendly_name }} '
when this automation is trigger the error on the debug is:
Error: Error rendering data template: UndefinedError: 'dict object' has no attribute 'to_state'
Am I missing something?
Any help is really appreciated!
Thank you