diyHue Add-on

You can use the file editor addon. The config is under /config/diyhue!

I need to edit the file on the host I can’t use a browser. E.g. openzwave config is in /usr/share/hassio/addons/data/core_zwave

Just go to the location of the hassio configuration.yaml. There you find the DiyHue folder

Ah ha - thanks - that is what I needed.

For anyone reading config file on the host machine is found here: /usr/share/hassio/homeassistant/diyhue

Does anybody have problems connecting the diyHue instance with Amazon Echo? I’ve connected it to Hue & Hue Essentials, but the official Hue Skill is not detecting the bridge (“There is no Hue Bridge in your Network”).
diyHue is listening on 1900/udp which should be the correct port for ssdp discovery. Any ideas?

EDIT:
I’ve also tried to add the lights without the official skill, which should also work?
I can see the following log entrys:

192.168.0.22 - - [10/Jan/2021 16:22:37] "GET /description.xml HTTP/1.1" 200 -
192.168.0.22 - - [10/Jan/2021 16:22:37] "GET /api/c958adbc535611eb93cfdca63261de47/lights HTTP/1.1" 200 -
192.168.0.22 - - [10/Jan/2021 16:22:37] "GET /api/c958adbc535611eb93cfdca63261de47/lights/1 HTTP/1.1" 200 -
192.168.0.22 - - [10/Jan/2021 16:22:37] "GET /api/c958adbc535611eb93cfdca63261de47/lights/10 HTTP/1.1" 200 -
192.168.0.22 - - [10/Jan/2021 16:22:37] "GET /api/c958adbc535611eb93cfdca63261de47/lights/11 HTTP/1.1" 200 -
192.168.0.22 - - [10/Jan/2021 16:22:37] "GET /api/c958adbc535611eb93cfdca63261de47/lights/12 HTTP/1.1" 200 -
192.168.0.22 - - [10/Jan/2021 16:22:37] "GET /api/c958adbc535611eb93cfdca63261de47/lights/13 HTTP/1.1" 200 -
192.168.0.22 - - [10/Jan/2021 16:22:37] "GET /api/c958adbc535611eb93cfdca63261de47/lights/2 HTTP/1.1" 200 -
192.168.0.22 - - [10/Jan/2021 16:22:37] "GET /api/c958adbc535611eb93cfdca63261de47/lights/3 HTTP/1.1" 200 -
192.168.0.22 - - [10/Jan/2021 16:22:37] "GET /api/c958adbc535611eb93cfdca63261de47/lights/4 HTTP/1.1" 200 -
192.168.0.22 - - [10/Jan/2021 16:22:37] "GET /api/c958adbc535611eb93cfdca63261de47/lights/5 HTTP/1.1" 200 -
192.168.0.22 - - [10/Jan/2021 16:22:37] "GET /api/c958adbc535611eb93cfdca63261de47/lights/6 HTTP/1.1" 200 -
192.168.0.22 - - [10/Jan/2021 16:22:37] "GET /api/c958adbc535611eb93cfdca63261de47/lights/7 HTTP/1.1" 200 -
192.168.0.22 - - [10/Jan/2021 16:22:37] "GET /api/c958adbc535611eb93cfdca63261de47/lights/8 HTTP/1.1" 200 -
192.168.0.22 - - [10/Jan/2021 16:22:37] "GET /api/c958adbc535611eb93cfdca63261de47/lights/9 HTTP/1.1" 200 -
192.168.0.22 - - [10/Jan/2021 16:22:37] "GET /api/c958adbc535611eb93cfdca63261de47/lights HTTP/1.1" 200 -

The user id refers to a user named “Echo”. Looks like Echo is looking for devices, but not adding them

Hi @foxy82 and @MaxBec92.

By now, I’m able to access my HA through http and https, using Duckdns and Nginx add-ons simultaneously, the first one to obtain certificates, and the second one to access the frontend via https, therefore, I can encrypt HA and enjoy your add-on.

Anyway, if @foxy82 needs to test the add-on access to HA through https using Rest API, I’ll help as much as I can.

I would like suggest to create a “transition” parameter in configuration, in order to improve how smooth the change color or brightness is, as I’m using the add-on as Ambilight+hue extension, and it is not very comfortable when lights change abruptly.

When you say config are you thinking per light or one config for any light?

Also it will depend on the Home Assistant integration for that light supporting transition time which I don’t have control over.

Hi, I think that per light would be better as you can have a higher control over every light, for instance as a parameter in config.json once the light has been discovered.

Don’t worry about to guess if a light support transition or not, if a light doesn’t support transition, it doesn’t make any difference when you turn on, off or toggle the light using transition or not.

Anyway everyone can modify this parameter, for instance, setting a value of 0 when no transition is desired or light doesn’t support this feature.

Hey @Jaime,

i guess you can set the transition time for each light in the diyhue config.json.
Under lights -> [Light-Number]-> State -> Transitiontime.

Would be nice if you could try that! :slight_smile:

Hey @larsf96,

are you able to connect the bridge manually? With entering the IP and the port? Or is there no such function in alexa?

Hi @MaxBec92, the default value for Transitiontime is 5, I’ve tried with 0,1,5,10,100 and 10000, but it doesn’t make any difference. It seems to me that this transitiontime it’s applied only when control from ambilight tv or mobile app ends to left the light as it was just before to take control of the light.

Only one time, and I don’t know how, I get a smooth transition using ambilight+hue form smart TV, just in the same exact way that the genuine ambilight does.

As a clue, the smart TV has an option named “Immersion” to set how precise lights will follow the ambilight effects, but it only works when the hue bridge has no entertainment function.

