Controlling a Raspberry Pi via SSH

Feb 21

I have a Raspberry Pi 3 running HomeBridge, HomeAssistant, and a few other services. It has a 7" touchscreen display attached which is lovely - but bright. I prefer to turn the screen on and off when I want to use it instead of relying on the energy saver preferences (as I inevitably use the device just before I want to sleep) - however typing the terminal commands to do it is rather old fashioned.

Dictionary of actions in Workflow

The first action is a dictionary - so every ssh command I run has a name which I look at when running the Workflow. You can have anything here of course - providing it's a valid SSH command. My commands are as follows:

Screen On sudo bash -c "echo 0 > /sys/class/backlight/rpi_backlight/bl_power"

Screen Off sudo bash -c "echo 1 > /sys/class/backlight/rpi_backlight/bl_power"

Restart HomeBridge sudo systemctl restart homebridge

Restart HomeAssistant sudo systemctl restart home-assistant@homeassistant

Then Workflow asks you to choose an action to execute, and executes it. Finally you see the result of the SSH command returned to you - which is useful if there is output.

You can download the Workflow here. You'll need to know the IP address of your Raspberry Pi, the username (default pi), and password (default raspberry). If your username and password are the default ones I recommend you change them.

raspberry pi workflow

Related Posts

Webmentions

Add a comment

Previous Post Next Post