Zigbee bulb state not updating when turning off via dumb switch

I’ve recently set up Zigbee2MQTT and started off with a Innr bulb for a light I have which works great. I’m using adaptive lighting to automatically adjust and wanted to try this with my ceiling light.

The idea is that if I turn on the ceiling light via my dumb wall switch, adaptive lighting automatically adjusts it so that I don’t blind myself in the evening etc.

So today I switched the bulb for a smart one (IKEA) and it works correctly. What’s not working though is the synchronization of the light’s state in HA. Whenever I turn the light off using the wall switch, it stays on in HA. I’ve enabled the availability feature in Zigbee2MQTT and set it to 1 minute for the tests and that works. After 1 minute the device is set to offline but not in HA.

Any ideas how to fix that?

Okay I think it fixed itself. I turn off my server over night and today it works as expected and HA sets the light to unavailable after a bit.

I think the important thing is to enable the availability check in Zigbee2MQTT. What still doesn’t work as expected is adaptive lighting. It doesn’t apply the adjustment immediately when the light switches from “unavailable” to “on”. Other people seem to have this problem too and did a workaround using automations. This is what I’m using:

---
alias: "Office: Adaptive Lighting"
description: >-
  Applies the adaptive lighting to lights that are unavailable when turned off manually, e.g. by a wall switch. Since
  the integration doesn't automatically apply the settings when those lights turn on again, this automation calls the
  respective service to do that.

id: c049569e-8be0-4012-af79-42d1b283e78b
mode: parallel

trigger:
  - platform: state
    entity_id: light.office_ceiling_light
    from: unavailable
    to: "on"

action:
  - alias: apply adaptive lighting settings
    service: adaptive_lighting.apply
    data:
      entity_id: switch.adaptive_lighting_office
      lights: "{{ trigger.entity_id }}"
      transition: 0

Quick tests show that it works but I’ll test it throughout the day and see if it works as expected. I guess I’ll have to use this workaround until adaptive lighting fixes this behaviour

1 Like