Automate Boring Stuff Home Assistant

Automate Ring Security Alarm

As a homeowner, if you are tired of checking the Ring app repeatedly to make sure your home is armed for away when you are not home, armed for home when you are home, and lastly trying to rush to the keypad because the alarm is about to go off if you don’t disarm it in 30 seconds – then this automation is for you. It has saved me a lot of headache and time because it simply works based on family members’ locations and requires zero input from me.

Presence Detection vs. Location Tracking

I use a combination of location tracking and presence detection for location-based automations. I have the Home Assistant and life360 app installed on my phone and my wife’s phone, which updates our locations constantly. This helps with some advance automations such as

  • Turning the AC on when we are getting close to our home
  • Turn “away lighting” on if we are more than 100 miles away from home (probably means we are on a holiday)

For my parents and nanny, I don’t want to track their geographic locations. I also don’t want to arm the house when my wife and I are not home, but either my parents or nanny are still home. So I simply use their phone’s wifi connection with my eero mesh wifi router for presence tracking. This lets me know if they are home or away.

Automations

Arm Home at Night

triggers every night at 10PM and changes the alarm security mode to “Armed Home” if we are home. It also triggers every 30 minutes from 10 PM to 7 AM and changes it to “Armed Home” if it wasn’t. This takes care of the scenarios where it was disarmed for some reason in between the two triggers or if we were not home and the alarm was “Armed Away”.

- id: '1606297195893'
  alias: Alarm - Armed-Home
  description: ''
  trigger:
  - platform: time
    at: '22:00:00'
  - platform: time_pattern
    minutes: '30'
  condition:
  - condition: device
    device_id: fc02c8fb53d2e4b9e63cd1ec12f384bf
    domain: alarm_control_panel
    entity_id: alarm_control_panel.bothell_alarm
    type: is_disarmed
  - condition: time
    after: '22:00:00'
    before: 07:00:00
  action:
  - device_id: fc02c8fb53d2e4b9e63cd1ec12f384bf
    domain: alarm_control_panel
    entity_id: alarm_control_panel.bothell_alarm
    type: arm_home
    code: ''
  mode: single

Disarm when the Lock is unlocked

This automation automatically disarms the alarm if it’s triggered by unlocking the front door or the backdoor lock. There are some failsafe conditions in place to prevent this automation from disarming the alarm if noone from the family is home or the alarm siren is already on.

- id: '1609212244494'
  alias: Alarm - Disarmed when Lock is unlocked
  description: ''
  trigger:
  - platform: state
    entity_id: lock.back_door
    from: locked
    to: unlocked
  - platform: state
    entity_id: lock.front_door_lock
    from: locked
    to: unlocked
  condition:
  - condition: state
    entity_id: group.anyone_home
    state: home
  - condition: device
    device_id: fc02c8fb53d2e4b9e63cd1ec12f384bf
    domain: alarm_control_panel
    entity_id: alarm_control_panel.bothell_alarm
    type: is_armed_home
  - condition: device
    type: is_off
    device_id: fc02c8fb53d2e4b9e63cd1ec12f384bf
    entity_id: switch.bothell_siren
    domain: switch
    for:
      hours: 0
      minutes: 1
      seconds: 0
  action:
  - device_id: fc02c8fb53d2e4b9e63cd1ec12f384bf
    domain: alarm_control_panel
    entity_id: alarm_control_panel.bothell_alarm
    type: disarm
    code: ''
  mode: single

Armed Away when leaving Home

This automation triggers when anyone leaves the house and arms the house for away if noone is home.

- id: '1591947032838'
  alias: Alarm - Armed-Away when leaving home
  description: ''
  trigger:
  - entity_id: person.harshit
    event: leave
    platform: zone
    zone: zone.home
  - entity_id: person.heta
    event: leave
    platform: zone
    zone: zone.home
  condition:
  - condition: not
    conditions:
    - condition: state
      entity_id: group.anyone_home
      state: home
  action:
  - type: turn_on
    device_id: fc02c8fb53d2e4b9e63cd1ec12f384bf
    entity_id: switch.bothell_arming_bypass_mode
    domain: switch
  - device_id: fc02c8fb53d2e4b9e63cd1ec12f384bf
    domain: alarm_control_panel
    entity_id: alarm_control_panel.bothell_alarm
    type: arm_away
    code: ''
  mode: single

Alarm Disarmed when coming Home

This automation disarms the security alarm when someone comes home and its not alarming currently.

- id: '1591947292293'
  alias: Alarm - Disarmed when coming Home
  description: ''
  trigger:
  - entity_id: person.harshit
    event: enter
    platform: zone
    zone: zone.home
  - entity_id: person.heta
    event: enter
    platform: zone
    zone: zone.home
  condition:
  - condition: device
    device_id: fc02c8fb53d2e4b9e63cd1ec12f384bf
    domain: alarm_control_panel
    entity_id: alarm_control_panel.bothell_alarm
    type: is_armed_away
  - condition: not
    conditions:
    - condition: device
      device_id: fc02c8fb53d2e4b9e63cd1ec12f384bf
      domain: alarm_control_panel
      entity_id: alarm_control_panel.bothell_alarm
      type: is_triggered
  action:
  - device_id: fc02c8fb53d2e4b9e63cd1ec12f384bf
    domain: alarm_control_panel
    entity_id: alarm_control_panel.bothell_alarm
    type: disarm
    code: ''
  mode: single

Motion detected when Armed-Away

This automation triggers when any of my interior motion sensors detect motion when no one (family) is home and the alarm is armed for away. But I was getting some false alarms when we had some guests at home, but my wife and I were not home. Also, the Lidar from my Roborock vacuum triggers the PIR motion sensors. So I have added a few conditions to the automation to address these false positives.

- id: '2437638576345980912847923'
  alias: Alarm - Motion detected when Armed-Away
  trigger:
  - entity_id: group.interior_motion_sensors
    for: 00:00:10
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - condition: or
    conditions:
    - condition: and
      conditions:
      - condition: not
        conditions:
        - condition: state
          entity_id: group.anyone_home
          state: home
      - condition: state
        entity_id: input_boolean.guest_mode
        state: 'off'
    - condition: state
      entity_id: alarm_control_panel.bothell_alarm
      state: armed_away
  - condition: state
    entity_id: vacuum.dusty
    state: docked
  action:
  - data: {}
    entity_id: input_boolean.guard_dog
    service: input_boolean.turn_on
  - data:
      data:
        entity_id: camera.living_room
        group: motion-alert
        url: /lovelace-admin/rooms
      message: Movement detected in your home.
      title: Motion Alert!
    service: notify.mobile_app_harshits_iphone
  mode: single

Check out my previous post on how I keep both Ring Security Alarm and Alexa Guard in sync using Home Assistant. See my other posts on automation with Home Assistant if you are looking for home automation inspiration.

Leave a Reply