Hello to everyone! I don't know if the title I've chosen is descriptive enough but it is the best I could think of. I have an RPi Zero with LE 9.2.6 on it. Hooking it to one of the USB ports available on the TV is just enough to fed power to it and I'm satisfied by the approach but here comes the reason for the existence of this thread.
Every day, at six a.m. o'clock the TV enters a low power state (the panel stays off but it's evident that something is happening because both the RPi and the soundbar hooked to optical turn on) I believe to update the channel list or search for software updates. I'm almost certain this can be prevented disabling the relevant option under the TV settings but I prefer solving problems than getting round them.
The soundbar after a while turns off by itself but obviously not the RPi (and the television too with it, courtesy of HDMI CEC which is what I want to happen).
It's clear that this isn't what I want to happen so my question is if there is a way to understand that the RPi has been turned on by that power event (which is the same than plugging in an external USB power supply) and not by remote and, under that condition, turn it off (and the TV with it, still thanks to HDMI CEC).
It would be great even in case of a power loss when connected to a USB power supply as usual, not only under my peculiar scenario but my idea is that it is just impossible. The first place to look for a clue is certainly dmesg but the problem is that it starts logging events after the system has started the boot process so that's impossible to find something there nor, I believe, anywhere else. Maybe with some added and completely independent circuitry but that's really overkill.
Thanks in advance for your advices and have a nice day!
EDIT:
This isn't certainly appliable to an RPi given that, as discussed elsewhere, it can't be turned on by remote so its one and only way of turning on is plugging in (or obtaining the same by third party hats and/or some kind of workarounds, not the scope here). It remains interesting if it is possible to detect a power loss and eventually turn it off. In case of a power loss from turned on, I think it's almost certainly possible because there is certainly sign of an unclean shutdown somewhere but when already turned off before that happening (like under my peculiar scenario) I think it's just impossible.