This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to

This forum is now read-only for archive purposes.

[Advanced] Link HA Bridge to Homey

swtttswttt Member
edited April 2017 in Devices
Sometimes 3rd part devices, apps or services don't provide a way to control stuff trough a http request, or just fail to give the ability to add a body and/or headers. If you ever looked at Homey it's API you see you do need the body to turn on lights etc. including the headers to authorize with the bearer token.

HA Bridge is a middle-ware that makes it possible to add Homey devices (or any other HTTP request) and anounce them to the network as Philips Hue bridge that has Lux lights. This way i control the lights directly from my Harmony remote and Alexa as home automation skill. But would work with any other 3rd party service that can connect to Hue.

HA Bridge even has the possibility to group multiple devices as one Hue light, or control a mediaplayer like Kodi. (e.g. "Alexa, turn on RTL 4")

In short a small tutorial on how to get it working:

- Follow the instructions on to install
- After installation and everything is running, go to the ip adress+port of your installation.
- Add a device
- The device name is the one used in Hue but also for the speech in Alexa!
- Near the bottom on the page you see 3 rows. ON, OFF and DIM.
- In the ON row select the device type as HTTP Device
- The target should be http://yourhomeyip/api/manager/devices/device/thedeviceidhere/state
- HTTP type should be set to PUT
- HTTP Body should be set as {"onoff": true} for ON, {"onoff": false} for OFF and {"dim": ${intensity.decimal_percent}} for DIM
- HTTP Header should be set as [{"name":"Authorization","value":"bearer YOURBEARERTOKENHERE"}]
- Set the content type to Aplication/JSON
- Now add the device and test it on the dashboard (there is an on, off and dim button there)
- If it works, you can let Alexa or any other service that connects to Hue scan for devices again and it should pop-up.
- You can copy devices and just change the device id, by adding multiple rows to the ON, OFF and DIM fields you can add more devices to one virtual Hue light.

In the end, i added my Kodi live tv channels as devices to HA bridge. This way i can say "Alexa, turn on RTL 4" so it switches to the right channel using the Kodi JSON api. My logitech harmony remote now has the ability as well to control some homey lights.

There even is a way to filter out what Echo can access what device, so if you would create a device named all lights in HA bridge. And filter each on, off and dim for each Echo Dot. It kind off knows in what room you are and switches the lights there.


To find the right device id you have 2 options:
1. Go to the devices page on homey from a chrome browser, right click the device card and chose inspect, there you should find a parameter called "data-id", this is the device id.
2. Go to http://yourhomeyip/api/manager/devices/device , this outputs all your devices. To make it read-able you can copy and past it in json lint for example.

