Desktop RGB linked to Home assistant

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:

  1. Have Linux
  2. Have RGB
  3. Have python installed
  4. 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:

  1. ENTITY_NAME - This will set the entity in home assistant
  2. mqtt_user - This will need to be a user on your home assistant installation
  3. 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.

  1. edit /etc/systemd/system/openrgb-mqtt.service
  2. 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
  1. edit /etc/systemd/system/openrgb.service
  2. paste apt install or built myself
    apt install
    [Unit]

    After=network.service


    [Service]

    ExecStart=openrgb --server


    [Install]

    WantedBy=default.target
    built 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
  1. run systemctl daemon-reload
  2. Enable both services so they start at boot
  1. systemctl enable openrgb.service
  2. systemctl enable openrgb-mqtt.service
  1. Start them
  1. systemctl start openrgb.service
  2. systemctl start openrgb-mqtt.service
  1. Check them
  1. systemctl status openrgb.service
  2. systemctl status openrgb-mqtt.service

You can view a demo here