A few months ago, I bought and installed a Zwave stick. However, I want to start adding some smart bulbs to my house, and Zigbee is typically the way to go for that. And from what I read, people were having problems with Zigbee USB sticks and Home Assistant. So I decided to buy a Hubitat(Amazon).
So far it’s been OK. I was able to add in one of my CT-101 Thermostats without problem. And as a bonus, humidity actually works, unlike in Home Assistant. And I also purchased some Sengled Bulbs in White and RGBW. I haven’t tried out the White bulbs yet, but I’m sure they will work after my experience with the RGBW. I just went into the Hubitat, and clicked add device, turned on the light switch, and it showed up a few seconds later on the Hubitat.
Adding it was the easy part. However, I was a little disappointed in the interface for actually controlling the bulb. Even after installing the Dashboard addon, all I could do was turn it on and off and change the brightness ( The slider was very clunky via my iPhone). I couldn’t change the color or the temperature in the Dashboard addon. I was still able to do all those things in the basic web interface, but as you can see in the screenshot below, it’s not very user friendly or nice to look at. On top of that, there isn’t even a color picker. You have to manually change the Hue and Saturation to get your color(No Hex values either). I really hope they put more effort into the Dashboard and the interface. I was secretly hoping I would be able to abandon Home Assistant for this, but this along with a handful of other things (no Telegram support, no native MQTT ) put a quick stop to those thoughts.
Now that the mini-review is out of the way, I’m going to start working on integrating it with HA. All the instructions are already on the github for the Hubitat MQTT Bridge, but I just wanted to type it up as I go in case there are any issues I run into that might help someone else.
- Install the MQTT Broker using the hass.io addon, and configured with a basic username and password. This was done previously. I’m not going to go into any detail as there are tons of resources on how to do this.
- Configure HA to point to the broker:
YAML12345mqtt:broker: core-mosquittousername: mqtt_userpassword: mqtt_passdiscovery: true
- Installed the bridge on the HA box(running Ubuntu) using docker: sudo docker pull jeubanks/hubitat-mqtt-bridge
- Started the bridge. I changed the default port since I was already using 8080: sudo docker run -d --name="mqtt-bridge" -v /opt/mqtt-bridge:/config -p 6788:6788 jeubanks/hubitat-mqtt-bridge
- Edit the config file sudo gedit /opt/mqtt-bridge/config.yml . I changed the host, username, password, and port. Make sure you uncomment the lines. I made that mistake and the bridge wouldn’t start, and nothing indicated that it didn’t start. Feel free to change the other things if you want to.
- Restart the bridge: docker restart mqtt-bridge
- In Hubitat go to Drivers Code -> New Driver and copy/paste the Drivers Code and save it.
- Go to Devices -> Add Virtual Device and put in “MQTT Device” for the name and for the Type dropdown, select MQTT Bridge(It should be all the way at the bottom) and then Save.
- On the next screen, put in the IP, MAC, and the port you specified and click the save button directly under the IP address field.
- Go to Apps Code -> New App and copy/paste the App Code and save it.
- Go to Apps -> Load New App -> MQTT Bridge(at the bottom).
- Go through the list and put a check box next to the devices you want to send to the bridge.
- Near the bottom, click “Notify this bridge” and select the bridge we created and then Save.
Now I put the following into my HA install(‘RGBW LightBulb’ is the name of the light bulb):
- platform: mqtt
name: "Night Stand"
state_topic: "hubitat/RGBW LightBulb/switch/state"
command_topic: "hubitat/RGBW LightBulb/switch/cmd"
brightness_command_topic: "hubitat/RGBW LightBulb/level"
brightness_state_topic: "hubitat/RGBW LightBulb/level"
The bad news here is that it looks like either Hubitat or the Sengled bulb ( not sure which one) can only use Hue/Saturation/Levels values to set their color. Home Assistant only supports RGB and (I think) XY values. The good news is that there is a Pull Request for this. Hopefully it gets merged soon. The MQTT JSON light component supports HSL, but I’m guessing that means the bridge would need work to get things working.
Another issue I ran into is one that I don’t think many others will see. I’m putting it here in case someone else does the same thing by accident. Anyways, I was able to turn the light off using HA, but not on. In the bridge logs, it kept saying the ‘on’ message was a duplicate and it was ignoring it. It turns out that when I was testing things, I had HA publishing to the ‘set_state’ topic instead of the ‘cmd’ topic. So I went into the /opt/mqt_bridge/state.json file and deleted the line for ‘set_state’ and everything is fairly close to working now.
Update1: I still have an issue where if I turn off the light, in order to turn it back on, I sometimes have to move the brightness slider. Turning it off and on via Hubitat sometimes resolves the issue. I can’t seem to reproduce the issue or the fix consistently.
Update2: It looks like the switch/state topic is not getting updated by Hubitat for some reason. And I think it might be going back to the ‘set_state’ topic. Even though I deleted it, it just keeps coming back in. The only consistent workaround seems to be manually publishing a random word to that ‘set_state’ topic. But even then, the issue appears to just randomly come back.