IFTTT, Webhooks and Alarm Control Panel

Hello,

I’ve a problem with my Home Assistant, IFTTT and the component IFTTT Alarm Control Panel.
Since IFTTT have changed and now used Webhook instead API Password.

I’ve seen that we need now to create an automation to exchange with IFTTT an then execute action with something like that.

- alias: 'Call service from ifttt'
  trigger:
    platform: event
    event_type: ifttt_webhook_received
    event_data:
      action: call_service
  action:
    service_template: '{{ trigger.event.data.service }}'
    data_template:
      entity_id: '{{ trigger.event.data.entity_id }}'

My problem is that I need to pass to pass another argument that is “state” of the alarm get from IFTTT.

{ "action": "call_service", "service": "alarm_control_panel.ifttt_push_alarm_state", "entity_id": "alarm_control_panel.somfy_home_alarm","state": "armed_night" }

I tried but could not recover the state from IFTTT to re-use it in my automation. I’m a beginner with Home Assistant. Anyone to help ?

By the way, this documentation is not up to date : https://www.home-assistant.io/components/alarm_control_panel.ifttt/

Thanks you very much !

After some time, I’ve found a solution by myself

- id: ifttt_automation
  alias: IFTTT Automation
  trigger:
    platform: event
    event_type: ifttt_webhook_received
    event_data:
      action: call_service
  action:
    service_template: '{{ trigger.event.data.service }}'
    data_template:
      entity_id: '{{ trigger.event.data.entity_id }}'
      state: '{{ trigger.event.data.state }}'

I have setup 3 applets in IFTTT to arm/disarm/arming home the alarm.
How can I update the status of the alarm every time the alarm changes status.

I am missing these next steps:

IF the alarm system was disarmed, THEN perform a Webhook POST web request to url https://HASS_URL/api/services/alarm_control_panel/ifttt_push_alarm_state?api_password=API_PASSWORD with content type application/json and body {"entity_id": "alarm_control_panel.DEVICE_NAME", "state": "disarmed"}.
IF the alarm system state changed to armed home, THEN perform a Webhook POST web request to url https://HASS_URL/api/services/alarm_control_panel/ifttt_push_alarm_state?api_password=API_PASSWORD with content type application/json and body {"entity_id": "alarm_control_panel.DEVICE_NAME", "state": "armed_home"}.
IF the alarm system state changed to armed away, THEN perform a Webhook POST web request to url https://HASS_URL/api/services/alarm_control_panel/ifttt_push_alarm_state?api_password=API_PASSWORD with content type application/json and body {"entity_id": "alarm_control_panel.DEVICE_NAME", "state": "armed_away"}.
IF the alarm system state changed to armed night, THEN perform a Webhook POST web request to url https://HASS_URL/api/services/alarm_control_panel/ifttt_push_alarm_state?api_password=API_PASSWORD with content type application/json and body {"entity_id": "alarm_control_panel.DEVICE_NAME", "state": "armed_night"}.

