diyhue / diyHue

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

Feature: Add ESPHome RGB Strips #410

Open jannislehmann opened 4 years ago

jannislehmann commented 4 years ago

Describe the bug I cannot add the ESPHome RGB light strip to a Hue Entertainment zone due to it being a outdated swversion.

To Reproduce

  1. Create a ESPHome config (without white_led)
  2. Modify the diyhueasyncudp.h file to check whether a white_led is set. Otherwise you cannot compile the ESPHome yaml.
  3. Flash ESP8266 with the ESPHome file.
  4. Pair the ESP8266 with the diyHue bridge.

Expected behavior I should be able to add the ESP826 ESPHome bulb to a Hue Entertainment zone the same as with a generic one.

Logs

Additional context The swversion is set here. https://github.com/diyhue/diyHue/blob/master/BridgeEmulator/functions/__init__.py#L15 I set mine manully to 5.127.1.26581 as this is what the generic ESP8266 script uses. However, this still not works. I wonder whether this has to be with the model or manufacturer string?


I did a few tweaks to get this to work in general. As soon as things are stable, I will try to create the pull request as I fixed a few things on my end. I also created a Home Assistant diyHue addon! But everything still features quite some hardcoded lines etc.

jannislehmann commented 4 years ago

My fix was to change the modelid and the manufacturer at the following locations:

https://github.com/diyhue/diyHue/blob/master/BridgeEmulator/functions/__init__.py#L15 append the json by "manufacturername": "Philips", "modelid": "LST002" https://github.com/diyhue/diyHue/blob/master/BridgeEmulator/protocols/esphome.py#L102 to get the modelid from the light_types array or change this line https://github.com/diyhue/diyHue/blob/master/BridgeEmulator/protocols/esphome.py#L133

GitHub
diyhue/diyHue
Main diyHue software repo. Contribute to diyhue/diyHue development by creating an account on GitHub.
GitHub
diyhue/diyHue
Main diyHue software repo. Contribute to diyhue/diyHue development by creating an account on GitHub.
GitHub
diyhue/diyHue
Main diyHue software repo. Contribute to diyhue/diyHue development by creating an account on GitHub.
mariusmotea commented 4 years ago

Hue apps will allow only supported entertainment lights to be added. ESPHome use custom modelid, and firmware version, so these must be replaced.

jannislehmann commented 4 years ago

This is true, but why would you do that? The generic and wled builds emulate a hue bulb as well.

alexyao2015 commented 4 years ago

I remember when I made that I only tested rgbw bulbs for functionality. Curious if those still work with entertainment mode. Hassio add-on should definitely be something that should be added.

jannislehmann commented 4 years ago

RGBW and RGB both work with Hue Entertainment if the model id is changed. I have a working hassio add-on, but it lacks so much and has some hardcoded changes.

alexyao2015 commented 4 years ago

https://github.com/diyhue/diyHue/blob/master/BridgeEmulator/protocols/esphome.py#L102 Well this line could be changed to LST002 but that would cause it to treat any rgb bulb as a light strip. Custom devices for rgb were used because those were simply never available with standard hue lights. Rgbw still should work without any adjustments.

GitHub
diyhue/diyHue
Main diyHue software repo. Contribute to diyhue/diyHue development by creating an account on GitHub.
alexyao2015 commented 4 years ago

What exactly is missing in the hassio add-on and why/what are hardcoded changed needed? IIRC seemed like a simple docker config repository.

jannislehmann commented 4 years ago

I am not that confident with Dockerfiles therefore, I adapted the aarch64 Dockerfile and changed a few things. Another thing I changed is that I cloned it into a local folder for hassio to build it. I also changed the model id for the ESPHome bulbs.

And I tried to add Hass.IO ingress and a script for automatic saving before stopping but both without success. Lastly, I did a change to the network scan because it stopped at my first ip (router) because of an untrusted SSL cert.

Mostly, just moving files into a different location and one small patch.

alexyao2015 commented 4 years ago

Tell me this. If you do not change the model id for rgbw does it work?

jannislehmann commented 4 years ago

If you mean Hue Entertainment, no.

alexyao2015 commented 4 years ago

That doesn't really make sense since rgbw uses the model id of a normal hue bulb. You changing the model id would only change it to a light strip. Something is not adding up...

Likely because you are not correctly adding the rgbw bulb. Finally, lightstrips are not technically supported with the current implementation, though they work.

jannislehmann commented 4 years ago

You might be right and I may be mistaking. It's bin almost three weeks since I tested everything.

I am only using a RGB light strip.

alexyao2015 commented 4 years ago

In that case, this is more of a feature request rather than a bug. Potentially we may be able to change the model id of an rgb bulb to an oem hue bulb, but it may not function properly.

jannislehmann commented 4 years ago

It worked properly on my end.

alexyao2015 commented 4 years ago

I'll consider this as a feature request to support rgb strips...

juanesf commented 4 years ago

any news here? I am also trying to get esphome with rgb (ws2812).

alexyao2015 commented 4 years ago

Most of the focus is towards the refactor, and progress has been slow on that. After that is complete, I will look into new features.