SmartThings to HomeAssistant loose ends

The final step of my migration from SmartThings to HomeAssistant is to tidy up a few loose ends by implementing some automations I had set up in SmartThings.

The story so far is that after a few problems with SmartThings, and having been impressed with HomeAssistant, I decided to move everything across to it. I picked a way of getting presence detection working with my phone that was accurate enough for my purposes without killing my battery, and then set up alarms based on presence and the HomeAssistant alarm panel.

I’ve now added a couple of other automations to replace equivalent ones that I had in SmartThings.

First of all, I wanted some lights to come on at night if I was out as a security measure.

To do this I set up a group containing the lights I wanted to switch on so that I could add and remove lights without having to edit the automation:

security_lights:
  name: Security Lights
  entities:
    - light.kitchen_light
    - light.entrance_light

The automation is then simply:

- alias: 'Lights on at sunset when away'
  trigger:
    platform: sun
    event: sunset
  condition:
    condition: state
    entity_id: group.all_devices
    state: not_home
  action:
    service: homeassistant.turn_on
    entity_id: group.security_lights

That works if I’m already out when it gets dark, but what if I went out when it was already dark? Chances are the lights would already be on, but it can still be automated:

- alias: 'Lights on at night when leaving'
  trigger:
    platform: state
    entity_id: group.all_devices
    from: home
    to: not_home
  condition:
    condition: state
    entity_id: sun.sun
    state: "below_horizon"
  action:
    service: homeassistant.turn_on
    entity_id: group.security_lights

I don’t want to leave the lights on all night, so if I’m still not home later I’ll make sure they’re switched off:

- alias: 'Security lights off when away'
  trigger:
    platform: time
    after: "23:00:00"
  condition:
    condition: state
    entity_id: group.all_devices
    state: not_home
  action:
    service: homeassistant.turn_off
    entity_id: group.security_lights

I was also using SmartThings together with IFTTT to arm and disarm Netgear Arlo cameras based on my presence. This was easily replicated with the IFTTT component for HomeAssistant and the IFTTT Maker Webhooks service. First of all I enabled IFTTT:

ifttt:
  key: your_key_here

I then based the automations on the status of the alarm panel, so that the cameras would be armed whenever the alarm panel was armed. I have automations to arm the panel overnight and when I’m out, which is also when I want the cameras armed:

- alias: 'Alarm on'
  trigger:
    - platform: state
      entity_id: alarm_control_panel.ha_alarm
      to: 'armed_home'
    - platform: state
      entity_id: alarm_control_panel.ha_alarm
      to: 'armed_away'
  action:
    service: ifttt.trigger
    data: { "event": "HA_armarlo" }

- alias: 'Alarm off'
  trigger:
    - platform: state
      entity_id: alarm_control_panel.ha_alarm
      to: 'disarmed'
  action:
    service: ifttt.trigger
    data: { "event": "HA_disarmarlo" }

And then in IFTTT I have:


So that’s it then. Nothing left for my SmartThings to do. Time to actually switch it off…

Aside from a few issues with the battery operated sensors, my overall experience of SmartThings was very good. Although those issues sped the process up I was already gradually moving across to HomeAssistant, and the reasons were more to do with having full control and not relying on a cloud service.

in Home Automation

Add a Comment

Your email address will not be published. All comments will be reviewed.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts