RIng Alerts via IFTTT

So there has been a lot of issues with the (great) Ring integration with HA caused by ring doing lots of changes to their public API. Whilst this gets sorted out, I thought I would get ring alerts from IFTTT working and join them together with the alerts from the ring integration to ensure reliable alerts.

Workflow looks like this:

Ring Motion/Ding -> IFTTT -> Webhook to HA -> Update input_boolean -> Updates binary_sensor

The binary sensor combines alerts from the ring integration with IFTTT so that ensures a belt and braces approach to getting alerts. So, here are all the integration steps.

  1. Setup an IFTTT Account
  2. Add Ring and Webhook services
  3. Ensure your HA instance is publicly accessible via HTTPS
  4. Enable Webhook service on HA Integrations page (rember to copy the URL)
  5. Create two IFTTT ring/webhook events for ring and motion and ensure the method, content type an body are set like this:


Data for motion event

Method: POST
Content Type: application/json
Body : { "action": "call_service", "service": "script.turn_on", "entity_id":"script.ifttt_front_door_motion" }

Data for ring event

Method: POST
Content Type: application/json
Body : { "action": "call_service", "service": "script.turn_on", "entity_id":"script.ifttt_front_door_ring" }
  1. Add Webhook automation to automation.yaml
##################################################################################
### Webhook handler
##################################################################################

- id: ifttt-webhook
  alias: "IFTTT Webhook events"
  initial_state: true
  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 }}'
  1. Add Input booleans, binary sensors and a couple of timers to configuration.yaml (my integrated ring sensors are called binary_sensor.front_door_motion and binary_sensor.front_door_ding, yours may be different)
# Input Booleans
# IFTTT ring motion      
input_boolean:
  ifttt_front_door_motion:
    name: IFTTT Front Door Motion
    initial: off
    icon: mdi:run
# IFTTT ring ding      
  ifttt_front_door_ding:
    name: IFTTT Front Door Ding
    initial: off
    icon: mdi:bell-ring-outline

# Binary Sensors
binary_sensor:
  # Sensors for combinbing IFTTT and Ring sensor events    
  - platform: template
    sensors:
      combined_front_door_motion:
        friendly_name: "Combined Front Door Motion"
        device_class: motion
        value_template: >-
          {{ is_state('input_boolean.ifttt_front_door_motion', 'on') or is_state('binary_sensor.front_door_motion', 'on') }}
      combined_front_door_ding:
        friendly_name: "Combined Front Door Ding"
        device_class: occupancy
        value_template: >-
          {{ is_state('input_boolean.ifttt_front_door_ding', 'on') or is_state('binary_sensor.front_door_ding', 'on') }}

# Timers for the motion and ding sensors
timer:
  ifttt_front_door_motion:
    duration: '00:01:00'
    icon: mdi:timer
  ifttt_front_door_ding:
    duration: '00:01:00'
    icon: mdi:timer
 
  1. Add scripts which are called by the webhoook events to scripts.yaml
##################################################################################
### IFTTT Webhook handler scripts
##################################################################################
      
ifttt_front_door_motion:
  sequence:
  - service: timer.start
    data:
      entity_id: timer.ifttt_front_door_motion
  - service: input_boolean.turn_on
    data:
      entity_id: input_boolean.ifttt_front_door_motion

ifttt_front_door_ding:
  sequence:
  - service: timer.start
    data:
      entity_id: timer.ifttt_front_door_ding
  - service: input_boolean.turn_on
    data:
      entity_id: input_boolean.ifttt_front_door_ding
  1. Automations for resetting the input_booleans when the timers finish
##################################################################################
### Front Door Bell Notifications & Controls
##################################################################################

- id: ifttt-front-door-motion-timer-finish
  alias: "IFTTT Front Door Motion Timer Finish"
  initial_state: true
  trigger:
    platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.ifttt_front_door_motion
  action:
    - service: input_boolean.turn_off
      entity_id: input_boolean.ifttt_front_door_motion

- id: ifttt-front-door-ding-timer-finish
  alias: "IFTTT Front Door Ding Timer Finish"
  initial_state: true
  trigger:
    platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.ifttt_front_door_ding
  action:
    - service: input_boolean.turn_off
      entity_id: input_boolean.ifttt_front_door_ding
  1. Restart and your done :wink:

You will how have two new binary sensors:

binary_sensor.combined_front_door_ding
binary_sensor.combined_front_door_motion

Which combine events from IFTTT and the native Ring integration. You can control the duration of the IFTTT ding and motion events by changing the timers. (NOTE: Previously the Ring sensors would trigger for 2 mins before clearing. This is no longer the case, and the motion sensor can get cleared after only a few seconds)

Hopefully the Ring integration will become more reliable as the API becomes stable, but once setup, this ensures two separate pathways to get ring events.

2 Likes