Setting up owntrack to trigger lights

Hello.

i am trying to setup owntrack to switch my tradfri lights on and off depending on if i’m home or not. i can’t for the life of me figure out how to set that up in the automation tap on the home assistant configure page.

i have a cloud mqtt server set up and owntrack is connected to it.

You’ll want a state trigger using the device_tracker entity, and then an action to turn on (or off) the lights:

initial_state: 'on'
alias: 'Home lights on'
trigger:
  - platform: state
    entity_id: device_tracker.myphone
    from: 'not_home'
    to: 'home'
action:
  - service: light.turn_on
    data:
      entity_id: light.yourlight

Reverse the to and from for leaving, and change the action to turn_off.

1 Like

That worked !!

Thank you so much :smiley: