Lidl Zigbee bulb stopped automating

Automation of a light bulb stopped working within Home Assistant. Community helped diagnose the issue. Found a workaround calling the service directly.

So this was a new one, and a fun one. After annoying SWMBO with the hall light being a smart bulb and not working on the switch any more, I did a temporary workaround where I would switch it on as it went dark and then switch it off at bedtime. This was OK but SWMBO didn’t like the fact that the light was needlessly on for a few hours. One of the first automations I tried to do was a night light for the kids so that if they woke up in the night a motion sensor would activate lights at a low level so they could go to the toilet etc. Was OK in theory, except that when trying to put the kids to bed, the room would be a disco as they tossed, turned and fidgeted (thought, a ‘virtual button’ that gets turned on as part of a bedtime routine shutting down the home, anyway, digressing). As a result, I had a motion sensor in the kids room doing nothing.

I decided to re-purpose this motion sensor to the hallway, the idea being when the light is below a level and motion is sensed, turn the light on, start a timer and after two minutes turn it off. This all worked wonderfully. Then, I watched a video by Smart Home Sovler on YouTube, in there he mentioned fading the lights on so that it wasn’t so much of an in your face dark to light transition. Makes sense, I like that. So, I dutifully edited the automation, changed from a basic device on action, to calling the service lights on. Reloaded the automations, walked in to the hall, boom light on fantastic. Wait a couple of mins, the light goes off and motion sensor is clear. Walk back in to the hall and no light. Look on Home Assistant and the light shows as being on via the Lovelace dashboard but when the let there be light command was issued, no light was activated. I opened Home Assistant on my phone and was able to toggle the light off and then back on, sure enough there was now light.

First thing I did was to revert back to the device on command. Again, reloaded the automations, and it seemed to be fixed. Wait a few minutes and try again, no cigar. Strange. I was already on Discord in the Home Assistant server so I first posted in the automation channel. After all, the light works manually, it’s only when doing automation the light doesn’t work. I was redirected to the Zigbee channel where I re-posted. After cranking up the debug logging and a few more tests, the following entries were found:

light.tz3000_dbou1ap4_ts0505a_4488d1fe_level_light_color_on_off: turned on: {'on_off': [1, ]}
light.tz3000_dbou1ap4_ts0505a_4488d1fe_level_light_color_on_off: turned on: {'move_to_level_with_on_off': [4, ]}

The first line happens if you trigger almost instantly after restarting the server, the second line appears on subsequent activations. After posting the logs to the Discord channel, it was quickly identified that some lights do not support the ‘move_to_level_with_on_off’ command, and instead only support the ‘on_off’ command. I am not entirely sure when this change came in, there is a workaround for devices that behave in this manner but this requires a code change. For the particular Lidl bulb I have raised an issue on GitHub which hopefully will get resolved. In the meantime though I had to find a way to automate the light.

With a little bit of experimenting, using the experience gained from automating the smoke detector test, I managed to make use of the service “Issue Zigbee Cluster Command” which directly turns the bulb on:

id: '1619558086627'
alias: Hall Light - Activate
description: Activate Hall Light on Motion
trigger:
  - type: motion
    platform: device
    device_id: fd70cb3e073998f7542c3ea12c65b2cc
    entity_id: binary_sensor.lumi_lumi_sensor_motion_aq2_ias_zone
    domain: binary_sensor
condition:
  - condition: numeric_state
    entity_id: sensor.lumi_lumi_sensor_motion_aq2_illuminance
    below: '40'
action:
  - service: zha.issue_zigbee_cluster_command
    data:
      ieee: 'aa:bb:cc:dd:ee:ff:11:22'
      endpoint_id: 1
      cluster_id: 6
      cluster_type: in
      command_type: server
      command: 1
  - service: timer.start
    data:
      duration: '0'
    target:
      entity_id: timer.hall_light_timer
mode: single

And with that, I now have a working automation again for my hall light.

Leave a Reply

Your email address will not be published. Required fields are marked *