I don’t think that’s the typical way to use IFTTT with HA. You should probably check out the docs (even if they are fairly confusing and misleading) if you haven’t already.
But, assuming what you have works ok (i.e., the webhook trigger is firing when IFTTT sends the POST request), I think you may want to do this:
- id: '1569956284174'
alias: Turn on radio
trigger:
- platform: webhook
webhook_id: turn_on_radio
condition: []
action:
- data_template:
activity: Listen to radio
entity_id: "remote.{{ 'bedroom' if trigger.json.pomieszczenie == 'bedroom' else 'living_room_2' }}"
service: remote.turn_on
You mean that I should use “ifttt_webhook_received” instead of just webhook? Well, I couldn’t make that one work, but my method works flawlesly, it seems.
Yes, using the ifttt_webhook_received event trigger is the typical way, but it requires you to set up the IFTTT Integration on the Integrations page. That will give you the webhook_id to use.
But, I don’t think it really matters. As long as you can set up IFTTT to send a POST request that you can get a HA automation to trigger on, that’s the important part.
What I showed is how you’d use the room designation from the POST request to control which remote the service call in the automation uses. Does it make sense?
What exactly do you have now, and how is it not working? I.e., are you seeing any errors? Can you see the call_service event in home-assistant.log? (You may have to set homeassistant.core to debug in the logger to be able to see these events first.)
I’m trying now to do this action “the right way”, with ifttt_webhook_received, but my family is sick of our audio system going on and off, so I had to stop.
Turning on debug might be a turning point for making it work, though.
I’m still using a slightly old version of HA and that page has since changed a bit. But, yes, that’s what I meant. Each time the event is received it will dump out the event data, etc.