I run Home Assistant on a headless server, and would like to know whether my PC’s monitors are on or off. I don’t need to control them, just know their status. I’ve looked at various options, but none seem to cover this:
There was one more that I found on GitHub (but didn’t save the link to) that was deprecated by the author. The author noted the program had memory leaks, among other problems, and recommended alternatives.
The best alternative I’ve found is to use an activity sensor (which many integrations provide), but that only tells me whether I’m using the machine, not whether my monitors are still on.
Going off the top of my head with very low level fundamentals of Linux, isn’t each connected device allocated a file name somewhere in the /dev directory? Could you look for that?
If you are not into Linux device driver software development, the suggested cheap power monitor is probably the way to go. If you want to check which monitor is on/off, you will have to have one device per monitor, otherwise power them all off the one current measuring device.
Out of curiosity, why do you need to know? Some monitors also have a standby mode that kicks in after inactivity, which can complicate things.
What are you using the monitor notofocation for? I was wanting to have an automation which turned on/off my office lights based upon the power state of my monitors. I can see the powerstate of the monitor reported in HA. When I try to create an auotmation with MQTT as a trigger Im prompted for a “Payload”. No idea what this is. I assumed I would be able to set the trigger nased upon the reported sensor state.
I mainly use the monitor sensor just for historical tracking. I enabled it mainly out of curiosity.
I do have one automation that uses the sensor. Note: That automation is based on the sensor created by the automation; it does not use MQTT as a trigger.
The automation resolves a problem with one of the three monitors connected to my computer. This monitor likes to wake itself up every 15 minutes or so to display a message saying it is scanning for a signal. This irritated me, so I connected a smart plug to the monitor and now use an automation to turn off power to the monitor when the monitor sensor says the monitors have been powered off for a while. Fortunately, this one waking monitor does not affect the sensor’s state. The automation then powers on the monitor when the monitor sensor says the monitors are on.