Turning on intergrated screen using command line in HA

okay for anybody that is wanting to have a monitor directly on the raspberry pi that homeassistant resides on
this needs to be done

  1. SSH into your Home assistant computer as normal
  2. install this first
  3. Change user to whatever your home assistant user name is “default is homeassistant” if default copy and paste
sudo apt-get install sshpass

sudo -u homeassistant -H -s

ssh [email protected] ‘export DISPLAY=:0 && xset dpms force on’

  1. Type yes.

  2. below command lines should now work for you in Home Assistant Switch Template

  - platform: command_line
    switches:
      touch_screen:
        friendly_name: Touch Screen
        command_on:  sshpass -p YOUR_PASSWORD ssh [email protected] 'export DISPLAY=:0 && xset dpms force on'
        command_off:  sshpass -p YOUR_PASSWORD ssh [email protected] 'export DISPLAY=:0 && xset dpms force off'
        command_state:  sshpass -p YOUR_PASSWORD ssh [email protected] 'export DISPLAY=:0 && xset -q | grep "Monitor is" | cut -c14-17' | grep "On" > /dev/null

2 Likes