diyhue / diyHue

Main diyHue software repo
https://diyhue.org/
Other
1.58k stars 279 forks source link

Legtimate Hue bulbs missing "Effects" in Hue app when paired with Home Assistant. #891

Open jamieb122 opened 1 year ago

jamieb122 commented 1 year ago

Noticing there are certain options for Legitimate Hue bulbs when paired to real hub vs diyHue. Namely when you click on a bulb to set the color, you don't have the option to set the candle or fireplace effect. I think its because the light's model ID and/or version number are set to something that did not used to be available.

Can the light_types file be updated to have more recent model/software versions? Would that allow the "effects" button to show in the legitimate hue app when the bulb is paired via Zigbee with Home Assistant.

Im happy to add the light types, however I'm not sure where alot of the information like "color gamut" came from for the items that are currently there.

mariusmotea commented 1 year ago

That is the smallest issue. How you make the button to work is more tricky. In the Gradient Strip firmware we added support for such effects, but are build in the firmware, the light receive the request with the effect to play then it is doing the task without any help from the bridge. I need to study zigbee2mqtt if they allow to to trigger this effect using mqtt.

jamieb122 commented 1 year ago

That makes sense. I was able to get the button to appear in the Hue app by adding a new light matching the specs for the legitimate hue bulb. As you said the button had no effect. I'm not sure if it makes a difference but I'm actually using the ZHA integration in Home Assistant to manage the devices.

If I get some spare time I'll look into it some more as well

On Wed, Feb 22, 2023, 1:38 AM Motea Marius @.***> wrote:

That is the smallest issue. How you make the button to work is more tricky. In the Gradient Strip firmware we added support for such effects, but are build in the firmware, the light receive the request with the effect to play then it is doing the task without any help from the bridge. I need to study zigbee2mqtt if they allow to to trigger this effect using mqtt.

— Reply to this email directly, view it on GitHub https://github.com/diyhue/diyHue/issues/891#issuecomment-1439510217, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJH6CRF37HXEOWW2YW62ITWYWX6LANCNFSM6AAAAAAVCPVJCI . You are receiving this because you authored the thread.Message ID: @.***>

jamieb122 commented 1 year ago

Update:

It looks like zigbee2mqtt has implemented it (https://github.com/Koenkk/zigbee2mqtt/issues/15699)

I was looking at ZHA to see if there is the ability to do it, looks like it can be done through a call server (I haven't figured out the right params, but this is getting closer):

image

If you have any idea what the command/args/params should be I can give it a try?

jamieb122 commented 1 year ago

Update:

I had to write a new quirk for ZHA but I am able to trigger the effect direct from Home Assistant with the below params (it would require this quirk, but I will probably submit a PR to get it added too zhaquirks soon enough):

It's a standard call service (which I think you have implemented in the home assistant websocket):

service: zha.issue_zigbee_cluster_command
data:
  cluster_type: in
  ieee: <device_id here>
  endpoint_id: 11
  cluster_id: 64515
  command: 0
  command_type: server
  args:   #32 for pauce scene 16842785 for candle, 50397217 for color loop; 33,620,001 for fireplace

If I can get that quirk added to zhaquirks, I think diyHue just needs a new bulb type and to be able to call the service in HA.

Thoughts?

mariusmotea commented 1 year ago

We have this implemented on gradient strips firmware and i can show you how i did it: Here we enable the effects for Gradient devices that out firmware support: https://github.com/diyhue/diyHue/blob/master/BridgeEmulator/HueObjects/__init__.py#L487-L500

Then because we still use the Hue Api v1 in the lights protocol we get the request from v2 api (not sure if this is possible directly in v1 api) and we convert it in v1 api to go to lights protocol: https://github.com/diyhue/diyHue/blob/master/BridgeEmulator/HueObjects/__init__.py#L415-L417

every protocol light need to convert this v1 effects key in the protocol file (lights/protocols) to correct value expected by the destination service.

GitHub
diyHue/__init__.py at master · diyhue/diyHue
Main diyHue software repo. Contribute to diyhue/diyHue development by creating an account on GitHub.
GitHub
diyHue/__init__.py at master · diyhue/diyHue
Main diyHue software repo. Contribute to diyhue/diyHue development by creating an account on GitHub.
mariusmotea commented 1 year ago

Looking at zigbee2mqtt this may work with no changes, since the api values are the same:

Value will not be published in the state. It's not possible to read (/get) this value. To write (/set) a value publish a message to topic zigbee2mqtt/FRIENDLY_NAME/set with payload {"effect": NEW_VALUE}. The possible values are: blink, breathe, okay, channel_change, candle, fireplace, colorloop, sunrise, finish_effect, stop_effect, stop_hue_effect.

For HomeAssistant integration you can append new lines here: https://github.com/diyhue/diyHue/blob/master/BridgeEmulator/services/homeAssistantWS.py#L126-L144

if key == "effect": if value == "candle": service_data['args'] = 16842785 elif value == "fireplace": service_data['args'] = 33620001

I'm not familiar with HA websocket values, i put 'args' because this is what i saw in your example, but i doubt about it.

GitHub
diyHue/homeAssistantWS.py at master · diyhue/diyHue
Main diyHue software repo. Contribute to diyhue/diyHue development by creating an account on GitHub.
jamieb122 commented 1 year ago

Thanks I'll take a look at it later today. In the meantime I was working a home assistant blueprint to display these as scenes. If I get a chance I'll see if I can try it, and if so I can put up a PR

On Sun, Feb 26, 2023, 5:56 AM Motea Marius @.***> wrote:

Looking at zigbee2mqtt this may work with no changes, since the api values are the same:

Value will not be published in the state. It's not possible to read (/get) this value. To write (/set) a value publish a message to topic zigbee2mqtt/FRIENDLY_NAME/set with payload {"effect": NEW_VALUE}. The possible values are: blink, breathe, okay, channel_change, candle, fireplace, colorloop, sunrise, finish_effect, stop_effect, stop_hue_effect.

For HomeAssistant integration you can append new lines here:

https://github.com/diyhue/diyHue/blob/master/BridgeEmulator/services/homeAssistantWS.py#L126-L144

if key == "effect": if value == "candle": service_data['args'] = 16842785 elif value == "fireplace": service_data['args'] = 33620001

I'm not familiar with HA websocket values, i put 'args' because this is what i saw in your example, but i doubt about it.

https://camo.githubusercontent.com/04e7553cacbb90a685342f74f2f0360f7988ec6a1ebaca01cda3c43372758cdc/68747470733a2f2f6f70656e67726170682e6769746875626173736574732e636f6d2f376237366437623430396138616638393738633763353333343039343830346530613738363531633165303036306536376561306535373533653934303338652f6469796875652f646979487565

https://camo.githubusercontent.com/b6a12909f1e31185a69a73d59208c507a992236d3230f9fc18e85058ae3d19e7/68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f66617669636f6e732f66617669636f6e2e737667 GitHub diyHue/homeAssistantWS.py at master · diyhue/diyHue https://github.com/diyhue/diyHue Main diyHue software repo. Contribute to diyhue/diyHue development by creating an account on GitHub.

— Reply to this email directly, view it on GitHub https://github.com/diyhue/diyHue/issues/891#issuecomment-1445328245, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJH6CRKU4U27CZTEDNM24TWZMZFVANCNFSM6AAAAAAVCPVJCI . You are receiving this because you authored the thread.Message ID: @.***>

digitalentropy commented 1 year ago

Any update on this? I'm having a similar issue. Namely with the new lightguide ellipse bulbs. Would love to get the effects working through ZHA and official Hue app.