Skip to content

Instantly share code, notes, and snippets.

@azigler
Last active February 23, 2026 03:16
Show Gist options
  • Select an option

  • Save azigler/45ba8534e97c64a5bf49fbb44b0679ec to your computer and use it in GitHub Desktop.

Select an option

Save azigler/45ba8534e97c64a5bf49fbb44b0679ec to your computer and use it in GitHub Desktop.
948 Palm — Adaptive Lighting Implementation Plan

Implementation Plan — 948 Palm Adaptive Lighting Fixes

Date: 2026-02-23 Prepared by: Claude (remote SSH access to HA device) Stakeholder: Christopher


How This Works — What I Can and Can't Do Remotely

I have SSH access to the HA device and can read/write config files directly. Here's what that means:

Action Can I Do It? How
Edit automations.yaml Yes Push file via SSH
Edit AL settings (config_entries) Yes Edit JSON via SSH
Reload automations No — needs API token You click: Developer Tools > YAML > Reload Automations
Restart HA No — needs API token You click: Settings > System > Restart
Create new AL instance No — needs UI You do it: Settings > Devices & Services > Adaptive Lighting > Add
Install HACS integration No — needs UI You do it in HACS
Buy/plug in hardware No You

To unlock full remote control: In the SSH add-on config, enable "Share Supervisor API" (adds the SUPERVISOR_TOKEN to the shell environment). Then I can restart HA and reload automations myself. This is optional — everything works with you doing the reloads manually.

Backup Status

Backup Location Date
HA automatic backup On device (/backup/) Feb 21 2026 (2 days ago)
Our manual backup Local server (backups/ha-config-20260222-235530.tar.gz) Feb 22 2026
Extracted copy Local server (ha-config/) Feb 22 2026

We can restore from any of these if something goes wrong. The HA automatic backup includes everything (add-ons, database, full config).


Phase 1: Immediate Wins (I do everything, you just reload)

These are changes I push via SSH. After I push, you reload/restart once.

1A. Automation Rewrites — I push, you reload

I'll edit automations.yaml on the HA device and you click Developer Tools > YAML > Reload Automations. No restart needed.

Tap Dial Button 4 — Faster AL Reset (bd-1d9)

Problem: Takes 15+ seconds to reset adaptive lighting in the commons.

Root cause: The current automation sends 12 sequential actions — turning on all lights by area (15+ individual Hue bridge commands) plus toggling 6 sub-switches one by one. Combined with transition: 45s, lights take forever to reach target.

Fix: Replace with 3 steps: cycle AL switches off/on, then adaptive_lighting.apply for all three zones in parallel with turn_on_lights: true. This fires one smart command per zone instead of 15+ dumb ones.

- id: '1766258587804'
  alias: Fourth Button sets Adaptive Lighting in Commons
  description: >-
    Hue tap dial button 4: reset adaptive lighting in all commons rooms.
    Cycles AL switches off/on to clear manual control flags, then applies
    AL settings immediately with turn_on_lights.
  triggers:
  - device_id: 33aa9a1678ac5ccabaec3048c620820e
    domain: hue
    type: short_release
    subtype: 4
    unique_id: 5f171ff6-2035-45c1-88a6-0a257480fa8c
    trigger: device
  conditions: []
  actions:
  # Step 1: Reset AL switches (clears "manual control" flags)
  - action: switch.turn_off
    target:
      entity_id:
      - switch.adaptive_lighting_kitchen_dining
      - switch.adaptive_lighting_hallway
      - switch.adaptive_lighting_living_room
    data: {}
  - action: switch.turn_on
    target:
      entity_id:
      - switch.adaptive_lighting_kitchen_dining
      - switch.adaptive_lighting_hallway
      - switch.adaptive_lighting_living_room
    data: {}
  # Step 2: Apply AL to all three zones in parallel (also turns on lights)
  - parallel:
    - action: adaptive_lighting.apply
      data:
        entity_id: switch.adaptive_lighting_kitchen_dining
        turn_on_lights: true
        adapt_brightness: true
        adapt_color: true
    - action: adaptive_lighting.apply
      data:
        entity_id: switch.adaptive_lighting_hallway
        turn_on_lights: true
        adapt_brightness: true
        adapt_color: true
    - action: adaptive_lighting.apply
      data:
        entity_id: switch.adaptive_lighting_living_room
        turn_on_lights: true
        adapt_brightness: true
        adapt_color: true
  mode: single

