Control Raspberry Pi screen as MQTT Light

Hello!

I recently got myself a raspberry pi along with the official 7" touchscreen to use as a dashboard and thought it would be neat to be able to control it via Home Assistant and use it in automations. So I wrote a little python script that allows you to add the screen as an MQTT Light in Home Assistant and control brightness and screen power state. I’ve only tested it with the 7" touchscreen so far, but in theory this should work with any screen connected to the raspberry pi.

The whole thing isn’t very polished yet and requires some customization to get it to work, but I thought I’d share it anyway. Check out the Github repository for more information and some instructions on how to set it up.

3 Likes

I’ve created an easy to use mqtt service to control the backlight with a mqtt light in HA.

2 Likes

This is perfect for me, works like a charm! The responsiveness is impressive.

Thank you!

Hi, thanks for your work!
The connection from the pi with the touch display to the mqtt server on the pi with HA works fine, but where can I put the code in HA? (Like in your example)

în your /config/configuration.yaml file if thats what you mean

1 Like

Yes, I tried this. But if i paste the example text no new device appiers in the mqtt broker.

Did you restart HA?

1 Like

Thank you for your support. It works fine!!!
I had coppied not everything :frowning: