doudz / homeassistant-zigate

zigate component for Home Assistant
MIT License
48 stars 15 forks source link

Philips bulb synced but not functional #46

Open gotakk opened 5 years ago

gotakk commented 5 years ago

Hello,

First, thank you for your incredible plugin !! I've already tested it some months ago !

I synced my philips bulb to hass with zigate and it appears on my GUI

Capture

The problem is this light is always set to Off (even the light is shining) When I try to toggle to On, nothing happens. I refresh the page and it return to Off When I click to the entity to have move details, it says it is off from the pairing

Capture

The only positive thing is when I vary the intensity, the bulb reacts and also varies (in white).

I don't really understand what I did badly. All my Raspbian (v9.9) / Docker (v18.09) / Zigate firmware (v30f) / bulb firmware (v146) are the latest update

Could you help me please ? Thank you very much

nerdosity commented 5 years ago

I think it's the same issue:

https://github.com/doudz/homeassistant-zigate/issues/43

It could happen that it looks like always on, or always off. Looks random. I have a tradfri outlet (always off) and I had for a long time a tradfri light (always on)

gotakk commented 5 years ago

It seems to be similar yes, I'll try tonight with a downgraded zigate's firmware

nerdosity commented 5 years ago

Let me know, it happened since upgrading to f firmware version.

biau commented 5 years ago

Can you call light.turn_on and light.turn_off services in hass to see if the bulb react? I have the exact same behavior here with my 3 tradfri bulbs. They react to turn on and turn off command but the state does not update in hass and I can't change their state from lovelace. But I can change the brightness. The problem appears after a general power failure. When the power came back, the bulbs switch online by default and now they look "out of sync". I can restore their states after calling multiple times refresh/discover device but I dit not find the exact pattern to solve the problem.

Adorem commented 5 years ago

Hi,

I have the same issue with 3 differents Philips hue bulb. For me I never success to get the bulbs reporting their states automaically. After some exchanges with Fred he made some tests and give me this conclusion:

J'ai effectué les tests sur les ampoules Hue et en effet, l'ampoule ne communique pas son état automatiquement.

Le seul moyen (utilisé par exemple sur la Deconz conbee) est de demander à l'ampoule quel est son état régulièrement (polling).

Pour rendre ça automatique, il faut envoyer toutes les x secondes :

  • "read attribute" du cluster 0x0006 attribut 0x0000 pour récupérer la valeur on/off

  • "read attribute" du cluster 0x0008 attribut 0x0000 pour récupérer la valeur du level

And yes if in HA I call zigate.read_attribute with this:

{
  "entity_id": "zigate.0017880103590c85",
  "endpoint": 11,
  "attribute_id": 0,
  "cluster": 6
}

Then the status in HA is correctly updated.

Is this helping to find a solution?

biau commented 5 years ago

Ok I don't know if this could solve your issue but I've found how I could restore my bulbs to a working state. I've cut power from my bulb and restore it. Now the bulb is ON and reported OFF in hass. (tradfri bulbs like HUE are on when you restore power on it for safety reason)

I call zigate.discover_device with payload

{
  "entity_id": "zigate.000b57fffec03264"
}

I try to turn it on on ui, the bulb turns on but turn back off in lovelace. I call zigate.refresh_device with same payload

Now lovelace report the bulb as on AND I can switch it on and off with toggle. Bulb is synced with lovelace/hass again.

Don't if this could help you but I'm going to write an automation I can use if I have a power failure again and make a sequence to call these two services for my 3 tradfri bulbs in sequence.

nerdosity commented 5 years ago

Can't we fire a zigate.discover_device followed by a zigate.refresh_device on every error such as:

"RESPONSE 0x8702 - APS Data Confirm Fail : status:240, source_endpoint:1, dst_endpoint:1, dst_address_mode:2, dst_address:344e, sequence:20, lqi:0"

doudz commented 5 years ago

Can't we fire a zigate.discover_device followed by a zigate.refresh_device on every error such as:

"RESPONSE 0x8702 - APS Data Confirm Fail : status:240, source_endpoint:1, dst_endpoint:1, dst_address_mode:2, dst_address:344e, sequence:20, lqi:0"

This response means the device is not responding (because power off or out of range) so calling discover_device or refresh_device won't do anything

doudz commented 5 years ago

Hi,

I have the same issue with 3 differents Philips hue bulb. For me I never success to get the bulbs reporting their states automaically. After some exchanges with Fred he made some tests and give me this conclusion:

J'ai effectué les tests sur les ampoules Hue et en effet, l'ampoule ne communique pas son état automatiquement. Le seul moyen (utilisé par exemple sur la Deconz conbee) est de demander à l'ampoule quel est son état régulièrement (polling). Pour rendre ça automatique, il faut envoyer toutes les x secondes :

  • "read attribute" du cluster 0x0006 attribut 0x0000 pour récupérer la valeur on/off
  • "read attribute" du cluster 0x0008 attribut 0x0000 pour récupérer la valeur du level

And yes if in HA I call zigate.read_attribute with this:

{
  "entity_id": "zigate.0017880103590c85",
  "endpoint": 11,
  "attribute_id": 0,
  "cluster": 6
}

Then the status in HA is correctly updated.

Is this helping to find a solution?

So we have to create a template and set "assumed_state = True" in the template, so HA should poll the state

doudz commented 5 years ago

Or since it looks to be a problem for many bulbs (ikea, etc) I could use polling all the time

doudz commented 5 years ago

You could try to modify light.py at line 113

https://github.com/doudz/homeassistant-zigate/blob/master/zigate/light.py#L113

replace return self._device.assumed_state by return True

biau commented 5 years ago

Can't we fire a zigate.discover_device followed by a zigate.refresh_device on every error such as: "RESPONSE 0x8702 - APS Data Confirm Fail : status:240, source_endpoint:1, dst_endpoint:1, dst_address_mode:2, dst_address:344e, sequence:20, lqi:0"

This response means the device is not responding (because power off or out of range) so calling discover_device or refresh_device won't do anything

That's the strange thing I had this issue a LOT with an osram smart plug. And yes for sure the plug was far from zigate. But every time I just called a refresh and then the state was correct in hass. So it looks like the APS Data Confirm Fail was only for state reporting.

Now I have removed that plug and put a tradfri bulb in the light. Since that day (2 days ago hum ) I have no issue with that light.

doudz commented 5 years ago

So the message probably meanse the "refresh" tries to read an unsupported value But the error code 240 (0xf0) is a timeout MAC_ENUM_TRANSACTION_EXPIRED 0xF0 Pending transaction has expired and data discarded

nerdosity commented 5 years ago

It happened for me on every corded device by IKEA and Osram. Bulbs or power outlets. I second the "use polling all the time" option, since someone could turn off the light or a power outage can disalign home assistant status

Adorem commented 5 years ago

You could try to modify light.py at line 113

https://github.com/doudz/homeassistant-zigate/blob/master/zigate/light.py#L113

replace return self._device.assumed_state by return True

I test this and yes it did the trick. A change in HA is reflected more or less immediately. With this the status is also (after few seconds) updated if I directly change the status of the bulb by using a dimmer switch.

nerdosity commented 5 years ago

image For me it didn't work well. This device is a device capable of turning more cool or more yellowish, but it's just showing as a dimmable device. I can still switch ON an already turned on light, but now even the refresh / discover trick doesn't work anymore.

image

nerdosity commented 5 years ago

I can confirm that downloading the newest package from github (reverting the change in lights.py) fix my lights, now are "fixable" again by calling refresh & discover. The problem (lights that were turned off from the switch and lost the HA state sync) persists with latest master.zip package.