Unable to get a basic automation to work

I have a binary sensor rpi_gpio that is working as monitored on the overview screen in HA as ‘on’ and ‘off’. I have also confirmed the functionality by looking at the states (<>). I have added an !include automation.yaml file and have checked my config before restarting

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
zone: !include zones.yaml

and added a simple webhook for my action.

# send a webhook as a test of home
- alias: 'gpio to trigger a webhook'
  trigger:
     platform: state
     entity_id: binary_sensor.alarm
     from: 'off'
     to: 'on'
#     state: 'on'
  action:
     service: ifttt.trigger
     data:
       event: MOTIONDETECT

in the states screen the automation shows up as follows (not sure if that is good or bad)


the webhook works properly as when I manually trigger the automation it is received in IFTTT

Before I move on to other automatons, I think I want to debug this simple one. I am able to trigger the binary at will and have tried it many times. What I would like to be able to do is trigger this automation via the GPIO and as a bonus, add an action that would send information to a log to help me debug in the future.

What does automation.gpio_to_trigger_a_webhook look like on the States page?

EDIT: Wait. You provide a lot of detail, and make a bunch of statements, but you don’t ask a question or state a problem. What are you asking for help with?

this is what the states page looks like


which seems a bit odd since it says ‘on’. not sure I understand what that means yet.
below is the binary sensor state

the binary sensor will change from ‘off’ to ‘on’ at will

Problem. the binary sensor state changes from on to off and back on but never triggers any automation. I would like it to trigger the automation noted so I must have something incorrect and could use help.

bonus for me would be for someone to help me add an action so that when any automation or is successful it logs somewhere where i can have access. this will help me debug in the future.

An automation’s state (on or off) controls whether or not it will monitor its triggers/conditions and run its actions when the triggers/conditions “fire.” So, if the automation is off, then it won’t do anything. It has to be on in order to do anything. Since yours shows that it’s on, that’s good.

The automation is currently configured to trigger if binary_sensor.alarm goes from off to on. However, you seem to imply you want it to trigger if binary_sensor.pir_alarm goes from off to on. If so, you need to change the entity_id in the automation’s trigger from binary_sensor.alarm to binary_sensor.pir_alarm.

There are already three logging systems that exist that can provide this information. See Logbook, Logger & System Log.

This is perfect. Thanks for the help as changing the 'entity_idin the automation’striggerfrom binary_sensor.alarmtobinary_sensor.pir_alarm` was the fix. This will help me with all future automatons so thanks again

1 Like