How to figure out if a RPI 5 is powered up and running?

I have just been upgrading my home media players from RPI3's to RPi5's as well as upgrading the media player OS revision (LibreElec 12.0.0)..

I'm experiencing an unforeseen complication that relates to the built in CEC driver that allows the RPI5 to control the TV/Receiver volume. It won't let me turn the TV off and just leave the RPi5 on - if the RPi5 is on, it forces the TV/Receiver back on 15 seconds after I turn it off. If I power off the RPi5, well, then I can turn my TV/Receiver off just fine.... BUUUTTT..

How do I then turn it back on? Without me actually touching the RPi5, that is?

I use a Mini-IR blaster to control the TV, and when the RPi5 media player is on and running, I can control Kodi via Hubitat rules via HTTP json posts, and this is SERIOUSLY COOL. But it won't power on the RPi5 media player that's not listening.

Today, I ordered this: [Zigbee Relay](https://www.amazon.com/gp/product/B0CC8SRY23/) that I should be able to use to power the RPi5 on and off remotely with - the RPi5 has a special jumper that allows for a remote power switch which is just a momentary NO/SPST, that UNLIKE previous RPi models, will power it up and/or shut it off with a momentary activation. BUUUTT...

The actual Question, AT LAST..
How can I definitively determine the PRi5 power state from Hubitat? Since this isn't a latching button, it would be possible to get "out of sync" if someone manually changed the RPi5 power state for instance. I had envisioned creating and maintaining a Hubitat variable that would track ON/OFF state of the media player. However as noted, I could see this easily getting out of sync, so I'm looking for ideas for how to check the state of the RPi5 from Hubitat.

A few options:
I assume the Pi will be on the network, so you could ping it to determine state

Also if the Pi is plugged into a smart outlet that monitors power usage, anything over 0w and the PI is on.

Finally you could schedule a job on the pi to update a maker api endpoint of a virtual device. If the virtual device does get updated after a certain amount of time have a RM rule turn it off.

2 Likes

Ah, thanks for the reference to the ping device! I've installed it and am working on managing my state variable now..

Appreciate your time!

-ET-

Just be conscious of the fact that some polling options, such as PINGing, can also be affected by other issues, not just a lack of power to the RPI. If HE loses network connectivity with the RPI or there is some other issue stopping the RPI from responding to a PING request, you may get a false positive/negative (depending on your point of view). Similarly for a smart outlet, if there are issues with it reporting back to HE.

I'd suggest at least 2 indicators, in order to be more confident in the state of the RPI.

Also, a more physical method...

When my pc is powered on, usb devices receive 5v power. I use the pwr/gnd lines from a butchered USB cable to power a 5v relay, which allows a contact sensor to change state.

Simple and effective.

Edit - as per usual I use a nodemcu // konnected for this. This could also replace your zigbee device's remote push-button functionality you describe. Total cost, about a fiver.

1 Like