Functionality for a group/scene to change behavior dynamically based on time of day

I’m working on a transition from hubitat to HA and looking to replicate the functionality of their “Room Lighting” app. Basically it is a group of devices, but you can set the device setpoint differently based on the hub mod (home/away/etc.)

I use this to create a single group that turns on warm ambient lighting at night, and cold overhead lighting during the day. I think I could achieve something similar with dashboards and conditions, but wondering if there’s another/better solution.

Thanks!

Or

I saw these, but they seem to be more relevant to making single lights respond dynamically with the sun cycle. What I’m looking for is slightly different, for example when I say “turn on living room” I want the following behavior:

  • during the day, turn on my 5000K overhead lights
  • during the evening, turn on my floor lamps to 50%
  • during the night, turn on my floor lamps to 30%

I probably wouldn’t be as worried about it if they were color changing bulbs, but they’re just “dumb” dimmables

Use a custom intent. You can add conditions and choose actions based on teh time of day:

I should have added that the voice command is via Alexa, currently controlling a basic switch. So that is essentially what I’m looking for, a switch that does different things based on time of day

Wanted to bump this one more time in case there’s a better solution out there. Seems one option is a helper controlling the “mode” and custom logic which sets the levels of devices as described here, although it seems overkill for this application: Smart relative dimming of light group...?

I managed to put together a custom light template that accomplished what I’m after. It’s not the most elegant code, but I don’t think I can define the groups upfront for the entire template (which would reduce the redundancy a lot)

light:
  - platform: template
    lights:
      test_living_room_lights:
        friendly_name: "test_living_room_lights"
        level_template: >
          {% set on_group = 'light.living_room_warm' if states('input_select.home_mode') in ['evening', 'night'] else 'light.living_room_cold' %}
          {{ (expand(on_group)
          | map(attribute='attributes.brightness', default=0)
          | map('int', -1)
          | select('greaterthan', 0)
          | list or [0])
          | average
          | round }}
        value_template: >
          {% set on_group = 'light.living_room_warm' if states('input_select.home_mode') in ['evening', 'night'] else 'light.living_room_cold' %}
          {{ expand(on_group) 
            | map(attribute='attributes.brightness', default=0)
            | map('int', -1)
            | sum > 0 }}
        turn_on:
          - service: light.turn_on
            target:
              entity_id: >
                {% set on_group = 'light.living_room_warm' if states('input_select.home_mode') in ['evening', 'night'] else 'light.living_room_cold' %}
                {{ on_group }}
          - service: light.turn_off
            target:
              entity_id: >
                {% set on_group = 'light.living_room_warm' if states('input_select.home_mode') in ['evening', 'night'] else 'light.living_room_cold' %}
                {% set off_group = 'light.living_room_cold' if states('input_select.home_mode') in ['evening', 'night'] else 'light.living_room_warm' %}
                {{ off_group }}
        turn_off:
          - service: light.turn_off
            target:
              entity_id: >
                {% set on_group = 'light.living_room_warm' if states('input_select.home_mode') in ['evening', 'night'] else 'light.living_room_cold' %}
                {% set off_group = 'light.living_room_cold' if states('input_select.home_mode') in ['evening', 'night'] else 'light.living_room_warm' %}
                {{ on_group }}
          - service: light.turn_off
            target:
              entity_id: >
                {% set on_group = 'light.living_room_warm' if states('input_select.home_mode') in ['evening', 'night'] else 'light.living_room_cold' %}
                {% set off_group = 'light.living_room_cold' if states('input_select.home_mode') in ['evening', 'night'] else 'light.living_room_warm' %}
                {{ off_group }}
        set_level:
          - service: light.turn_on
            data:
              brightness: >
                {{ brightness }}
            target:
              entity_id: >
                {% set on_group = 'light.living_room_warm' if states('input_select.home_mode') in ['evening', 'night'] else 'light.living_room_cold' %}
                {{ on_group }}