hass-emulated-hue / core

Hue Emulation for Home Assistant
Apache License 2.0
322 stars 53 forks source link

Hue Entertainment - Lights not responding #69

Closed Kh3nsu closed 3 years ago

Kh3nsu commented 3 years ago

Describe the bug

Hello, I just tried to set up the Hue entertainment areas. It works fine so far, you can set it up and save it. While arranging the lights, they react, but as soon as you get to the part about testing the synchronisation, the lights stay exactly as they were before. No change whatsoever. The lights can be controlled otherwise. (I have tried it with different lights, but the same thing happened with all of them).

Steps to Reproduce

  1. Go To Settings
  2. Click on Entertainment-Areas
  3. Create Area
  4. Select a Light
  5. Arrange the light
  6. Click on Next 2x

Expected behavior

The light symbols should light up in different colours in the app, but the lights remain the same as when they were arranged.

Logs

Hardware Info:

Additional context

I'm trying to connect it to Razer Synapse, the lights are also recognised perfectly there, but none of the lights change no matter what I set.

marcelveldt commented 3 years ago

This issue has been fixed very recently. @alexyao2015 can you release a new version to the repo with all recent fixes ? Perhaps also include the throttling fix PR...

Kh3nsu commented 3 years ago

Hello, I installed version 0.1.1 now and tried it again. Unfortunately, the same behaviour as before.

alexyao2015 commented 3 years ago

Please refer to #42. It doesn't work with the latest version of hue sync.

Kh3nsu commented 3 years ago

But its still not responding inside the Hue App ? And im using Razer Synapse not HueSync ??

alexyao2015 commented 3 years ago

I'm unsure of what the issue here is. Does entertainment work in the hue app? Is this a razer synapse only issue?

Kh3nsu commented 3 years ago

Thanks for opening again :) So I'll explain from the beginning. The lights all work perfectly when you control them individually. Creating an entertainment area also basically works. But now comes the catch. When creating the entertainment area, the lights only work as far as you arrange them, they change colour there but as soon as you get to the step Test synchronisation, the lights remain in the colour they were when you arranged them. Normally they should start to glow in colour, just synchronously as displayed in the app. This is completely independent of Razer Synape or Hue Sync. It's just the original Hue app where Hue Entertainment can't control the lights when tested in the area. I have even tried it with original Philips Hue lights, with every light in Home Assistant the same result.

Extra: Razer Synapse connects perfectly with the virtual Hue Bridge and also recognises the areas and the lights in them. According to the logs, an entertainment stream also starts, but the lights do not react. However, this is a fundamental error rather than a fault of Razer Synapse.

Kh3nsu commented 3 years ago

I also looked into the Home Assistant events during the entertainment stream. Home Assistant does not receive any commands from Emulated Hue to change any lights. So I don't think it's the Home Assistant installation or the hardware. (LED Strip with WLED or another lamp). If I control the light individually in the Hue app, Home Assistant also receives the commands and is visible in events. The stream does start but nothing happens. image

marcelveldt commented 3 years ago

I believe this is fixed in all recent PR's, that's why I requested a new addon version so @WolfsWelpe and others can give it a spin.,

alexyao2015 commented 3 years ago

We did release a new version yesterday and it seems like it still has a problem since 0.1.1 still had the issue. Can you turn on verbose logging and post the logs?

Kh3nsu commented 3 years ago

Here you go. https://pastebin.com/7aygXBtm I created an Entertainment Area and added 1 Light. Behaviour as explained earlier

alexyao2015 commented 3 years ago

I see that you mentioned that this also doesn't work with the official hue setup. What lights are you using? I am unable to reproduce this issue as it's working perfectly fine on my end. Did you try the latest version 0.1.2?

Kh3nsu commented 3 years ago

Yes I installed 0.1.2. I have selected a ceiling light that is connected to the original Hue Bridge and set up in Home Assistant. This only reacts when arranging and then no longer reacts when testing the area. Home Assistant also does not receive any commands from the addon to change any lights. So it can't be the hardware. Does a certain port have to be released or something else? But since Home Assistant receives the commands when arranging the lights in Hue Entertainment, I wonder why it doesn't work in area testing.

Kh3nsu commented 3 years ago

These Addons are currently installed: image

alexyao2015 commented 3 years ago

Does the light function when you could it from Home Assistant? Does the light function when you control it through the Hue app?

Kh3nsu commented 3 years ago

Yes and yes

Kh3nsu commented 3 years ago

