Lights on when home

Hi!

Today i have some automation that turns on some lights after sunset if someone comes home.
But i would like to redo those automations, insted it should turn on the lights after sunset, IF someone is at home. So right now it does not turn on the lights if we dont go away, then home again.

how would i do this?

Like this?

- alias: 'Lights on when home after sunset'
  trigger:
    - platform: state
      entity_id: group.all_devices
      from: 'not_home'
      to: 'home'
    - platform: sun
      event: sunset
  condition:  
    condition: and
    conditions:
      - condition: sun
        after: sunset
      - condition: state
        entity_id: group.all_devices
        state: 'home'
  action:
    - service: scene.turn_on
      entity_id: scene.evening
1 Like

Yea I guess that should work. I will try it out
Super thanks

You’re welcome.

This automation triggers in the following events:

  • Anyone comes home after sunset;
  • The sun sets when anyone is home.
1 Like

Do you need the AND for conditions - are they not explicitly AND? And triggers are OR?

And conditions are explicitly “AND” of course, triggers are “OR”.
You want the conditions to be AND, otherwise the lights will switch on at every sunset (even is nobody is home), also the lights will always switch on when entering home (even in broad daylight).

Easier to use this component…

1 Like

@anon43302295 I did not know that component yet, is it new?
Do you use it? Does it do a good job regarding fading lights according to sun elevation?

It’s not new, I’ve been using it for a while. It’s not particularly configurable but it works well enough and in combination with my lighting automations that respond to the playing state of my kodi media player it makes for a simple solution.

Im trying to set this up right now,

Do all devices need to leave and get home before it starts working?

I did this config:

light_group: group.autolight
device_group: group.devicelight
disable_turn_off: 0

I have a group called autolight where i have 5 switches (Qubinos)
I have a group called devicelight where i have some phones

Right now all the lights are off even when we all are at home, is there anything more i need to add? Or does it not work with switches?

I did try this, did not work :frowning: so i think im going with Ă  automation insted

Do you know which profiles for the lights are available for this component? I see only the “relax” one in the example and what are the difference between the various profiles?

The built in profiles are relax, concentrate, energizer and reading, but you can add your own I believe.

Ok but how to add others based on my wishes?

Have a look at light_profiles here…

1 Like