The only time that lights worked perfectly, as I said before, was when this immersion parameter makes differences over the lights behaviour, thus, my conclusion is that, when no entertainment function is available in the bridge, the add-on simulates perfectly the ambilight effects with perfect transitions on colors and brightness with no other modification on the add-on.

There is some way to disable the entertainment function in the emulated hue bridge, in order to test my theory?

Thank’s in advance.

Note:

I just get now a smooth behaviour again, and this is what I get in the log:

2021-01-12 01:50:30,477 - root - INFO - start hue entertainment
2021-01-12 01:50:30,603 - root - DEBUG - Sending M-Search response to "HA IP"
----------------------------------------
Exception happened during processing of request from ('Smart TV IP', 33816)
----------------------------------------
Exception happened during processing of request from ('Smart TV IP', 33818)
  . Seeding the random number generator... ok
  . Loading the CA root certificate ... ok (0 skipped)
  . Loading the server cert. and key... ok
  . Bind on udp://*:2100/ ... ok
  . Setting up the SSL/TLS structure... ok
 interrupted by SIGTERM (not in net_accept())
  . Cleaning up... done.
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/socketserver.py", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/local/lib/python3.8/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/local/lib/python3.8/socketserver.py", line 720, in __init__
    self.handle()
  File "/usr/local/lib/python3.8/http/server.py", line 427, in handle
    self.handle_one_request()
  File "/usr/local/lib/python3.8/http/server.py", line 415, in handle_one_request
    method()
  File "/opt/hue-emulator/HueEmulator3.py", line 1800, in do_PUT
    bridge_config["groups"][url_pices[4]]["stream"].update({"active": True, "owner": url_pices[2], "proxymode": "auto", "proxynode": "/bridge"})
KeyError: 'stream'
----------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/socketserver.py", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/local/lib/python3.8/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/local/lib/python3.8/socketserver.py", line 720, in __init__
    self.handle()
  File "/usr/local/lib/python3.8/http/server.py", line 429, in handle
    self.handle_one_request()
  File "/usr/local/lib/python3.8/http/server.py", line 415, in handle_one_request
    method()
  File "/opt/hue-emulator/HueEmulator3.py", line 1806, in do_PUT
    bridge_config["groups"][url_pices[4]]["stream"].update({"active": False, "owner": None})
KeyError: 'stream'
----------------------------------------

I think that this error makes unavailable hue entertainment function, and then the light works very nice.

Hello @foxy82,
I am really happy that you are doing this addon!
Before I came to Home Assistant I was using a DiyHue and was pretty happy with their Entertainment functions etc.
I always wanted to try to implement DiyHue with Portainer in docker to work and being able to use these features again.

And now I found your addon! Thanks a lot for your work!

I just have the problem, that if my addon Nginx proxy manager (due to external access with my domain) is started, the diyhue add-on seems not to work and I can’t access the diyhue website because Nginx is using port 80 and 443 as entrance port.

Am I missing something? I can’t get it to work simultaneously.
I would be really happy if you could give me a quick help to solve this problem.
Thanks in advance,
Greetings Breb,
and stay healthy!

Hey @Br3b,

thank you for the feedback. I wrote the hassio add-on. Foxy did the implementation for shwoing hassio lights in hue apps.

I will reelase a new version where you can disable the https server of diyhue. This is not working at the moment. Hue Apps expect the bridge to be on 80. That’s why we need the port to be there. :confused:

@Br3b to add to @MaxBec92 comment I am using NGINX for external access as well - I do this on port 443 only - accessing your system externally over http is a security risk.

So set NGINX addon to use 443, and let @MaxBec92 add on work on port 80 which the Hue App and/or Hue Essentials is happy with as well.

To stop port 80 on the nginx addon you just delete the port 80 config (or you could move it to another port if you wanted to)

Hey @MaxBec92
there is no such function to add the bridge manually. Regarding the docs of diyHue, I only have to activate the Link mode and search for devices in Alexa then, but this does not work for me.
In the logs I can see that Alexa is searching for lights and also fetches description.xml and light endpoints, but lights are not being added to the App

@MaxBec92 thanks for your clarification!
@foxy82 thanks, I just have port 80 to 443 redirection and yeah I actually don’t need it, so I will try what u said.
Thank you Guys, Great Work!

Hi Guys,

I managed to run Nginx and diyhue webpage at the same time, happy with that. Thank you!

What configuration are you guys using for the conbee stick plugged into the home assistant?
for the mac-address, I am using the home assistant eth0 mac-address and for the deconz IP I am using 127.0.0.1.
But it is not possible to get deconz (open authentication) importer to diyhue :confused:

I also tried it with the docker-IP, both not working…
I would appreciate your help!
Maybe @MaxBec92 can clarify which IP to use for deconz, if deconz is running inside Home Assistant with the Deconz Addon.
Thank you!

Hi there,
maybe you can help me with this problem? @foxy82
I just dump being not able to connect to my conbee deconz addon inside HO :confused:
Greetings

I had to reinstall diyHue to get this working. Now the lights are visible in Alexa, but they are being displayed as “unreachable”.
Everytime I try to switch a light on or off in the Alexa app, I see the following output in diyhue

192.168.0.33 - - [16/Jan/2021 09:41:44] "PUT /api/c0fb6cea535611eb93cfdca63261de47/lights/10/state HTTP/1.1" 200 -
2021-01-16 09:41:44,569 - root - INFO - in PUT method
2021-01-16 09:41:44,570 - root - INFO - /api/c0fb6cea535611eb93cfdca63261de47/lights/10/state
2021-01-16 09:41:44,570 - root - INFO - b'{"on":true}'

This pretty much looks like everything is okay, but the light also doesn’t change it’s state

Hey @Br3b,

can you please show your config from the add-on.
And a log output of the diyhue startup! :slight_smile: