Gergely Imreh
Published © CC BY

Device Presence Alert Home Automation

Light up an LED anywhere in the world if a certain device comes on your home network.

IntermediateFull instructions provided1 hour4,594
Device Presence Alert Home Automation

Things used in this project

Hardware components

Wio Link
Seeed Studio Wio Link
×1
Seeed Studio Grove LED
×1
DD-WRT router
Or any other device that is supported by Home Assistant Presence Detection
×1

Software apps and online services

Seeed Studio Wio Link

Story

Read more

Code

configuration.yaml

YAML
Home Assistant configuration, add after the default entries in the beginning of the file generated by HA
switch:
  platform: command_line
  switches:
    presence_light:
      name: Home Presence Light
      oncmd: "/usr/bin/curl -s -X POST https://iot.seeed.cc/v1/node/GenericDOutD0/onoff/1?access_token=<token>"
      offcmd: "/usr/bin/curl -s -X POST https://iot.seeed.cc/v1/node/GenericDOutD0/onoff/0?access_token=<token>"
      statecmd: "/usr/bin/curl -s https://iot.seeed.cc/v1/node/GenericDOutD0/onoff_status?access_token=<token>"
      value_template: '{{ value_json.onoff == 1 }}'

group:
  remote:
    - switch.home_presence_light
    
device_tracker:
  platform: ddwrt
  host: 192.168.x.y
  username: <user>
  password: <password>
  interval: 10

automation 1:
  trigger:
    platform: state
    entity_id: device_tracker.xxxxxxxxxxxx
    to: 'home'
  action:
    service: homeassistant.turn_on
    entity_id: group.remote

automation 2:
  trigger:
    platform: state
    entity_id: device_tracker.xxxxxxxxxxxx
    to: 'not_home'
  action:
    service: homeassistant.turn_off
    entity_id: group.remote

known_devices.yaml

YAML
Example code in the presence detection config of Home Assistant, with Gravatar icons.
xxxxxxxxxxxx:
  name: HTC One M9
  mac: xx:xx:xx:xx:xx:xx
  picture: http://www.gravatar.com/avatar/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  track: yes
  hide_if_away: no

Credits

Gergely Imreh

Gergely Imreh

8 projects • 23 followers
Physicist, hacker, commander of a Zerg hive.

Comments