WebThingsIO / zigbee-adapter

Zigbee adapter add-on for WebThings Gateway
Mozilla Public License 2.0
46 stars 29 forks source link

Light state not updated in the UI when changed via rule. #212

Open rkjnsn opened 4 years ago

rkjnsn commented 4 years ago

I have six Philips EasySmart T8 bulbs that I control via a Conbee II. When I start my gateway, the zigbee adapter fetches the states of the bulbs and the initial state is properly reflected in the UI, but the UI state is not updated when executing a rule.

Example steps:

  1. Initial state: three lights on dimly and three lights off.

  2. Start the webthings gateway.

  3. Zigbee adapter fetches initial light state. I see the following in my logs:

    2020-05-07 12:36:20.967 INFO   : getValue for property level for: zb-0017880101921107-button returning 0
    2020-05-07 12:36:20.967 INFO   : getValue for property on for: zb-0017880101921107-button returning false
    2020-05-07 12:36:20.967 INFO   : getValue for property level for: zb-00178801019009b1-button returning 0.7874015748031497
    2020-05-07 12:36:20.967 INFO   : getValue for property on for: zb-00178801019009b1-button returning true
    2020-05-07 12:36:20.968 INFO   : getValue for property level for: zb-0017880101902855-button returning 0.7874015748031497
    2020-05-07 12:36:20.968 INFO   : getValue for property on for: zb-0017880101902855-button returning true
    2020-05-07 12:36:20.968 INFO   : getValue for property level for: zb-001788010190f14a-button returning 0
    2020-05-07 12:36:20.969 INFO   : getValue for property on for: zb-001788010190f14a-button returning false
    2020-05-07 12:36:20.969 INFO   : getValue for property level for: zb-0017880101900876-button returning 0.3937007874015748
    2020-05-07 12:36:20.969 INFO   : getValue for property on for: zb-0017880101900876-button returning true
    2020-05-07 12:36:20.969 INFO   : getValue for property level for: zb-00178801019212ae-button returning 0
    2020-05-07 12:36:20.970 INFO   : getValue for property on for: zb-00178801019212ae-button returning false
  4. Observe that the web UI correctly reflects the initial state.

  5. Activate a rule to turn all of the lights off. Log output:

    2020-05-07 12:49:02.747 INFO   : DeviceProxy: requestAction: All Off for: scene-controller
    2020-05-07 12:49:02.766 INFO   : zigbee-adapter: setProperty property: on for: zb-0017880101921107-button profileId: 0104 endpoint: 64 clusterId: 0006 zcl: off value: false
    2020-05-07 12:49:02.766 INFO   : zigbee-adapter: setProperty property: on for: zb-00178801019212ae-button profileId: 0104 endpoint: 64 clusterId: 0006 zcl: off value: false
    2020-05-07 12:49:02.766 INFO   : zigbee-adapter: setProperty property: on for: zb-001788010190f14a-button profileId: 0104 endpoint: 64 clusterId: 0006 zcl: off value: false
    2020-05-07 12:49:02.767 INFO   : zigbee-adapter: setProperty property: on for: zb-00178801019009b1-button profileId: 0104 endpoint: 64 clusterId: 0006 zcl: off value: false
    2020-05-07 12:49:02.767 INFO   : zigbee-adapter: setProperty property: on for: zb-0017880101900876-button profileId: 0104 endpoint: 64 clusterId: 0006 zcl: off value: false
    2020-05-07 12:49:02.767 INFO   : zigbee-adapter: setProperty property: on for: zb-0017880101902855-button profileId: 0104 endpoint: 64 clusterId: 0006 zcl: off value: false

Expected result: All of the lights turn off and are shown as off in the UI.

Actual result: The lights do all turn off, but the UI still shows them in their initial state with three lights turned on dimly.

Additionally, these lights can be controlled via an infrared remote control, and it would be nice if changes with the remote also made their way to the UI.

I don't know enough about ZigBee to say if the bulbs themselves are partially at fault (e.g., perhaps they are supposed to send a notification when their state changes and aren't doing so), but even if so, it seems like it would make sense to automatically poll the light state on a regular interval to ensure that changes are detected even if such a message goes missing.

Additional Information I tested controlling the lights using the Phoscon web app bundled with deCONZ. Using that software, if I activate a scene, some of the lights will immediately show the new state, and the rest will update within 10 seconds. (Wild speculation not backed up by any log analysis: perhaps Phoscon/deCONZ tries to fetch the state immediately after setting it, and there's a race where sometimes the bulbs haven't fully applied the new state and report their former state, but the state then gets properly updated the next time it does a poll.)

In any event, I'm happy to do any testing and log gathering that might be helpful to track down the issue.

LionMike commented 4 years ago

I have a similar issue with Zigbee lights status not updating in the UI. They are Osram Lightify and Sengled Element bulbs. Status shows on after turning off. The rules work as they should, albeit sometimes there is a lag in activation. This is especially prevalent after restarting the gateway or adding a new Zigbee device.