Turn on light when comming home - dosnt work

I try to make an automation that trickers when I come home, but it never does…
It works when I manuel tricker, and I think the problem is because HA dosnt se me enter the home zone. Looking at HA it sees me home so why it dosnt see me enter home I cant figure out…

My automation is this:

- id: '1571595362240'
  alias: Turn on lights when comming home
  description: ''
  trigger:
  - entity_id: person.andreas_lorensen
    event: enter
    platform: zone
    zone: zone.home
  condition:
  - after: sunset
    before: sunrise
    condition: sun
  - condition: state
    entity_id: light.living_room_light
    state: 'off'
  action:
  - device_id: e869b69f1645415f95fad2b626b69cff
    domain: light
    entity_id: light.living_room_light
    type: turn_on
  - device_id: d5611d4fbf2348f6a4453c5d2ed37482
    domain: switch
    entity_id: switch.outlide_light_switch
    type: turn_on
  - device_id: ced7d98974fd4dfd8e17db637fce5734
    domain: switch
    entity_id: switch.stairs_botton_wall_switch
    type: turn_on
  - device_id: 9782589706024062a8f5e25d7b43a14c
    domain: switch
    entity_id: switch.office_table_light_switch
    type: turn_on
  - device_id: 2bba2b1c053841a2b13879db88645e90
    domain: switch
    entity_id: switch.kidsroom_table_light
    type: turn_on

What type of device tracker are you using?

If a GPS type tracker (typically your phone) then the above should work.

If its is a device tracker based on connection to your router, WiFi, or other local/non-gps device_tracker you will likely need to trigger based on to: home with a state trigger.

See an example here:

1 Like

Also it can’t be both after sunset and before sunrise. “After sunset” means between sunset and tonight’s midnight, and “before sunrise” means between this morning’s midnight and sunrise. I’m guessing you might want this instead:

  - condition: state
    entity_id: sun.sun
    state: 'below_horizon'
2 Likes

Well the person have both GPC base on owntracks and wifi connected. But I will try changeto a state instead of a zone.

Thanks

Ohh and also try changeing to state on the sun condition. Thanks for that to :slight_smile:

1 Like