Replace the device id in the Target Item (within the ON, OFF and DIM part) with this variable ${device.targetDevice}
Then paste the device id in the main target field, this makes copying devices easier since you only need to change the name and the target.



  • hi @swttt, another great forum post, couple of noob questions:
    - where do you find the device id?
    - can you screenshot the settings in HA bridge?
    (of course remove any personal info)

    going to slowely try this ;) 
  • swtttswttt Member
    Updated the first post with how you can find your device id and a nice tip to make device copies easier.
  • hi @swttt
    I still have a hard time getting HAbridge to work with homey via above settings. 
    this is what i now have, but still no reaction when testing from the lamp... i think im doing the HTTP header part wrong

  • with some updates this now works :) 
  • edited June 2017
    he @swttt any chance you know how i can add the FGRM-222 to HAbridge, i did most of above steps. 

    But I get a:
    Error on calling url to change device state:

    I think its the ON/OFF state that is the challenge as the roller shutter 2 (FGRM-222) doesnt have an on/off but an up/down (which i tried instead already)
  • swtttswttt Member
    edited June 2017 above steps work for On/Off devices (and dimm obviously).
    I am not sure yet how the blinds capability/class is working, can look into it tho.. (if i don't forget)
    But something in the body should be changed from onoff to something else :)

    You could PM me on Slack, might be easier tho..
  • After the help from @swttt (honestly, wouldnt even wanna call it help, more like 'try this and it will work') :) 

    this seems to be the solution from having HAbridge to work with Fibaro Roller Shutter 2 FGRM-222:
    update the http body code to -> {"windowcoverings_state": "down"} (and up) 
  • A delightfully late response from my end, but thank you for this guide!
    I recently got an Echo Dot, and I disliked the 'Alexa, ask Homey to...'. Now I can change on/off the lights, set the volume of the receiver (Alexa, set receiver to 20%), and more.

    Tip: You can also combine Alexa's IFTTT integration with Homey for more scene-like things ("Alexa, trigger party mode").

    I assume there is no way for more 'freedom' with trigger words in Alexa? I'm hoping for an "Alexa, play next song", which triggers a flow on Homey to go to the next Spotify song. I'm quite sure it doesn't exist rhough.
  • A delightfully late response from my end, but thank you for this guide!
    I recently got an Echo Dot, and I disliked the 'Alexa, ask Homey to...'. Now I can change on/off the lights, set the volume of the receiver (Alexa, set receiver to 20%), and more.

    Tip: You can also combine Alexa's IFTTT integration with Homey for more scene-like things ("Alexa, trigger party mode").

    I assume there is no way for more 'freedom' with trigger words in Alexa? I'm hoping for an "Alexa, play next song", which triggers a flow on Homey to go to the next Spotify song. I'm quite sure it doesn't exist rhough.

    I'm not sure i would even use IFTTT for this example. 

    I would create a bitflip/virtual trigger in Homey, than via HAbridge connect that to Alexa. That bitflip would trigger whatever flow you'd like :) 

    ps. I would welcome more trigger words (or pre-set phrases/trigger words) for alexa as well. 
    (for example for my window screens i have HAbridge with Homey and Alexa and 'alexa turn screens on' just doesnt feel 100% correct :) should be something  like 'alexa please turn screens up / down')
  • I have tried a couple of times to install HA bridge on my synology NAS (DS214). It seems to be running. I can connect to the webpage, configure a device, but the bridge seems to not be recognised, so I cannot connect with the link button. I tried this on Harmony as well as on my homey. Both seem to not find the bridge.
    Any idea what could be wrong. 
    Happy to share any syslog or screenshots if helpful.
  • @Oskar
    Haven't used it that much to debug tho (it's not that i created HA-Bridge :P )
    you double checked their docs to see if you did all the right steps?
  • swttt said:
    Haven't used it that much to debug tho (it's not that i created HA-Bridge :P )
    you double checked their docs to see if you did all the right steps?
    As far as I know I have, bout I ma nog a developer of Linux expert.  So could be anything. I feel a little stuck. 
  • Are you running it in a docker? And did you forward the right ports of that docker?
  • @swttt
    Can you comment on how you got the "Alexa, turn on RTL 4" working? 
    (i have some idea's but to re-invent the wheel...etc.)
  • @techniman
    Not at home now, but used the Kodi api for it since i am using Kodi for live tv :)
  • xAPPOxAPPO Member
    edited September 2017
    Has anyone managed to link the HA Bridge back to Homey as a second Hue Hub ?   I can't get it to be discovered by Homey.  Tried clicking the link button too.
    It does work with other devices that support hubs - although in those I am manually adding it by IP.   I don't think you can do that for the Hue app in Homey.
  • I think it depends on how it works with the hue api.
    For example, you can't get HA bridge to work with Google Home since that one relies on the web account API, where HA-bridge only works local.

    Can't tell if this is the case with Homey as well tho...
  • xAPPOxAPPO Member
    edited September 2017
    I can't remember what happened when I added my genuine Philips hub - I thought Homey discovered it and I just had to press the button and all was OK.. which I think implies it's just local integration.  I don't remember entering my credentials for the cloud but maybe I did or maybe Homey can retrieve that from the hub.      I tried disconnecting the WAN and Hue control still works so again it all appears local bridge control.  Maybe I have a UPnP issue.

    I too read about Google using the Hue cloud service API but was hoping HA Bridge would be OK with Homey , which would allow me to integrate a load more devices.

  • At home I use several Echo Dots, a HAbridge on a pi 2 and of course homey with several/mostly zwave connectors. 

    I notice frequently that I need to ask alexa via HAbridge to activate/deactivate a plug (or bluetooth device) twice before it actually works, anyone any idea what that might be about? 
  • Now that I have my Homey, this looks great... just gonna have to find some time to set this all up!

    I wish that Homey could implement this natively however... it seems many other companies have managed such (even down to Chinese companies like itead and their Sonoff controllers) so it doesnt seem like it should be a massive task for Homey to add Flows and Devices as Turn On commands. Distinguishing between Turn On / Turn Off commands would be difficult, but would imagine MVP of solely Turn On would be fine (that's the case with Yonomi for example)
  • Amazing - thank you so much for this tutorial - got it running nicely on my Windows Server and works a treat!!

    I have a few quick questions I'm hoping you can help with...

     - is there any way to adjust the % dim levels? I have a weird bug with my lightwave switch which if I ask for 100% then it does nothing, but if I ask for 95% then it is essentially goes to 100%. So if I could set 100% as 95% then that would mean the command could be what I'm used to

    - I ran this by just running the .jar in windows and opening localhost in my browser - do I need to leave that browser window open? (I am right now) Is it enough just to set a shortcut to run the jar at windows startup to resume with same settings?

    - do you have a basic guide on setting up the Harmony Hub for use with this? Reading the github it seems it needs a plugin, but can I just use the device ID from Homey and do it that way? I'm assuming that I can't break things with this but equally I don't want to play too much until I'm sure ;)

    - less urgent... is there any way to alter the response Alexa gives? "Ok" is fine, but I'm sure I read somewhere that you can overide this using this tool but I'm damned if I can find it now - feel like i imagined it!

    Thank you once again - fab tutorial and very much looking forward to setting my own Alexa commands!!
  • For question 1, i think it's an adjustment to {"dim": ${intensity.decimal_percent}}

    I've tried both {"dim": ${intensity.decimal_percent-1}} and {"dim": ${--intensity.decimal_percent}} neither seemed to work :(
  • @vaderag
    You tried {"dim": ${intensity.decimal_percent}-0.05} ? Where that is minus 5%.

    Can't help you with the windows jar part, running it in a docker. Maybe there is a way in windows to start a .jar and keep it hidden? Something like this ?

    I am using the Harmony tab within the UI, but just to turn on/off the device. Not sure if this came with the docker or is default for ha-bridge.

    No, "ok" is the basic alexa response as far as i know.

    Hope this helps ;)
  • Thanks so much - will give that 0.05 an attempt tomorrow see if it works (baby in bed so testing voice commands will get me a telling off ;) )

    When you say Harmony tab in UI you mean Homey or HA? The main thing I want is the favourite channels, since Homey doesn't do that and to use Alexa with them requires the Ask Harmony prefix
  • aah, using kodi for that (running live tv on kodi).
    But there is a logitech harmony tab in ha-bridge here..

    But i guess you could use homey for this...just make a virtual device (on off switch will do) add that to ha-bridge.
    Then create a flow when the virtual device is turned on, switch to the channel (using the harmony app, IR or whatever)

    When you named the device RTL 4 in ha-bridge, you can say "Alexa, turn on RTL 4".
  • Homey Harmony app (at least as far as I can see) doesn't do favourite channels :( So not sure if a way to do that with Homey

    I don't have a harmony tab in HA Bridge tho I do see a place to put in the IP address so maybe I'll try that tomorrow and see if it appears!
  • @swttt
    Firstly, {"dim": ${intensity.decimal_percent}-0.05} didn't work sadly... I'm a bit stumped now but gonna have to leave it till the wife is out as she's getting fed up of me asking the light to turn to different percentages!!

    However managed to get the Harmony tab added, and it pulled in the devices etc fine from my hub.

    However, after following the button to get the activity set up, I have a Device in Alexa but it doesnt work... the test doesnt work either so there is obviously something wrong with my config.

    Wondered if you'd mind comparing with yours?

    Do any of the other fields need filling out here? (it autopopulated the rest)

    Also, havent yet found a way to do favorite channels, but I'll settle for On/Off for now!!
  • UPDATE: Seems the above settings do work,  but (as I should have realised with Harmony), state is important - i.e. if you say "Alexa turn on the Xbox" and the Xbox is already on, it wont do anything (as you'd expect) but equally, if you've got out of sync and the xbox is off but Harmony thinks it's on, then it wont do anything either!

    I am having issue with favorite channels tho - not with the HA Bridge, but with Alexa.
    I set up BBC One, but when I ask Alexa to turn on BBC One it sometimes works, but more often than not it says "I dont see any video skills set up yadda yadda" :( Not sure how to work around that as you don't want to name a channel something else just to avoid Alexa's issues
  • vaderagvaderag Member
    edited October 2017
    Moving on from my questions above (i'm talking with some guys on the Github page to see if I can solve my % issue, and I've given up trying to override Alexa with TV channels)...

    New question: anyone know a way to launch a flow with this?! I've tried viewing a device id for the flow in my browser but figure given the URL is set up for device, it's likely gonna fail anyway... Launching a device is great, but I'd love to be able to use it to turn on my house alarm (for example)

    Edit - nevermind, i've just worked it out. For anyone else who might be interested
    - turns out BetterLogic allows you to add a device - add a Bitfilp (after setting up a boolean in the settings)
    - trigger your flow on variable change for that boolean
    - job done
  • JBSJBS Member
    edited October 2017
    Using HomeyDash from @swttt on a tablet at the moment which works fine, but a bit slow. Any change to create a simple dashboard page based on HA Bridge to quickly trigger devices on/off and dimm? I really like the performance/trigger speed of the test buttons on HA Bridge. I don't mind missing the device state (like HomeyDash has) and seperate on/off buttons.
Sign In or Register to comment.