diyHue Add-on

Hey - no not to the internet but exposed on your local network. I’m assuming the Hue App is on your phone also on your local network?

(not sure about the ssdp one didn’t realise that was different - put them to the same if you can)

image

Like this and ensure no_serve_https isn’t ticked:

image

My PR has been rejected so far - so if you are interested in running both the diyHue add on and home assistant on port 443 please pile in and let them know if not i’ll look to create another community add on

Not sure which part it was… but i now finally have it working again with both the original HUE App, the Hue essentials app and the DUCKDNS served through NGINX.

I set the SSDP actually to 1900 and just removed the certificate completely to create a new one.
I assume just recreating the certificate did it.

My goal is to migrate all bulbs and stuff currently connected to native HUE bridge to Deconz, but yet I’m unsure how those integrations/addons have to be connected to each other.

I still want to use Hue or Hue Essential App, but also Alexa integration, so I think, that I would be fine with diyhue.

My setup:

  • hassio supervised: supervisor-2021.03.9
  • marthoc/deconz: latest image with WEB_PORT 8081 and WS_PORT 8443

My guess is, that diyhue needs to conmmunicate with deconz API to fetch registered devices from there. Hue* Apps are communicating with diyhue and accessing those devices.

Based on that assumption, diyhue addon is only used to integrate the configuration and docker container management into home assistant. And finally deconz is presenting devices to home assistant and diyhue?

The default config.json uses port 8080 for communicating with deconz. Is it communication on web or ws port?

I also noticed following error message:

-----------------------------------------------------------
 Add-on: diyHue
 Philips Hue Bridge Emulator
-----------------------------------------------------------
 Add-on version: 1.4.1
 You are running the latest version of this add-on.
 System: Debian GNU/Linux 10 (buster)  (amd64 / qemux86-64)
 Home Assistant Core: 2021.3.4
 Home Assistant Supervisor: 2021.03.9
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
/config/diyhue exists.
Your Architecture is = amd64
Serve HTTPS
Host MAC given as 00012e4da112
Docker Setup Initiated
SSL certificate found
Config file found
Docker Setup Complete
Deconz IP given as 192.168.1.21
Exception in thread Thread-8:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/hue-emulator/HueEmulator3.py", line 1976, in run
    ctx.load_cert_chain(certfile=_certfile)
ssl.SSLError: [SSL] PEM lib (_ssl.c:4023)
{"ok"}

:Edit I was able to fix the above issue by entering docker container (docker exec -it bash) and execute genCert.sh with the configured mac address.

Still my Osram Smart Plug doesn’t show up in diyhue, but in hassio. Actually, I have no idea how to verify, if the diyhue <-> deconz connection is fine or not.

Regards
Oliver

If you tick the Debug Log Box in the configuration you will see all devices that are connected.
Alternatively, you can also see all the discovered devices in the config.json in the diyhue folder.

