Instruction: Hyperion -> HA-Bridge -> Home Assistant

Hi all, i’ve created a manual that describes how to connect an existing Hyperion setup to an existing Home Assistant setup. By doing this, i wanted to create a next level Ambilight experience. My situation:

  • I have a Raspberry Pi 4 connecting to a ledstrip (ws2812b) via the GPIO pin 18. The Raspberry runs Hyperion (in combination with a cheap HDMI USB grabber). The effects of this are very nice.

  • I have another Raspberry Pi 4 running Home Assistant (docker supervised). There are many lights connected to it, some via zigbee, some via wifi.

I wanted my ‘normal’ zigbee/wifi lights to also respond to the tv screen. Therefore, i needed both Raspberries to talk to each other.

  • I tried doing this by installing “Emulated Hue” from the Home Assistant Add-on store. But i got stuck there, since the required port (80) is of course already occupied. I read over the forums that this is the case for many people, and many people got stuck there (me included).

  • Therefore, i looked at an alternative: HA-Bridge. I’ve installed HA-Bridge on the other Raspberry PI (the one that is already running Hyperion).

  • I’ve setup HA-Bridge. You can find below how to do that:

HA-Bridge setup
Generic “Bridge Control” Settings, section "HomeAssistant Names and IP Addresses"

  • Name: Home Assistant (can be any name)
  • IP: 192.168.2.21 (ip address of your Home Assisant device)
  • Port: 8123 (is usually 8123)
  • Token/Password: your_super_secret_token
  • Auth Type: do not select “Legacy password”
  • Use SSL: do not select this option

→ Save > wait for 10 seconds: the Bridge is reinitializing, but this message stays forever > “Bridge Stop” → rerun HA-Bridge (if you installed HA-bridge up correctly, this will happen automatically when rebooting the device running HA-Bridge). After reboot, do the following:

  • Add your devices using the tab “HomeAssistant Devices”: select them and click on Build Item. Save with the green button on top.
  • Under “Bridge Devices”, you can press Edit/Copy. This will bring you to the next screen, at which you should add the settings as explained below:

On Items:

  • Type: HTTP Device
  • Target Item: http://192.168.2.21:8123/api/services/light/turn_on (please replace with the ip-address of your device running Home Assistant)
  • Delay: empty
  • Count: empty
  • Filter IP’s: empty
  • HTTP Verb: POST
  • HTTP Body: {“entity_id”:“light.woonkamer_subwoofer”,“transition”:0.5}
  • HTTP Headers: [{“name”:“Authorization”,“value”:“Bearer your_super_secret_token”}]
  • Content Type: application/json

As you can see, my device is “light.woonkamer_subwoofer”. Please change this to your entity_id of interest (the entity id as it is named in Home Assistant itself). This remark naturally applies also to the rest of the settings below.

Dim Items:

  • Type: HTTP Device
  • Target Item: http://192.168.2.21:8123/api/services/light/turn_on (please replace with the ip-address of your device running Home Assistant)
  • Delay: empty
  • Count: empty
  • Filter IP’s: empty
  • HTTP Verb: POST
  • HTTP Body: {“entity_id”:“light.woonkamer_subwoofer”,“transition”:0.5,“brightness”:${intensity.byte}}
  • HTTP Headers: [{“name”:“Authorization”,“value”:“Bearer your_super_secret_token”}]
  • Content Type: application/json

Off Items:

  • Type: HTTP Device
  • Target Item: http://192.168.2.21:8123/api/services/light/turn_on (please replace with the ip-address of your device running Home Assistant)
  • Delay: empty
  • Count: empty
  • Filter IP’s: empty
  • HTTP Verb: POST
  • HTTP Body: {“entity_id”:“light.woonkamer_subwoofer”,“transition”:0.5}
  • HTTP Headers: [{“name”:“Authorization”,“value”:“Bearer your_super_secret_token”}]
  • Content Type: application/json

Color Items:

  • Type: HTTP Device
  • Target Item: http://192.168.2.21:8123/api/services/light/turn_on (please replace with the ip-address of your device running Home Assistant)
  • Delay: empty
  • Count: empty
  • Filter IP’s: empty
  • HTTP Verb: POST
  • HTTP Body: {“entity_id”:“light.woonkamer_subwoofer”,“transition”:0.5,“rgb_color”:[${color.r},${color.g},${color.b}],“brightness”:${intensity.byte}}`
  • HTTP Headers: [{“name”:“Authorization”,“value”:“Bearer your_super_secret_token”}]
  • Content Type: application/json.

I’m linking here to a topic on this forum: HA Bridge with auth token ,that gave me important clues how to do this. I hope this explanation will help others. See also the same information here: rgb support for HomeAssistant · Issue #1294 · bwssytems/ha-bridge · GitHub , this is also the place were you can find the latest version of HA-Bridge.

Note 1: please be aware that you need to drastically reduce the update frequency in Hyperion for your zigbee and wifi lights (especially the wifi lights). Whereas the ledstrip (ws2812b) is supposed to provide very fast (<20ms ) responses (which it can easily handle via the GPIO-interface), you should not overflood your regular wifi/zigbee lights: i am keeping it to one update per second for these lights. This is actually also nicer to look at: if normal lights are blinking very fast, it breaks the mood. The fast-pacing effects should be handled from the ledstrip projecting to your backwall.

Note 2: there are excellent instructions online that shows you how to setup a ledstrip ws2812b to Hyperion. Thank you Dr Zzs!

Note 3: you can install the Hyperion Home Assistant Integration as well. This provides you with the option to enable/disable the hyperion effects. In my setup, i’ve two “chunks” of led hardware running (the ledstrip ws2812b, and the mood-lighting via wifi/zigbee lights). The “chunks” are called “instances” in Hyperion. The Hyperion integration allows you to enable/disable these individual instances from the front-end of Home Assistant. Very handy.

I’ll try to make a video of the end-result at a later moment. It is very spectacular:

  • the ledstrip (ws2812b) providing fast-paced precise light effects

  • Multiple zigbee and wifi lights providing slower-paced mood effects.

9 Likes

Hereby a demo. It is even more detailed in real-life than displayed here (its recorded with a smart phone, there is only so much that it can capture). For your reference: my tv is a 42 inch Panasonic plasma screen, it gets dwarfed by the wide-spread lighting effect.

I’ve done some more calibration to add more vibrant colors. I think this will give a good impression of what you can expect.

2 Likes

Nice work. I have my ws2812b led strip just controlled by a $2 esp board (running esphome). Hyperion.NG runs directly on my kodi box and uses the “internal” grabber (so no extra hardware needed here) :tada:

In all my ambilight clone had a total cost of around $8 for a 32" screen (used about 2.5m led strip and a d1 mini clone)

Nice! Always interesting to see other solutions and setups :tada:

Hi @pimw great write up, thanks for taking the time. Just had a question as to how to find the Home Assistant auth token to begin with?

You can find it here: Authentication - Home Assistant
It’s the part about “Long-lived access token”.

After you click on your profile within Home Assistant (left bottom), you can scroll all the way down to create a long-lived access token.