What's wrong with this snippet?

 - alias: "Turn off lights when away"
      - platform: state
        entity_id: group.all_devices
        from: 'home'
        to: 'not_home'
      service: light.turn_off
      entity_id: group.all_lights

The lights don’t turn off when the status changes from ‘home’ to ‘not_home’.

Also, when I click “Logbook” or “History”, I just get that rotating colored circle that never stops spinning. This makes it very hard to troubleshoot.

Instead of looking at Logbook or History, try tailing (tail -f home-assistant.log) for clues.


I got the following error:

16-09-07 16:38:27 homeassistant.bootstrap: Invalid config for [automation]: expected a dictionary @ data['condition'][0]. Got 'a'
extra keys not allowed @ data['conditions']. Got [OrderedDict([('condition', 'state'), ('entity_id', 'group.all_devices'), ('state', 'home')]), OrderedDict([('condition', 'state'), ('entity_id', 'lights.lampbureau'), ('state', 'off')])] (See /home/jeroen/.homeassistant/configuration.yaml:107)

However, line 107 is not related to this issue. But I assume Home Assistant stops parsing the config file when it encounters an error.

The section at line 107 reads:

 - alias: "Turn on Office lamp after sunset"
      - platform: sun
        event: sunset
        offset: "-00:30:00"
    condition: and
      - condition: state
        entity_id: group.all_devices
        state: 'home'
      - condition: state
        entity_id: light.lamp_bureau
        state: 'off'
      service: scene.turn_on
      entity_id: scene.office_normal

You are missing one more condition: statement before the condition: and , and take care of the indentarion after adding that.

1 Like

Thanks, that fixed it :slight_smile:

I think we need a special badge for the number of times you’ve spotted this. LOL (Thanks again for your help the other day with this!)

:smile: Yes, maybe I’ll try to update the documentation one day to clarify this thing. It’s a bit confusing.

1 Like