In this config.json you can also directly change the config for deconz or homeassistant lights.

    "deconz": {
        "enabled": false,
        "lights": {},
        "port": 8080,
        "sensors": {}

As for the rest, your logic is correct. Deconz/ZHA/Zigbee2MQTT wil connect all the Lights to your HomeAssistant. Then depending on how you configure it, you can either expose the lights via HomeAssistant, or directly via DECONZ to DIYHUE. This DIYHUE will then also enable you to expose the lights to Alexa, Harmony, the Hue app etc.

I’ve created a guide here on getting the Hue App working with Home Assistant here: [GUIDE] Using the Hue App with Home Assistant (via DiyHue)

It was an emotional journey!

I’ve uninstalled the addon + removed the config and did a fresh install. It’s now working. I think, that I started the addon before setting up the base config (deconz_ip, mac address) and that broke everything.

Hue App + Hue Essentials App are connected. I’m not using https/nginx proxy, so I’m fine with my current config.

Yet, I’m unsure, if I should expose the lights only to HASS and let HASS announce it to diyHue. In that case, I’ll have to set up groups, like multi bulb roof lamps, only once. At least in my imagination :wink:

It is up to you - I always found getting Hue app to connect with Deconz was hard work. The advantage with using Home Assistant -> diyHue -> Hue App is that you can expose more than just deconz lights to it in my house i’ve got a mix of sonoff/zwave/deconz/official hue hub all in the Hue App. Doing it just using Home Assistant means that I can disable all the other “protocols” in diyHue to avoid getting duplicates.

Yeah i will change the startup-process soon, so that it will abort if there is no mac address set. :slight_smile:

Yeah, that was also my idea. I would like to keep the hue app for convenience, e.g. controlling brightness, coloring. At this point, I don’t have enough time to build floor plans and so on to provide a better GUI for my family.

Thanks for sharing your thoughts.

@MaxBec92 yeaht, that would be great :sweat_smile:

Would it also be possible to add the ‘host_network’ back or add as an optional selection to the configuration? I have noticed that when this is removed it stops diyhue from being able to discover yeelight and my tv isn’t able to find the virtual hub.

1 Like

Will check that!

1 Like

Long time no see!
I’ve been very interested in condensing my zigbee footprint by removing my actual Hue hub.
I gave this all another swing and feel I got much further than my last attempt, I wasn’t really at a spot where I could handle that level of frivolity, but now I want the frivols.

I’ve followed @foxy82 's guide, I have my MAC address set for my HA VM, I was able to detect and activate the bridge in the official Hue app, now looking where you configure HA lights in the config I think I’m throwing some errors somewhere.

I created the token fine, I used my local IP address, not my external URL, not sure that that would make sense… I’ve pointed it at 8123 as that’s what it speaks on internal to my network. I’ve set up the diyhue attribute in the lights I wanted included but there’s a lot of lights to add it to every one I don’t want included, I can’t imagine that’s throwing these errors though.

Thanks for any help.

Logs:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: diyHue
 Philips Hue Bridge Emulator
-----------------------------------------------------------
 Add-on version: 1.4.1
 You are running the latest version of this add-on.
 System: Home Assistant OS 5.13  (amd64 / qemux86-64)
 Home Assistant Core: 2021.5.5
 Home Assistant Supervisor: 2021.05.4
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
/config/diyhue exists.
Your Architecture is = amd64
Serve HTTPS
Host MAC given as 000c298086ce
Docker Setup Initiated
SSL certificate found
Config file found
Docker Setup Complete
WARNING:root:Home Assistant Web Socket Client disconnected trying to (re)connect
ERROR:root:Error connecting to Home Assistant WebSocket
Traceback (most recent call last):
  File "/opt/hue-emulator/protocols/homeassistant_ws.py", line 223, in create_websocket_client
    homeassistant_ws_client.connect()
  File "/usr/local/lib/python3.8/site-packages/ws4py/client/__init__.py", line 217, in connect
    self.sock.connect(self.bind_addr)
ConnectionRefusedError: [Errno 111] Connection refused

Config:

        "homeassistant": {
            "enabled": true,
            "homeAssistantIncludeByDefault": false,
            "homeAssistantIp": "192.168.1.252",
            "homeAssistantPort": 8123,
            "homeAssistantToken": "<REDACTED>"
        },

Hi.

In your main home assistant configuration.xml you either need
default_config or frontend : Home Assistant Frontend - Home Assistant

OR

api : Home Assistant API - Home Assistant

Thanks for the reply.
I think frontend has been default since before I was using HA, so that’s there.
I tried adding api: which seemed to work without issue, but I still got the same errors in the diyHue logs.

Maybe I wasn’t clear, I have a token, I just removed it from the config for security reasons.

The error you posted looks like you don’t have the API running, it is blocked, isn’t on that IP address or the diyhue docker doesn’t have access to it.

Can you try to connect to the API using the instructions on this page: REST API | Home Assistant Developer Docs

ok so I’ve verified I get:

message
-------
API running.

When using my external https URL.
If the system can’t accept insecure connections how would I format my config?

I’ve tried https://URL for the Home Assistant IP and just URL with the external port.
I’ve tried local IPs with and without https:// or http:// with the internal port.

Can you only get it on your external HTTPS URL? Do you run HA itself as https or are you using something like nginx in front of it?

So I can access HA locally via IP address, I just get the security warning in my browser.
eg. https://internalIP:8123
I am using the Duck DNS add-on, which I think just reports external IP address changes to Duck DNS, so that doesn’t really matter.
I port forward to a different port externally so it’s not so obvious how to get to my HA instance.
I do not use nginx.

Ok it is because you are running your Home Assistant instance as HTTPS itself. If you feel confident going into the diyhue Docker container I can tell you what to change to try to fix it?