Display Backlight control


Please consider fact that I am total noob here as barely learning coding on configuration file :slight_smile:

I have raspberry pi attached to 7 inch display works as kiosk. I am able to turn off/ on and control brightness with ssh command prompt. now I need it to be done by home assistant like control brightness with guage.

I have started with below configuration:

  - platform: command_line
    name: TurnOnDisplay
    command: "echo 0 | sudo tee /sys/class/backlight/rpi_backlight/bl_power"
  - platform: command_line
    name: TurnOffDisplay
    command: "echo 1 | sudo tee /sys/class/backlight/rpi_backlight/bl_power"

  - platform: command_line
    name: DisplayBrightness
    command: "sudo bash -c 'echo {{ brightness }} >> /sys/class/backlight/rpi_backlight/brightness'"

What is next? how to set brightness, turn ON/OFF and create link it to card on Dashboard/Overview ?

I think I shouldnt set up it like β€œlight” entity :frowning:
anyone ?

You may need the brightness value to go from 0-255

yes, but how integrate into configuration file