This is my first walkthrough on here so I hope I’m doing it right.
I have linked my desktop RGB (motherboard, CPU cooler, RGB strips, etc) to home assistant so it can be controlled like any other light. I did this using openRGB running as a service on Linux and a python script to link it to MQTT. I used ghomasHudson’s openrgb_to_mqtt, but It didn’t work properly for me so I forked it and added MQTT authentication.
I have a link to a demo in the comments
Prerequisites:
- Have Linux
- Have RGB
- Have python installed
- Have MQTT already set up on home assistant
Step 1. Install openRGB. Personally, I had issues installing it through apt so i ended up building openRGB through QT Creator. (Guide)
Step 2. Download my script here OpenRGB to MQTT light with authentication · GitHub
Step 2.5 Download requirements pip install openrgb-python paho-mqtt
Step 3. Edit my script to enter your details. NOTE: make sure to place the script in a permanent location, don’t just throw it in your downloads.
Things to change:
- ENTITY_NAME - This will set the entity in home assistant
- mqtt_user - This will need to be a user on your home assistant installation
- mqtt_pass - This will need to be the associated password with the designated username.
Step 4. Launch them to make sure they work correctly
Step 5. optional - Make the program and script run as a system service.
Personally i use POP os which is based off of Ubuntu. I dont know how to do this on other distributions.
- edit
/etc/systemd/system/openrgb-mqtt.service
- paste
Code
MAKE SURE TO EDIT User, working directory, and execstart to properly reflect your linux user and the path to the sctipt
[Unit]
Description=Open RGB to MQTT (Home assistant bridge)
After=openrgb-run.service
[Service]
WorkingDirectory=/home/user/
User=user
ExecStart=/usr/bin/python3 /path/to/script/openrgb_to_mqtt.py 192.168.0.123
Restart=always
[Install]
WantedBy=multi-user.target
- edit
/etc/systemd/system/openrgb.service
- paste apt install or built myself
apt install
[Unit]
After=network.service
[Service]
ExecStart=openrgb --server
[Install]
WantedBy=default.targetbuilt myself
MAKE SURE TO EDIT execstart to properly reflect the path to the sctipt
[Unit]
After=network.service
[Service]
ExecStart=/path/to/install/openrgb --server
[Install]
WantedBy=default.target
- run
systemctl daemon-reload
- Enable both services so they start at boot
systemctl enable openrgb.service
systemctl enable openrgb-mqtt.service
- Start them
systemctl start openrgb.service
systemctl start openrgb-mqtt.service
- Check them
systemctl status openrgb.service
systemctl status openrgb-mqtt.service