I wanted my Plex server only running when I needed it. However turning it off was the most difficult part. Wich is solved in this handy guide: (for convenience, I prefer to use hibernation: comfort vs energysavings/tear)
Next up was to turn on the pc when I open my app. This is done by the Tasker android app. When Plex app opens, do httpget request.
This trigger sets a variable in the piston, depending on who turned it on. I don’t want to turn off the server off when somebody else is watching. So, the piston sends WOL to the pc and automatically shuts down when this person will go to sleep. Wich is also triggered by Tasker by charging our phones on our nightdesk.
To make things complecated I sometimes work boring nightshifts and watch Plex, so if I leave work, I made it also turn off the pc. Again, triggered by Tasker depending on my location of Google Calender.
Cool. I use harmony hub and ST to do this. The PC is sleeping until the Nvidia shield turns on a virtual switch gets turned on via harmony which then runs a wol core piston to wake up my PC and start Plex.
Then I have plex.py to account for server issues and auto relaunch.