i(Pad)OS launch task without confirmation

So, there have been a lot of discussions and questions concerning launching iOS tasks without user confirmation. Due to Apple restrictions, this does not seem to be possible. However, I think I have found a workaround! Sharing this here to get your thoughts and ideas before I dive in too deep.

Howto: if you have a stationary iPad, you connect its power supply to a smart switch. You can then define an iOS task to run when the power is connected to the device (or disconnected). To differentiate between multiple tasks, you can add “if” functions in which you check either Home Assistant templates or the status of (virtual) HomeKit switches. The nice thing about this is that tasks triggered by charger (dis-)connects are one of the few for which iOS does not require user acknowledgement.

I am setting this up with an iPad I have in the house which serves as the HomeKit Hub. This is stationary and I was already planning automating the power supply with a smart switch to cycle the battery regularly. But now I can also use this to trigger actions for apps on my iPad/iPhone which are not supported by Home Assistant.