Multiple automations on lights

Hi,

I got six different automations on my livingroom lights. Is that a problem?
Today I noticed that one automation didn’t go off.

This morning, my automation “Turn light on 07.00” triggered. But then when we left to work, the automation “Turn off lights when no one is home” didn’t trigger…

Can you guys see any problem? Do they interfere with each other?

I will link my automations here:

- action:         # When stopped go back to "normal"
  - alias: Scene ON
data:
  entity_id: scene.livingroom_normal
service: scene.turn_on
  alias: Media player paused/stopped
  condition:
  - condition: state
entity_id: sun.sun
state: below_horizon
  id: '1507830297244'
  trigger:
  - entity_id: media_player.kerneheds_vardagsrum
from: playing
platform: state
to: 'off'
  - entity_id: media_player.kerneheds_vardagsrum
from: playing
platform: state
to: paused


- action:                      #Dim when media is playing
  - data:
  entity_id: scene.livingroom_dim
service: scene.turn_on
  alias: Media player playing
  condition:
  - condition: state
entity_id: sun.sun
state: below_horizon
  id: '1507830470309'
  trigger:
  - entity_id: media_player.kerneheds_vardagsrum
platform: state
to: playing
   

 - action:
  - alias: "T\xE4nd"     #Turn on lights when someone comes home.
data:
  entity_id: group.light_vardagsrum
service: light.turn_on
  alias: "Lampor t\xE4nda"
  condition: []
  id: '1507978094585'
  trigger:
  - entity_id: group.devices_adults
from: not_home
platform: state
to: home
   

 - action:
  - alias: "Sl\xE4ck"  #Turn off lights when no one is home.
data:
  entity_id: group.light_vardagsrum
service: light.turn_off
  alias: "Lampor sl\xE4ckta"
  condition: []
  id: '1507978191001'
  trigger:
  - entity_id: group.devices_adults
from: home
platform: state
to: not_home


# Turn off lights  00.00
- alias: Stäng av lamporna vid 00.00
  trigger: 
- platform: time
  at: "23:59:00"
  condition:
- condition: or
  conditions:
- condition: state
  entity_id: group.media_player1
  state: 'off'
- condition: state
  entity_id: group.media_player1
  state: 'unknown'
  action:
- service: light.turn_off
  entity_id: group.light_vardagsrum
  
  
  
  
# Turn on lights 07.00      
- alias: Tänd lamporna vid 07.00
  trigger: 
- platform: time
  at: "07:00:00"
  condition:
- condition: state
  entity_id: group.devices_adults
  state: 'home'
  action:
- service: light.turn_on
  entity_id: group.light_vardagsrum

There’s no problem with multiple automations, though the built in automations editor makes the most horrendously formatted and hard to read automations :wink: It also looks like the formatting may have been messed up when you pasted it here, can you edit your post and fix the formatting, or share them on the likes of hastebin.com.

Hi,

I know. I don’t know how to change my automations that I did in the editor to automation.old.yaml…

Here is the link to hastebin:

https://hastebin.com/isoyubilix.pl

Picking those UI generated automations apart I see there are no quotes around paused or playing. Same problem for the rest of the automations. Your ‘07:00’ automation also had excessive indenting.

See https://hastebin.com/edenewofut.pl for some fixes (and reformatting for readability).

Hi again,

After I copied your code my automations stopped work…

For example when all come home.

I assume you ran a config check (eg hassctl config)?

Were there any errors? Do the automations work if you select them in the web interface (under States) and push Trigger?

Yes,

No errors when I did that.
It works when i trigger them in the web interface.

Then either the trigger, or the conditions, aren’t matching.

The “coming home” automation is triggering on group.devices_adults going from not_home to home. Can you confirm that group exists, and changes between those states (check the Logbook).

The group exists, and they do change from not_home to home in the Logbook…

Check for typos, and that the automation is enabled.

I’ve updated https://hastebin.com/favonaxuxi.pl to set the automations enabled by default.

Thanks, is there any way where I can set my devices to not_home manually?

Yes, look under Developer tools at the States (<>) button.

Put the entity in the entity_id line, and not_home in the State line, then push SET STATE

Now when I did that it seems to work, I will update tomorrow to see if it’s working.
Thank you very much for the help.

1 Like

@Tinkerer

Now when i left home, it didn’t turn the light off. What should i look after?

Were all entities in group.devices_adults marked as not_home? If only one leaves then the group is still home.

No it was not, my wifes owntracks is buggy on her iPhone…