I have the following problem:
I have a switch for my computer and my TV to turn them on or off.
However, when I turn off my PC, I want it to shut down via RPC first and then turn off the switch.
The same with my TV. When I turn it on, I want the switch to be turned on first and then the TV to be turned on with the Samsung integration. When I turn it off, the TV should first be turned off with the Samsung integration and then the switch should be turned off.
For the shutdown via RPC or the Samsung integration, there are services that I can call.
However, how do I do this with the rest?