Here I controlled the same light as assigned in the Entertainment Area: https://pastebin.com/6pRkChQc

Kh3nsu commented 3 years ago

Excuse me, but am I doing something fundamentally wrong? Because then I don't see what at all.

alexyao2015 commented 3 years ago

I don't see what the issue is here either... It all works fine for me. Try pasting these fake lights into your configuration and see if they work in entertainment mode. https://github.com/hass-emulated-hue/dev-kit/blob/1e8d34b1cac70250b468faed1d231ec0b2544ad2/lights.yaml#L1

Kh3nsu commented 3 years ago

Ok I tried it. Same behaviour as for my lamps. Home Assistant not receiving any Events or commands from the Addon :/

Kh3nsu commented 3 years ago

https://photos.app.goo.gl/UaiaBMESNZHrTCHP9 Ok I have recorded a small video of how I create the area with the two lamps. Both lamps react and I can also see it in Home Assistant. As soon as I press to arrange them, I see events in the Home Assistant console. As soon as I test the area at the end, nothing happens. Normally, the lamps and Home Assistant should receive many commands to change the fake lights. Unfortunately, nothing comes through.

alexyao2015 commented 3 years ago

I just wanted to mention, you won't see the lights turning on or changing color during entertainment mode with those fake lights. During entertainment mode, you should see the brightness input number sliding back and forth. You should also be able to manually control the fake lights as well in HA and the Hue app.

Kh3nsu commented 3 years ago

Correct. Im able to control the lights in the hue app and in Home Assistant. (THe Fake lights). Yeah and I watched the event stream of Home Assistant there is no event reducing the brightness of the fake lamps during the entertainment mode. (Just a question do you know what I mean with the event stream?)

Kh3nsu commented 3 years ago

It would be so much easier If I can just show you these things D: Sadly the language is a little barrier ^^ You don't speak German, do you?

alexyao2015 commented 3 years ago

Occasionally I have seen that behavior at the beginning of the video but at the end when the lights are changing color, it should also be changing in HASS. Not sure what event stream you are referring to. Try manually using a service to set the brightness of the fake RGBWW light. Thats all we do internally.

You don't speak German, do you?

Unfortunately, not.

Kvanr23 commented 3 years ago

I believe I have the same problem with Razer Synapse, when setting up the Entertainment Area in the Hue app, everything goes well. Until the 'Test synchronization' page, here the lights cycle through the rgb colors in the app. The physical lights (or the fake lights) are supposed to change with these, but they don't.

->Hass lights are not responding to, and updating with the entertainment mode.

Kh3nsu commented 3 years ago

Ok I don't know how else to explain it D: If the lamps at the end of the video change colours, they should also do so correctly in HASS, but they do not. This is because no commands are sent from the addon when the entertainment module in the addon does it. If I manually change something in HASS itself or in the Hue app, it works fine and I get an event report. Example: image But when the entertainment module tries to change the lamps, they do not synchronise and HASS does not receive a request to change a lamp and therefore no event report.

alexyao2015 commented 3 years ago

Lets take Razer Synapse out of the mix. So to be clear, you: 1) Have no issues controlling the fake and real light in HASS and the Hue app through the emulator 2) Have issues with lights changing color through the test entertainment functionality in the Hue app

Try using developer tools with the service light.turn_on

entity_id: light.actual_entity_id
brightness: 200
xy_color: [.12,.9]

If nothing happens, remove xy_color. If still nothing happens, remove both brightness and xy_color to see if the light just turns on.

Kh3nsu commented 3 years ago
  1. Correct
  2. Correct

Tried your command it is working perfectly fine. It turned green and got bright

Kh3nsu commented 3 years ago

But as I said earlier. It is not a problem with Hass or the Hardware. The Entertainment Module is just not sending any PUT command or with whatever you tell HASS to change the light.

marcelveldt commented 3 years ago

This might be a race condition. I've just put up a small patch in a PR

Kh3nsu commented 3 years ago

Ok just a question how is the entertainment module telling hass to change a light? Is it a simple PUT Request and is it logged in the normal Addon Log Window? I just installed your PR marcel sadly no success. Just recreated the entertainment Area and I found out that there is not a single put request going out when test the area. image

marcelveldt commented 3 years ago

There's a websocket connection to HA as it is low latency. So you will not see these requests over the line and especially not PUT requests as that will have A LOT of overhead.

I will test this tonight when I get home from work on my own Philips TV with Ambilight+HUE so I can fix whatever I see.

