Light Schedules - I know, I know, but I really have searched - a lot!

OK, I have what I feel is a pretty simple need but I have totally failed to find the answer to what I’m looking for.

I would like to use light schedules to define brightness and colour temperature for different times of the day. I have created a helper schedule, populated it using the UI and entered the brightness and colour temperature values in the Additional information. So far, so good.

What I would like is any time a light is switched on, for it to read that schedule and determine its brightness & colour temperature. I have smart downlights (Philips Hue) wired to smart switches (Clipsal Wiser) and automations set up that keep the light status and switch status in sync so it doesn’t matter whether the switch is activated manually, via HA or the light activated via HA, the automation runs.

For the life of me though, I can’t work out how to integrate the schedule that I have created.

To be clear, I don’t want to use the schedule to automate lights turning on and off, just their brightness and colour temperature.

Is what I would like to do possible? Please help. TIA.

As an aside, the above is further confused by Light Profiles, which can easily be selected in an automation but do not contain time of day information.

why dont you use scenes and an automation to execute the scenes?

I have the same challenge.
I made the scenes, thank you Warlion, for the hint.
But in my case and if I understand correctly also in the case of orange3, we use light bulbs that might be turned off when the scene is activated.

Ideally the light should check which scenibis on and conform its hue to this state.

Maybe it’s possible to run a schedule every 5min with a script or so.

This is a very hard problem to solve correctly. I recommend you search for a blueprint.

I gave up on Schedules. TBH, I’m not even sure why they exist if they don’t get used as per my first post.

Using scenes and automations is more complicated that just using automations on their own, which is what I’m doing.

Have you looked at the examples in the docs… just change the trigger to be the light turning on:

triggers:
  - trigger: state
    entity_id:
      - light.kitchen
    from: "off"
    to: "on"
actions:
  - action: light.turn_on
    target:
      entity_id: light.kitchen
    data:
      brightness_pct: "{{ state_attr('schedule.light_schedule', 'brightness') }}"
      color_temp_kelvin: "{{ state_attr('schedule.light_schedule', 'color_temp') }}"

You could also just list all the lights you want to work this way and use the trigger variable to supply the entity ID in the action. Just make sure to set the automation mode to parallel or queued if it’s watching multiple lights.

Another option you might want to consider is the Scenery custom integration.

I built this some time ago to set the RGB color based on outside temperature:

    rgb_color_temperature_output:
      value_template: >-
        {% set temp_state = states('sensor.air_temperature') %}
        {% if temp_state in ['unavailable', 'unknown', 'none'] or temp_state == '' %}
          [0,0,0]
        {% else %}
          {% set temp = temp_state | int(0) %}
          {% set temp_rgb = { 2:'[255,232,244]',3:'[255,209,234]',4:'[255,184,222]',5:'[255,161,211]',6:'[255,138,202]',7:'[255,115,190]',8:'[255,89,178]',9:'[255,66,167]',10:'[255,43,156]',11:'[255,20,146]',12:'[245,18,158]',13:'[235,15,169]',14:'[224,13,179]',15:'[214,13,191]',16:'[207,10,200]',17:'[198,8,212]',18:'[186,5,222]',19:'[175,3,232]',20:'[167,0,245]',21:'[157,0,255]',22:'[140,0,255]',23:'[123,0,255]',24:'[111,0,255]',25:'[93,0,255]',26:'[76,0,255]',27:'[64,0,255]',28:'[47,0,255]',29:'[30,0,255]',30:'[17,0,255]',31:'[0,0,255]',32:'[0,25,252]',33:'[0,50,250]',34:'[0,75,250]',35:'[0,103,247]',36:'[0,126,245]',37:'[0,155,245]',38:'[0,178,242]',39:'[0,206,242]',40:'[0,228,240]',41:'[0,255,238]',42:'[5,250,217]',43:'[10,245,198]',44:'[15,242,182]',45:'[20,237,161]',46:'[26,232,143]',47:'[31,227,122]',48:'[36,222,101]',49:'[41,219,83]',50:'[46,214,66]',51:'[51,209,46]',52:'[61,214,41]',53:'[66,219,36]',54:'[75,222,31]',55:'[88,227,28]',56:'[96,232,23]',57:'[106,237,18]',58:'[112,242,13]',59:'[122,245,8]',60:'[132,250,5]',61:'[140,255,0]',62:'[153,255,0]',63:'[162,255,0]',64:'[174,255,0]',65:'[187,255,0]',66:'[195,255,0]',67:'[208,255,0]',68:'[221,255,0]',69:'[234,255,0]',70:'[242,255,0]',71:'[255,255,0]',72:'[255,247,0]',73:'[255,238,0]',74:'[255,230,0]',75:'[255,221,0]',76:'[255,213,0]',77:'[255,204,0]',78:'[255,200,0]',79:'[255,191,0]',80:'[255,183,0]',81:'[255,174,0]',82:'[255,162,0]',83:'[255,149,0]',84:'[255,136,0]',85:'[255,119,0]',86:'[255,106,0]',87:'[255,94,0]',88:'[255,81,0]',89:'[255,68,0]',90:'[255,55,0]',91:'[255,43,0]',92:'[255,38,0]',93:'[255,34,0]',94:'[255,30,0]',95:'[255,21,0]',96:'[255,17,0]',97:'[255,13,0]',98:'[255,9,0]',99:'[255,4,0]'} %}
          {% if temp < 2 %}
            [255,255,255]
          {% elif temp > 99 %}
            [255,4,0]
          {% else %}
            {{ temp_rgb[temp] | default('[0,0,0]') }}
          {% endif %}
        {% endif %}

Again, haven’t used it but believe I passed this a rgb_color: “{{ states(‘rgb_color_temperature_output’) }}” to a light.

Hope it helps.