I am doing the same as you, this stopped working since upgrading to the latest version of HA. I would guess the syntax of the call has changed but haven’t had the time to test (alternatively i could be completely wrong and something else is at play.

I found the problem.
I needed to change the body oft the webhook to

{ “action”: “call_service”, “service”: “alarm_control_panel.ifttt_push_alarm_state”, “entity_id”: “alarm_control_panel.xxxxxxxxxx”, “state”: “armed_away” }.

Then I have adjusted my automation accordingly.

1 Like

thanks, do you use api_password or a long life access token? I think this is the issue

Neither.
The documentation is not 100% correct.
You have to use the integration with ifttt and then you have to use the url there.
Do not use the url that is in the documentation to update the status.

Looks like .103 may have broken this component.

I’ve tried changing the body of the json from alarm_control_panel.ifttt_push_alarm_state to ifttt.push_alarm_state, however, it doesn’t seem to work.

I’ve also changed the JSON on IFTTT and it works for me !

Hey,

I have been trying to figure the Alarm Control panel. I have succeeded in communicating from IFTTT to Home assistant with ease. But can’t get to get it to work the other way around. Should I have a script in automation for it or something else?

Also when is restart the HA the status is unknown is there a way to request the status, don’t seem like possible in IFTTT.

thanks

1 Like

Hey there,

I’m struggling to get this working.
I’ve setup IFTTT, Webhooks and my automation.yaml file as you guys antoine_g and 03397 already pointed out in this topic.
My IFTTT Content type is Application/json and Body is set to:
{ “action”: “call_service”, “service”: “ifttt_push_alarm_state”, “entity_id”: “alarm_control_panel.XXXXX”, “state”: “armed_away” }
…tried even…
{ “action”: “call_service”, “service”: “alarm_control_panel.ifttt_push_alarm_state”, “entity_id”: “alarm_control_panel.XXXXX”, “state”: “armed_away” }
My automation.yaml is

  • id: ifttt_automation
    alias: IFTTT Automation
    trigger:
    platform: event
    event_type: ifttt_webhook_received
    event_data:
    action: call_service
    action:
    service_template: ‘{{ trigger.event.data.service }}’
    data_template:
    entity_id: ‘{{ trigger.event.data.entity_id }}’
    state: ‘{{ trigger.event.data.state }}’

…and I still receive the error log:

Log Details (ERROR)

Logger: homeassistant.components.ifttt
Source: components/ifttt/init.py:98
Integration: ifttt (documentation, issues)
First occurred: 10:15:23 PM (3 occurrences)
Last logged: 10:28:46 PM

Received invalid data from IFTTT. Data needs to be formatted as JSON: { “action”: “call_service”, “service”: “alarm_control_panel.ifttt_push_alarm_state”, “entity_id”: “alarm_control_panel.XXXXXXX”, “state”: “armed_away” }

Could someone point me into the right direction? I have no clue how to solve this.

if you are on a version after 0.103 you need to change
"alarm_control_panel.ifttt_push_alarm_state"
to
"ifttt.push_alarm_state".

Hi gliena,

thank you for your reply.
I still get this Error:

Log Details (ERROR)

Logger: homeassistant.components.ifttt
Source: components/ifttt/init.py:98
Integration: ifttt (documentation, issues)
First occurred: 1:40:42 PM (1 occurrences)
Last logged: 1:40:42 PM

Received invalid data from IFTTT. Data needs to be formatted as JSON: { “action”: “call_service”, “service”: “ifttt_push_alarm_state”, “entity_id”: “alarm_control_panel.my_house_alarm_name”, “state”: “armed_away” }

Just to understand it correctly and I surely do not miss entering anything:
I have this entry in configuration.yaml:

IFTTT

ifttt:
key: !secret ifttt_key

…Key stored in secrets.yaml but as I understood correctly this will only be triggered if I start something towards IFTTT Webhook

I have only this in my automation.yaml:

  • id: ifttt_automation
    alias: IFTTT Automation
    trigger:
    platform: event
    event_type: ifttt_webhook_received
    event_data:
    action: call_service
    action:
    service_template: ‘{{ trigger.event.data.service }}’
    data_template:
    entity_id: ‘{{ trigger.event.data.entity_id }}’
    state: ‘{{ trigger.event.data.state }}’

And my IFTTT Webhook is triggered by Google Assistant with the passphrase “Would you”
to
URL: https://xxxxx.duckdns.org/api/webhook/ IFTTT key stored also in secrets.yaml like mentioned before
Method: POST
Content type: application/json
Body: { “action”: “call_service”, “service”: “ifttt_push_alarm_state”, “entity_id”: “alarm_control_panel.my_house_alarm_name”, “state”: “armed_away” }

Did I fail to enter something somewhere?
Please advise…I try to figure this out but I’m stuck.

I am having the same problem. I am currently on 0.114.3. I use Nabu Casa for my webhooks url.
This is my IFTTT setup:
Method: POST
Body: { “action”: “call_service”, “service”: “ifttt.push_alarm_state”, "entity_id": "alarm_control_panel.ismart_alarm", "state": "disarmed"}
URL: Nabu Casa generated webhooks URL
Content type: application/json

I have a similar app for “armed_home”

My automation yaml:

- id: test
  alias: Test Alarm System
  trigger:
  - event_data:
      action: call_service
    event_type: ifttt_webhook_received
    platform: event
  condition: []
  action:
  - service_template: '{{ trigger.event.data.service }}'
    data_template:
      entity_id: '{{ trigger.event.data.entity_id }}'
      state: '{{ trigger.event.data.state }}'

I know IFTTT is communicating with my HA because I get the following errors when switch states on my iSmart Alarm app:

Received invalid data from IFTTT. Data needs to be formatted as JSON: { “action”: “call_service”, “service”: “ifttt.push_alarm_state”, "entity_id": "alarm_control_panel.ismart_alarm", "state": "disarmed"}
Received invalid data from IFTTT. Data needs to be formatted as JSON: { “action”: “call_service”, “service”: “ifttt.push_alarm_state”, "entity_id": "alarm_control_panel.ismart_alarm", "state": "armed_home"}

Using the alarm control panel on HA works correctly with IFTTT to change the state of my alarm. If I can get some help on getting the updated state sent to HA via IFTTT I would greatly appreciate it.

Thank you!

Hello all!

I was receiving the same error and after carefully looking at what might be the cause, I found out that the quotation marks are not read properly if you copy it/them from here: https://www.home-assistant.io/integrations/alarm_control_panel.ifttt/

Bad: “
Good: "

After modifying them in my code, everything worked properly.

Good luck!