BTW: If you want to know if the emulated hue is sending/controlling the light you can watch the "call_service" event from dev tools in HA.

Kh3nsu commented 3 years ago

Yes I honestly tried that already with the event stream listening. Sadly not a single request is coming through when testing the area. So maybe that is the problem. I can see the service calls when manually changing the lights in the Hue App but not a single serivce call when the entertainment module wants to change a light.

marcelveldt commented 3 years ago

Ah thanks for that confirmation. I'll do some investigating on my own setup

lagmoellertim commented 3 years ago

Just wanted to mention that I seem to have the same problem, I already mentioned it in #61 (there is also my setup listed if you need that). For me Control over Hue is working great as long as I don't use entertainment mode. When I activate it, nothing happens (lights stay the same) and after it is ended all lights can be controlled again via non-entertainment actions. For me, call_service also doesn't log any calls while entertainment mode is running. If needed, I can contribute further logs or other things to help debugging.

I'm using YeeLights, WLEDs and virtual light groups if that helps.

alexyao2015 commented 3 years ago

Good news, I've managed to reproduce the issue. Bad news, it seems that the issue is only reproducible within the addon itself and does not occur in a development environment.

It appears that entertainment packets are not being received even though the openssl binary is starting without issues. I would think that this would be a docker networking issue, but we are running host networking, so that shouldn't be an issue. Will definitely need to do more investigation.

alexyao2015 commented 3 years ago

I see UDP packets definitely hitting HA, but for some reason we are unable to receive any packets. Further testing with nmap showed that port 2100 indeed does become open when entertainment is started and closes when entertainment ends. Likely does not appear to be an issue attaching to the port, but rather an issue obtaining the data from the openssl binary.

@marcelveldt Any thoughts on this?

marcelveldt commented 3 years ago

It's exactly what I was seeing on my own setup. If I still had hair, I was pulling it out now. It runs perfectly fine when I run it on my development Macbook but as soon as I run it from the HA addon (docker) it breaks.

There is one thing that just pops up in my head. Previously we had a fixed mac address for docker images, now it uses the host mac address, maybe that is the issue ?

alexyao2015 commented 3 years ago

For those of you facing this issue, what was the last version where this worked or was this always an issue?

Kh3nsu commented 3 years ago

It never worked for me sadly ^^ The last time I was not even able to create the Hue Entertainment Area and as soon as I was able to create one I had this Issue.

Kvanr23 commented 3 years ago

Never worked for me either.

lagmoellertim commented 3 years ago

Same for me, Entertainment mode is not working in any version for me

Kh3nsu commented 3 years ago

Heyy, so something new?

marcelveldt commented 3 years ago

No yet, a bit busy with work atm. I"ll take a look at it this evening. It did work once so I'm pretty sure we can fix this.

Sapd commented 3 years ago

I believe I have the same problem with Razer Synapse, when setting up the Entertainment Area in the Hue app, everything goes well. Until the 'Test synchronization' page, here the lights cycle through the rgb colors in the app. The physical lights (or the fake lights) are supposed to change with these, but they don't.

->Hass lights are not responding to, and updating with the entertainment mode.

I did a complete fresh install of everything, I use Hue bulbs, the Hue app and I experience 1:1 the same behaviour.

marcelveldt commented 3 years ago

Yeah, if you look one message above yours you could see that we're still have to look into the issue ;-)

marcelveldt commented 3 years ago

After a lot of trial and error we've narrowed the issue down to an issue specific in the docker image. It works okay on our dev machines but not in the docker image. We'll provide a new docker image (and HA addon) asap to fix the issue.

Kh3nsu commented 3 years ago

After a lot of trial and error we've narrowed the issue down to an issue specific in the docker image. It works okay on our dev machines but not in the docker image. We'll provide a new docker image (and HA addon) asap to fix the issue.

Very nice :D Looking forward to pairing it with Razer Synapse :D

alexyao2015 commented 3 years ago

If its not pairing, it might be another issue, potentially related to #42. The issue we are specifically targeting here is related to entertainment pairing and activating, but no lights responding. Hope to have a resolution for this soon!

Kh3nsu commented 3 years ago

If its not pairing, it might be another issue, potentially related to #42. The issue we are specifically targeting here is related to entertainment pairing and activating, but no lights responding. Hope to have a resolution for this soon!

Sorry my bad ^^ I have expressed myself incorrectly Of course I meant that the lights on Razer Synapse then react :) It already connects perfectly and the entertainment areas are also recognised perfectly :)