This app was mentioned in 6 comments, with an average of 1.33 upvotes
https://play.google.com/store/apps/details?id=de.jonathansautter.autooff
This is a perfect solution I use. The only requirement is that you root the device (android only). A simple root (Magisk) won't get you banned from the game.
I set mine to auto-off 2am each day. I wish SW would have this built in to the game, just auto close after 1hr of not getting a response.
I was gonna suggest this open source app: https://play.google.com/store/apps/details?id=de.jonathansautter.autooff
But, AFAIK it's impossible to do it without root.
The only other thing I can think of is maybe an app can lock the device/switch off the screen. I'm not exactly sure what happens when you lock or screen off an android tv box, as they don't have lock screens or screens at all...
This to me is the best solution overall but not an answer to OP's question. OP needs to understand that root is a common occurrence seen in many timer off applications ( https://play.google.com/store/apps/details?id=de.jonathansautter.autooff ). One can use touch actions to perform it as well ( https://play.google.com/store/apps/details?id=com.joaomgcd.autoinput&hl=en )
Here's a good option, but it requires root. Not sure if Tasker can do it without root, but it's worth a shot too.
This one probably works
https://play.google.com/store/apps/details?id=de.jonathansautter.autooff