Hi everyone!
Does enyone knows how to achieve this for an automation?
alias: Webhook - Phone Charger
description: ''
trigger:
- platform: webhook
webhook_id: "abcabc"
- platform: webhook
webhook_id: "123123"
condition: []
( IF webhook "abcabc" do next action )
action:
- service: switch.turn_on
data: {}
target:
entity_id: switch.sonoff_phone_charger
( IF webhook "123123" do next action )
action:
- service: switch.turn_off
data: {}
target:
entity_id: switch.sonoff_phone_charger
mode: single
koying
(Chris B)
June 1, 2021, 1:30pm
2
It’s not 100% clear what you’re trying to achieve, but I’m 99% sure it would be easier with 2 automations
123
(Taras)
June 1, 2021, 1:54pm
3
PickOne:
how to achieve this
Like this:
alias: Webhook - Phone Charger
description: ''
trigger:
- platform: webhook
webhook_id: "abcabc"
- platform: webhook
webhook_id: "123123"
action:
- service: "switch.turn_{{ 'on' if trigger.webhook_id == 'abcabc' else 'off' }}"
target:
entity_id: switch.sonoff_phone_charger
mode: single
5 Likes
I already done this with two autiomations, I just try to minimize the number of automations
1 Like
Thats it, it is working flowless. I just wanted to know that “trigger.webhook_id”, but your aproach, made me learn new things. I didn’t know that I can use code into other services than Template Which is wow.
Thank you so much!
1 Like
I reduced the number of my automations, from 40 to 6 :)) With this webhook trigger method.
1 Like