I have a dedicated raspberry pi running Hyperion (ambilight) and it’s quite annoying having to go to the console (putty) and typing the typical “sudo shutdown now” command. I have been told that unplugging it may cause problems to the SD card.
So… is there a way to launch that script from HA? It would be a ssh command but I’m completely clueless on how to perform it on HA
Once again the pi and HA are both completely independent from each other.
Since rPi doesn’t power totally off on shutdown, your best bet is twofold: first you create a shell command to SSH to that system to shut it down and second you attach a smart plug to the power so you can turn it off after whatever amount of time you need for the shutdown to occur. Turning it on is as simple as turning the smart plug back on again.
Here is a good read on how to set up SSH key on the target so you can SSH to it easily and without a password:
Then you will simply create a shell command in Home Assistant for your shutdown:
After that you can write a script to run the shell command then wait X minutes and then turn off the smart plug:
It seems daunting but all of this is probably 15 minutes to put together and once you do it you’ll have some valuable knowledge for the future to do other cool stuff via remote shells.
I have my Hyperion pi plugged in a smart plug, I then use this
to turn it off, then after 3 minutes I turn off the plug.
If or when the telly is turned on after sunset the Hyperion pi is turned on, or if the telly is on before sunset then at sunset the Hyperion is turned on.
And the safest command is “sudo ha host shutdown” - verify somehow it is shut down (maybe wait a minuite for it to close all files and finish etc.) THEN power down the outlet, THEN wait a short time, THEN power it back on when you want.
Yep me too done it through shell commands in the past till I changed pi and could not remember what I did and all that key stuff was confusing me, found this and it was sorted easily.