I’m using a Raspberry Pi 3 with the official 7" touchscreen to run my Home Assistant and have it set up as an always on screen for a wall mounted control. I have it in my living room and would like to be able to dim the screen at night when watching our tv with the lights dim. I can set up the automation no problem but I cant get the command_line switch to work.
This command works through putty to adjust the brightness where n is the brightness level:
sudo echo n > /sys/class/backlight/rpi_backlight/brightness
How do i get it to work with Home Assistant?
Here is what I tried that did not work:
switch:
- platform: command_line
switches:
screen_brightness:
command_on: ‘sudo echo 250 > /sys/class/backlight/rpi_backlight/brightness’
command_off: ‘sudo echo 10 > /sys/class/backlight/rpi_backlight/brightness’
If there is a way to do this with a brightness slider, that would be even better.

