Simple automation. For garage opening

Hi.

Im trying to make an automation, but i can’t figure out what I do wrong. The automation should turn on the light (for testing) when I enter the Garage Zone, if these conditions are right.

I’m driving
I’m not home
The light is off (here it would been garage door closed), but for testing I’m using a light


- id: '1605512253242'
  alias: Kim Driving Home
  description: 
  trigger:
  - platform: geo_location
    source: device_tracker.kims_iphone
    zone: zone.garage
    event: enter
  condition:
  - condition: device
    device_id: 106318162e3197e26553d0e6325e93fd
    domain: device_tracker
    entity_id: device_tracker.kims_iphone
    type: is_not_home
  - condition: and
    conditions:
    - condition: state
      entity_id: sensor.kims_iphone_activity
      state: Automotive
    - condition: state
      entity_id: light.entre_5704285
      state: 'off'
  action:
  - condition: state
    entity_id: light.entre_5704285
    state: 'on'
  mode: single

Read this, specifically point 11.

Sry, think I got it right now :blush:

Ok, your action should contain something to switch the light on like

  action:
    service: light.turn_on
    entity_id: your.light.id

Check this

geolocation triggers work for geolocation events, see here

Entities that are created by a Geolocation platform support reporting GPS coordinates

Device trackers are not geolocation platforms, they’re device tracker platforms :wink:

You want either the zone trigger, or a state trigger.

Yes, as @Tinkerer wrote and if you want a simple automation, start simple. Start with a trigger and action and add conditions one by one to make it more complex.

Then I’m totally off, thanks for the links.

I’m pretty green on this, so I’m sorry for the newbie questions.

Does this look more right then?

- id: '1605512253242'
  alias: Kim Driving Home
  description: ''
  trigger:
  - platform: zone
    entity_id: device_tracker.kims_iphone
    zone: zone.garage
    event: enter
  condition:
  - condition: device
    device_id: 106318162e3197e26553d0e6325e93fd
    domain: device_tracker
    entity_id: device_tracker.kims_iphone
    type: is_not_home
  - condition: and
    conditions:
    - condition: state
      entity_id: sensor.kims_iphone_activity
      state: Automotive
    - condition: state
      entity_id: light.entre_5704285
      state: 'off'
  action:
  - service: light.turn_on
    entity_id: light.entre_5704285
  mode: single

Probably, but check in Developer Tools → States that the state really is Automotive and not automotive.

That said, conditions are and by default:

Unlike a trigger, which is always or , conditions are and by default - all conditions have to be true.

There’s no need for the separate and block there.

Tough this was and pretty simple automation. I have made it in the build in automation tool. So I have not coded it.
But I can see now, that there is a hole lot to read.

Thanks for helping a green bear out :slight_smile: @Tinkerer

1 Like