Automations not triggered

Hello,
I set up a number of automations in configuration.yaml, but none of them are triggered. Please see the following configuration. Note the last two are simple tests I set up - I tested this by turning my wifi off and on to simulate leaving my house and returning:

[code]automation:

  • alias: ‘Rule 1 - Outside lights on at sunset’
    trigger:
    platform: sun
    event: sunset
    offset: ‘-00:30:00’
    action:
    service: light.turn_on
    entity_id: group.outside_lights

  • alias: ‘Rule 2 - Outside lights off at 11pm if no one in living room’
    trigger:
    platform: time
    state: ‘home’
    after: ‘23:00:00’
    condition:

    • platform: state
      entity_id: group.living_room_lights
      state: ‘off’
    • platform: time
      after: ‘23:00:00’
      before: ‘04:59:59’
      action:
      service: light.turn_off
      entity_id: group.outside_lights
  • alias: ‘Rule 3 - Nest set to away when no one home’
    trigger:
    platform: state
    entity_id: group.people
    state: ‘not_home’
    action:
    service: homeassistant.turn_off
    entity_id: device_tracker.xxx

  • alias: ‘Rule 4 - Nest set to home when someone is home’
    trigger:
    platform: state
    entity_id: group.people
    state: ‘home’
    action:
    service: homeassistant.turn_on
    entity_id: device_tracker.xxx

  • alias: ‘Rule 5 - Set outside lights on after 5pm when someone comes home’
    trigger:
    platform: state
    entity_id: group.people
    state: ‘home’
    condition:
    platform: time
    after: ‘17:00:00’
    action:
    service: light.turn_on
    entity_id: group.all_lights

  • alias: ‘Rule 6 - test leave’
    trigger:
    platform: state
    entity_id: device_tracker.androidxxx
    state: ‘not_home’
    action:
    service: light.turn_off
    entity_id: group.outside_lights

  • alias: ‘Rule 7 - test home’
    trigger:
    platform: state
    entity_id: device_tracker.androidxxx
    state: ‘home’
    action:
    service: light.turn_on
    entity_id: group.outside_lights
    [/code]

Note I hid some sensitive information (xxx) for public reasons. Any help would be greatly appreciated. Thanks!

[quote=“russifer”]Hello,
I set up a number of automations in configuration.yaml, but none of them are triggered. Please see the following configuration. Note the last two are simple tests I set up - I tested this by turning my wifi off and on to simulate leaving my house and returning:
[/quote]
Hello, I checked your config at least there is some issues with spaces. I fixed your first two rules, but I see lot of other problems too. In rule 2 trigger is invalid. And if you make it trigger with time at 23 pm it triggers only one time. Rule 3 you are trying to set state for device tracker device, I am not sure if that gonna work. On my on configuration I don’t get rules working with over night time so I split them. It was good that you make some test rules. First try trigger rule without conditions and if that works add some conditions if you need.
Have you noticed this page:https://home-assistant.io/components/automation/
Fixed rules:

[code]automation:

  • alias: ‘Rule 1 - Outside lights on at sunset’
    trigger:
    platform: sun
    event: sunset
    offset: ‘-00:30:00’
    action:
    service: light.turn_on
    entity_id: group.outside_lights

  • alias: ‘Rule 2 - Outside lights off at 11pm if no one in living room’
    trigger:
    platform: time
    state: ‘home’
    after: ‘23:00:00’
    condition:

    • platform: state
      entity_id: group.living_room_lights
      state: ‘off’
    • platform: time
      after: ‘23:00:00’
      before: ‘04:59:59’
      action:
      service: light.turn_off
      entity_id: group.outside_lights[/code]

Thank you for your help! So I have a couple of follow up questions:

  • You said trigger 2 is invalid - why is that?
  • How can I have a trigger be “anytime after 23pm when the following conditions are met”?
  • How can I set a device to off as an action? You said that setting state for device tracker device won’t work - for example, is there a way to have it turn off my Nest as an action?

Thank you!

I can answer your first question:
The trigger only activates on the given argument.
It then checks the condition(s), and if conditions are met then it does the action.
Time platform does not have any state

Your trigger should be look like this:

[code]
trigger:

  • platform: time
    after: ‘23:00’[/code]
    But that will be triggered only at 23. So what you can do is add multiple triggers. Triggers are always OR, that means when one of them triggers we go to check conditions. Conditions are basically AND rules so everyone of them has to be truth and if conditions are ok, action thing will be fired up.
    So maybe you can do something like this:

[code]

  • alias: ‘Sammutetaan olohuone, valaistus pois ja laitteet pois’
    trigger:
    • platform: state
      entity_id: group.valaistus_olohuone
      to: ‘off’
    • platform: time
      minutes: 10
      seconds: 0
      condition:
    • platform: time
      before: ‘05:00:00’
    • platform: state
      entity_id: device_tracker.0017fa47ccb9
      state: ‘not_home’
    • platform: state
      entity_id: group.valaistus_olohuone
      state: ‘off’
    • platform: state
      entity_id: group.pistorasiat_olohuone
      state: ‘on’
      action:
      service: homeassistant.turn_off
      entity_id:
      • switch.tvtaso_1
      • switch.tvtaso_2[/code]
        That rule will be triggered of light group goes off OR every hour at 10 minute (like 00:10, 01:10).
        How you can triggered that second rule depends what devices you have and what kind behavior you want.

For Nest I found this: https://automic.us/forum/viewtopic.php?f=4&t=125&p=382#p397