Libreelec power events from dmesg or anywhere else

  • 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.

    Edited 9 times, last by -=guybrush=- (April 18, 2022 at 5:34 PM).

  • I fear the title definitively doesn't describe accurately what I'm thinking of... No replies at all isn't a good sign. I try to change the title from "Libreelec power events from dmesg or anywhere else" to "Power on event: is a restart after a power loss detectable?". I don't know what else to think.

    Another very likely reason for the silence is that I'm asking for something which is just impossible as already guessed by me so, should this be the case, I apologize and I leave up to one of the moderators the choice of completely removing the thread.

    In the end, though it doesn't leave me satisfied, I'm fortunate to own a RPi: adding one of those hats between its power supply and the RPi itself prevents an unwanted power on to happen but this happens only because they're independent and separate circuitry not handled by LE but a microcontroller, exactly as I was saying before. This only eliminates an unwanted behaviour, no traces of what has actually happened.

    If you care about that only, even the old and established good practice of using a multi outlet with a switch or maybe a relay controlled by an IR remote put between the power outlet and the LE box power supply are good solutions (the latter making sense only for devices like a RPi or others without a remote OOTB, the former being instead universal).

    I mark the thread as solved though a real solution doesn't exist apart from one which is certainly feasible: an automatic power off given that there are no signs of user inputs for a certain period of time and no contents currently playing (or, for example, users connected to a tvheadend server), just taking care of background tasks eventually running (easily known by the owner who has scheduled them to run).

    Edited 10 times, last by -=guybrush=- (April 18, 2022 at 6:13 PM).