Why it's better: adaptive_lighting.apply calculates the correct sun-based values right now and sends them with turn_on_lights: true. The parallel: block fires all three simultaneously. Combined with Phase 1B's transition reduction (45s → 3s), the button press should feel nearly instant.


Laundry Door — Fix IKEA Bulb Dimness (bd-ym5)

Problem: Laundry light comes on dim on first door open. Close-reopen fixes it.

Root cause: The IKEA E26 bulb in the laundry can't reliably handle brightness_pct + color_temp_kelvin in a single command. It's a known firmware bug — the bulb starts transitioning one attribute and drops the other. On first open, brightness gets dropped. On second open, the bulb is already initialized so both apply.

Fix: Add transition: 0 to force instantaneous application (bypasses the firmware timing bug).

Day Mode:

- id: '1740186005492'
  alias: Turn On Laundry Room Lights with Door (Day Mode)
  description: >-
    Opens laundry door while kitchen is on: match kitchen color temp at full
    brightness. Uses transition:0 to work around IKEA bulb firmware bug.
  triggers:
  - type: opened
    device_id: a5c8dc32f27c09b00bb3cf133dbb1ac2
    entity_id: d4dcdf422bca4a969a3b3e0dab107ea5
    domain: binary_sensor
    trigger: device
  conditions:
  - condition: device
    type: is_on
    device_id: fbe0492b177aa1bc4f8642b55b9ae6c5
    entity_id: 7ed420413195bc106f13f488c856c461
    domain: light
  actions:
  - variables:
      oven_color_temp_kelvin: >-
        {{ state_attr('light.kitchen_oven_far_left', 'color_temp_kelvin') }}
  - action: light.turn_on
    data:
      color_temp_kelvin: "{{ oven_color_temp_kelvin }}"
      brightness_pct: 100
      transition: 0
    target:
      entity_id:
      - light.laundry_room
  mode: single

Night Mode:

- id: '1740233317019'
  alias: Turn On Laundry Room Lights with Door (Night Mode)
  description: >-
    Opens laundry door while kitchen is off: full brightness first, then apply
    night scene color. Order matters for IKEA bulb compatibility.
  triggers:
  - type: opened
    device_id: a5c8dc32f27c09b00bb3cf133dbb1ac2
    entity_id: d4dcdf422bca4a969a3b3e0dab107ea5
    domain: binary_sensor
    trigger: device
  conditions:
  - condition: device
    type: is_off
    device_id: fbe0492b177aa1bc4f8642b55b9ae6c5
    entity_id: 7ed420413195bc106f13f488c856c461
    domain: light
  actions:
  - action: light.turn_on
    data:
      brightness_pct: 100
      transition: 0
    target:
      entity_id: light.laundry_room
  - delay:
      milliseconds: 300
  - action: scene.turn_on
    data: {}
    target:
      entity_id: scene.laundry_room_natural_light_2
  mode: single

New: Closet Off When Bedroom Turns Off (bd-2zv)

Problem: Closet lights stay on when you turn off bedroom lights for bed.

Fix: Simple trigger — when bedroom fan east turns off, turn off the closet strip. Fan east is already the "is bedroom awake?" signal used in the existing closet automations.

- id: 'closet_off_with_bedroom'
  alias: Turn Off Closet Lights When Bedroom Turns Off
  description: >-
    When bedroom fan east turns off (bedtime), also turn off the closet strip.
  triggers:
  - trigger: state
    entity_id:
    - light.bedroom_fan_east
    to: 'off'
  conditions:
  - condition: state
    entity_id: light.bedroom_closet_strip
    state: 'on'
  actions:
  - action: light.turn_off
    target:
      entity_id: light.bedroom_closet_strip
  mode: single

1B. AL Settings — I edit config_entries JSON, you restart HA

These changes live in /config/.storage/core.config_entries (the internal JSON store for all integration settings). I'll edit the JSON directly via SSH, then you restart HA: Settings > System > Restart.

What I'll change:

