Automation help!

Hey guys, can you figure out why this automation doens’t work??

automation 2:
  alias: Turn on if home
  trigger:
    platform: state
    entity_id: device_tracker.jesperphone_kanten_av_vintergatan_7
    from: 'away'
    to: 'home'
   action:
   - service: light.turn_on
     entity_id: group.all_lights

Hi,

I had a similar problem… and it seems that there’s no “away” state anymore as it is called “not_home”.

You can check the states in the states table, dev tools, click <>

1 Like

‘not_home’ isn’t working either:

error:
Testing configuration at /config
2018-02-19 00:41:54 ERROR (SyncWorker_0) [homeassistant.util.yaml] while parsing a block mapping
in “/config/configuration.yaml”, line 219, column 3
expected , but found ‘’
in “/config/configuration.yaml”, line 225, column 4
2018-02-19 00:41:54 ERROR (MainThread) [homeassistant.bootstrap] Error loading /config/configuration.yaml: while parsing a block mapping
in “/config/configuration.yaml”, line 219, column 3
expected , but found ‘’
in “/config/configuration.yaml”, line 225, column 4

action:
   - service: light.turn_on
     entity_id: group.all_lights

This should be…

   action:
     service: homeassistant.turn_on
     entity_id: group.all_lights
1 Like

Nope, still getting the same error with this attempt.

automation 2:
  alias: 'Turn on if home'
  trigger:
    platform: state
    entity_id: device_tracker.jesperphone_kanten_av_vintergatan_7
    from: 'not_home'
    to: 'home'
   action:
     service: homeassistant.turn_on
     entity_id: group.all_lights

That’s probably because the action and everything below it is incorrectly indented :stuck_out_tongue:

1 Like

SERIOUSLY! THAT WAS IT?! and here I was staring blindly at where the hell I mistyped.

I mustv’e double and triple checked that thing countless times before ruling it out…Thanks so much man <3

2 Likes

Yaml is very picky about spaces and tabs (in fact don’t ever use tabs in yaml file) :smiley:

1 Like

Welcome to the “3 hours of debugging because I made a typo” club!