Lights issue

Hi guys

I am new to home assistant and managed to pair up my Philips Hue lights, but am struggling to get the automation working for them to come on 15 mins before sunset. I have tried various things, but cannot get it right. This is the code I have currently. The group of lights I want to come on are called when I look at the entity id in states.

automation 2:
alias: Turn on light when sun sets
initial_state: True
hide_entity: True
platform: sun
event: sunset
offset: “-00:15:00”
condition: state
entity_id: group.all_devices
state: ‘home’
service: homeassistant.turn_on


Can you re-post your automation using the code tags </> for formatting?

Can you send a screen shot of the entity with its attributes?

Did you put these lights in an actual group making them group.kitchen_lights or something along those lines?

Here’s one issue.
Try this:

service: light.turn_on


I usually use homeassistant.turn_on to turn on a list of different entities from different domains.

I would think it would work for a single entity but it is certainly worth a shot @andyp85 .

The only difference is light.turn_on allows you to specify a brightness/color, but yes you could technically use homeassistant.turn_on

I figure using the light service since it’s specifically turning on a light, less processing time/load.

@andyp85’s issue may be that all the devices in the group are not flagged as “home”.

1 Like

Thanks for the responses. I tried changing to light.turn_on but it made no difference. Images attached of what I have in the configuration.yaml file for the lights, the attribute and the other bit I have in my configuration file which put displayed the light groups I had set up in my hue app.

Any errors in the log about the hue?

I dont recognize the is_hue_group: true variable

No errors relating to Hue in the home-assistant.log file. Just 3 lines regarding malformed XML (whatever they mean)

I got the is_hue _group line from the following guide >>> How do you use to find hue groups & scenes?

In my entities I don’t have anything called group.all_devices which made me think maybe that line is incorrect. But I have group.all_lights and group.all_automations . I have tried these and it didn’t work with those either

is_hue_group: true is an attribute of the group not a variable for the hue component.

You might try removing it.

I assume you followed all these steps?

1 Like

Thanks I have removed is_hue_group: true

I tried following those steps, but keep getting an error saying the id I am entering for the lights is invalid. I assume its the long unique ID I use for each light in place of the [“1”, “2”, “3”] in the guide? I find the guides are a bit vague for the beginner.

If you don’t have a group called group.all_devices per your automation, then it’s always going to return False and not trigger your lights.

Try removing

  condition: state
  entity_id: group.all_devices
  state: 'home'
1 Like

Removing that has done the trick. Thanks very much for that. I did wonder about that section and think it could be a bit clearer in the guides for the beginner, but maybe that’s just me!

I guess that condition section is only needed if you are adding another condition for the lights coming on, as well as the sun setting? (i.e. being home at the time)

1 Like

Correct, you could set a condition such as it lists when all cell phones are in a state of “home” then the lights turn on, otherwise stay off.