Instance Setting Current → New Why Bead
All 7 instances transition 45.0 → 3.0 #1 cause of everything feeling slow. Lights currently take 45s to reach target after each AL update. 3s is smooth but fast. bd-1d9 + all
Bedroom Closet min_brightness 1 → 55 At night AL calculates ~1% brightness for the closet — basically invisible. 55% matches other rooms and you always need to see in a closet. bd-3m4
Garage only_once false → true AL applies once when lights turn on, then stops. Prevents the 90-second override loop. Garage lights are motion-triggered so they get fresh values each time anyway. bd-1al
Living Room detect_non_ha_changes false → true Lets AL detect when you change lights from the Hue app and stop overriding. Currently invisible to AL. bd-3tp
Living Room lights light.living → 8 individual lights Hue groups have a known bug (#1034) where AL can't detect manual changes through the group entity. Individual lights fix this. bd-3tp

Living Room individual lights list: light.orb, light.outer_right, light.outer_left, light.center_left, light.center_right, light.inner_left, light.inner_right, light.windows

Trade-off note — Hue bridge rate limits: The Hue bridge can handle ~10 individual light commands/second. Switching from the group entity (1 command) to 8 individual lights means AL sends 8 commands per update cycle instead of 1. At 10/sec this takes under 1 second — well within limits. We're making this trade-off because the group entity bug (#1034) completely breaks manual override detection, which is a worse problem than slightly more bridge traffic. The same logic applies to Phase 2A (Bedroom → individual lights).

How the living room fix works after the change:

  1. You set a Hue scene via the Hue app or a remote
  2. AL polls every 90s and sees the lights differ from what it last set
  3. detect_non_ha_changes: true marks those lights as "manually controlled"
  4. AL stops touching them until you explicitly reset it (tap dial button 4)

Risk: Editing config_entries JSON directly. A malformed JSON file would prevent HA from starting. Mitigations: we have 3 backups (device auto-backup, our local backup, our extracted copy). I'll validate the JSON before pushing.


Phase 1 Deployment

  1. I push automations.yaml changes to the HA device
  2. I push config_entries changes to the HA device
  3. You restart HA from the UI: Settings > System > Restart (covers both)
  4. Test the tap dial button — should be dramatically faster
  5. Test closet door — should be bright at all times of day
  6. Test laundry door — should be full brightness on first open
  7. Test garage — set a manual scene, wait 2 minutes, verify it doesn't revert
  8. Test living room — set a Hue scene, verify AL doesn't override it

Phase 2: You Do In the UI (5-10 minutes clicking)

These require the HA web interface. I can't do them via file edits.

2A. Modify Bedroom AL Instance (bd-3lq, part 1)

Where: Settings > Devices & Services > Adaptive Lighting > Bedroom > Configure

Change: Replace light.bedroom (Hue group) with individual lights:

  • light.bedroom_fan_east
  • light.bedroom_fan_south
  • light.bedroom_fan_west
  • light.bedroom_desk_lamp
  • light.tall_floor_lamp

Do NOT include light.chris_bedside or light.andrew_bedside — those go in a separate instance next.

2B. Create "Bedroom Bedside" AL Instance (bd-3lq, part 2)

Where: Settings > Devices & Services > Adaptive Lighting > Add Entry

Setting Value
Name Bedroom Bedside
Lights light.chris_bedside, light.andrew_bedside
min_brightness 5
max_brightness 25
min_color_temp 2200
max_color_temp 5000
transition 3
initial_transition 1
sunset_offset 2699
brightness_mode linear
take_over_control true
detect_non_ha_changes true
adapt_only_on_bare_turn_on true
only_once false
intercept true

What this does: Bedside lamps track the same color temperature curve as the room but max out at 25% brightness. At midday they'll be at 25%, at evening ~14%. Same warmth as the ceiling fan bulbs but much dimmer — reading-light level.

Note: Both bedside lamps are Hue ambiance spots (LTG001) — color temp only, no RGB. They'll match the room's warmth perfectly but can't do colored scenes. That's fine for bedside lamps.

2C. Fix Closet Door Sensor Group (important — may be broken now)

Where: Settings > Devices & Services > Helpers

Look for bedroom_closet_door_sensor_group. Our config analysis confirmed that this group still references old Aqara sensors (0x00158d008b880c15_contact and 0x00158d008b80948f_contact) that were replaced by IKEA PARASOLL sensors. Update the members to:

  • binary_sensor.bedroom_closet_door_sensor_right_contact
  • binary_sensor.bedroom_closet_door_sensor_left_contact

Why this matters: All four closet door automations trigger off this group. If the group is pointing at dead sensors, the closet automations (turn on with door, turn off with door, day/night mode) may not be firing at all — or may be using stale state from the old sensors. Check this before Phase 1 to ensure the closet automations actually work.

Quick test: Open the closet door and check if the lights respond. If they do, the group may have been updated already and this is a non-issue. If they don't, this is the cause.


Phase 3: Needs Hardware (you buy/set up, I write the automation)

3A. Smart Outlet for Reading Chair GU10 (bd-2u1)

The problem: The IKEA TRADFRI GU10 bulb in the office ("Reading Chair") periodically loses its Zigbee connection. Known IKEA firmware bug — the radio enters sleep mode and doesn't wake up. The Hue bridge can't push firmware updates to IKEA bulbs.

What you need to buy: A smart outlet on your Z2M network (e.g., any Zigbee plug that works with your Sonoff dongle). Plug the Reading Chair lamp into it.

What you need to do in the Hue app: Set the GU10 bulb's "Power-on behavior" to "Last state" so it restores after power cycle.

Then I deploy this automation (daily 4 AM power cycle):

- id: 'ikea_gu10_daily_power_cycle'
  alias: Daily Power Cycle - Reading Chair GU10
  description: >-
    Power-cycles the IKEA GU10 bulb's outlet at 4 AM daily to prevent
    the Zigbee radio sleep bug.
  triggers:
  - trigger: time
    at: "04:00:00"
  conditions: []
  actions:
  - variables:
      was_on: "{{ is_state('light.color_temperature_light_1_3', 'on') }}"
  - action: switch.turn_off
    target:
      entity_id: switch.reading_chair_outlet  # UPDATE with actual entity
  - delay:
      seconds: 10
  - action: switch.turn_on
    target:
      entity_id: switch.reading_chair_outlet  # UPDATE with actual entity
  - delay:
      seconds: 15
  - choose:
    - conditions:
      - condition: template
        value_template: "{{ not was_on }}"
      sequence:
      - action: light.turn_off
        target:
          entity_id: light.color_temperature_light_1_3
  mode: single

Long-term alternative: Move the GU10 to Zigbee2MQTT temporarily to get a firmware update (Z2M supports IKEA OTA, Hue bridge doesn't). Updated firmware may fix the sleep bug permanently. You could then move it back to the Hue bridge.

3B. Motion Sensor for Closet Timeout (bd-q7j)

Status: Motion sensor shipping, not yet installed.

What you need to do: Install the motion sensor, pair it to Z2M, note the entity_id.

Then I deploy this automation:

- id: 'bedroom_closet_motion_timeout'
  alias: Bedroom Closet - Auto Off After 20 Minutes No Motion
  description: >-
    Turn off closet lights if no motion for 20 minutes while door is open.
  triggers:
  - trigger: state
    entity_id:
    - binary_sensor.bedroom_closet_motion_occupancy  # UPDATE with actual entity
    to: 'off'
    for:
      minutes: 20
  conditions:
  - condition: state
    entity_id: light.bedroom_closet_strip
    state: 'on'
  actions:
  - action: light.turn_off
    target:
      entity_id: light.bedroom_closet_strip
  mode: single

Works alongside the existing door-close automation: door closed = instant off, door open + no motion for 20 min = auto off.


Phase 4: Exploratory / Low Priority

4A. Weather-Responsive Lighting (bd-3cx)

What you need to do:

  1. Install ha-illuminance via HACS (HACS > Integrations > search "illuminance" > install)
  2. Add the illuminance sensor (Settings > Devices > Add Integration > Illuminance, point at your weather entity)

Then I deploy two automations that:

  • Every 15 min during daytime: check outdoor illuminance, boost indoor min_brightness on cloudy days (up to +20%)
  • At sunset: reset brightness to defaults

This is low priority — nice-to-have, not a fix for a broken thing. Full YAML below.

ha-illuminance sensor config (add to configuration.yaml or via UI):

sensor:
  - platform: illuminance
    entity_id: weather.home
    name: "Outdoor Illuminance"
    mode: normal
    scan_interval:
      minutes: 5

Daytime brightness boost automation:

- id: 'weather_responsive_al'
  alias: Weather-Responsive Adaptive Lighting Brightness
  description: >-
    Every 15 min during daytime, check outdoor illuminance and boost indoor
    min_brightness on cloudy days (up to +20%). Resets at sunset.
  triggers:
  - trigger: time_pattern
    minutes: "/15"
  conditions:
  - condition: sun
    after: sunrise
    before: sunset
  actions:
  - variables:
      outdoor_lux: >-
        {{ states('sensor.outdoor_illuminance') | float(80000) }}
      brightness_boost: >-
        {% set lux = outdoor_lux %}
        {% if lux >= 50000 %}
          0
        {% elif lux >= 20000 %}
          {{ ((50000 - lux) / 30000 * 10) | round(0) }}
        {% elif lux >= 5000 %}
          {{ (10 + ((20000 - lux) / 15000 * 10)) | round(0) }}
        {% else %}
          20
        {% endif %}
      new_min_brightness: >-
        {{ [55 + (brightness_boost | int), 95] | min }}
  - action: adaptive_lighting.change_switch_settings
    data:
      entity_id: switch.adaptive_lighting_kitchen_dining
      min_brightness: "{{ new_min_brightness }}"
      use_defaults: current
  - action: adaptive_lighting.change_switch_settings
    data:
      entity_id: switch.adaptive_lighting_hallway
      min_brightness: "{{ new_min_brightness }}"
      use_defaults: current
  - action: adaptive_lighting.change_switch_settings
    data:
      entity_id: switch.adaptive_lighting_living_room
      min_brightness: "{{ new_min_brightness }}"
      use_defaults: current
  mode: single

Sunset reset automation:

- id: 'weather_responsive_al_reset'
  alias: Weather-Responsive AL - Reset at Night
  description: Reset AL min_brightness to default at sunset.
  triggers:
  - trigger: sun
    event: sunset
  conditions: []
  actions:
  - action: adaptive_lighting.change_switch_settings
    data:
      entity_id: switch.adaptive_lighting_kitchen_dining
      min_brightness: 55
      use_defaults: current
  - action: adaptive_lighting.change_switch_settings
    data:
      entity_id: switch.adaptive_lighting_hallway
      min_brightness: 55
      use_defaults: current
  - action: adaptive_lighting.change_switch_settings
    data:
      entity_id: switch.adaptive_lighting_living_room
      min_brightness: 55
      use_defaults: current
  mode: single

How the brightness scale works:

  • 50,000+ lux (bright sun): no boost, min_brightness stays at 55
  • 20,000-50,000 lux (light clouds): 0-10% boost (min_brightness 55-65)
  • 5,000-20,000 lux (heavy overcast): 10-20% boost (min_brightness 65-75)
  • Below 5,000 lux (very dark): max 20% boost (min_brightness 75)

change_switch_settings is non-persistent — resets on HA restart. That's fine since the automation re-evaluates every 15 minutes anyway.

4B. Optional AL Enhancement — Auto-Resume Timer

For the living room, you could add autoreset_control_seconds: 7200 (2 hours). This means after you manually set a scene (blossom, movie, etc.), AL stays paused for 2 hours then gradually resumes. Good for "set a dinner scene but want normal lighting later without touching anything."

This is a preference choice — set to 0 (current default) if you always want to manually re-enable AL via the tap dial.


Summary: What Happens When

Phase Who Does What Effort Impact
1A I push automations, you reload 1 click Tap dial instant, laundry bright, closet syncs with bedroom
1B I push config, you restart 1 click Everything 15x faster (45s→3s), closet visible, garage stays put, living room respects scenes
2 You click through AL settings in UI 5-10 min Bedside lamps at 25%, bedroom AL on individual lights
3A You buy/plug in outlet, I deploy $10-15 + 5 min GU10 stops going offline
3B You install motion sensor, I deploy waiting on shipping Closet auto-off after 20 min
4 You install HACS integration, I deploy 10 min Brighter lights on cloudy days

Risk & Rollback

Every change I make goes through file edits on the HA device. If anything breaks:

  1. Automations broken? I restore the backed-up automations.yaml via SSH, you reload
  2. AL settings broken (HA won't start)? I restore the backed-up config_entries JSON via SSH, you restart
  3. Nuclear option: Restore the full Feb 21 automatic backup from Settings > System > Backups

I'll also take a fresh backup of both files immediately before making any changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment