Hi guys,
been struggling with this the last two days so thought I would share my findings!
I have a Pi3 running DakBoard hooked up to a 2" vertical mounted monitor in my living room. Been trying to get it so that its only on when I am home.
I finally got it working just now;
- platform: command_line
switches:
dakboard_screen:
command_on: ssh -F /config/ssh_config -i /config/id_rsa [email protected] 'vcgencmd display_power 1' 2> /config/command.log
command_off: ssh -F /config/ssh_config -i /config/id_rsa [email protected] 'vcgencmd display_power 0' 2> /config/command.log
friendly_name: Dakboard Screen
Its ALMOST working perfectly, its not correctly displaying if the screen is on or off yet…
using the line:
command_state: ssh -F /config/ssh_config -i /config/id_rsa [email protected] './chkdspl.sh' 2> /config/command.log
it should run the script and tell me if it is on or off;
the script contains:
#!/bin/bash
status="$(vcgencmd display_power)"
if [ "$status" != "display_power=0" ]
then
echo "0"
else
echo "1"
fi
and works correctly as expected when I execute directly from SSH in hass.io…
but the status is always showing as on in the web UI…
otherwise works a charm.
Just ensure that you have permissions set to 400 on the /config/ssh_config and /config/id_rsa files and that the public key is copied to the pi.
the ssh_config file contains:
Host *
StrictHostKeyChecking no