# ============================================================================
# Lounge – Active Lux Threshold
# ============================================================================
- trigger:
    - platform: time_pattern
      minutes: "/1"
    - platform: homeassistant
      event: start
    - platform: state
      entity_id:
        - input_number.lux_lounge_morning
        - input_number.lux_lounge_day
        - input_number.lux_lounge_evening
        - input_number.lux_lounge_night
  sensor:
    - name: Lounge Lux Threshold (active)
      unique_id: lounge_lux_threshold_active
      unit_of_measurement: lx
      icon: mdi:brightness-6
      state: >
        {% set t = now().strftime('%H:%M:%S') %}
        {% if '06:30:00' <= t < '12:00:00' %}
          {{ states('input_number.lux_lounge_morning') | float(0) }}
        {% elif t < '17:00:00' %}
          {{ states('input_number.lux_lounge_day') | float(0) }}
        {% elif t < '21:00:00' %}
          {{ states('input_number.lux_lounge_evening') | float(0) }}
        {% else %}
          {{ states('input_number.lux_lounge_night') | float(0) }}
        {% endif %}