detect power status on Lime2

Started by mbosschaert, December 23, 2018, 10:37:05 AM

Previous topic - Next topic

mbosschaert

Hi,
On my Lime2 (debian from olimex installed on SD) I want to detect if power is provided by main USB or by the connected Olimex backup-battery. Is there a device on proc or so which I can read out, or is there a package I can use to get this info?

Reason I need is the following. I use my Lime2 for a home monitoring system. It's set up as 2 different servers. One (S1) at my home (wired connected to internet), the other (S2) is in our holiday house in a remote place without cabled internet but within reach of GPRS signal. The second communicates with the first via GPRS using an ssh-tunnel using dyndns to identify S1. Reason why I want to monitor the power is that the mains at the holiday house are kind of unstable at S2. Often power outages and so. I have a couple of MQTT devices reporting temperature etc. But I would like to be informed about the actual power status so I could take action if outside temperatures are below zero and power is down.

Thx

lambda

If the proper drivers are loaded, the relevant info can be found in /sys/class/power_supply - I'm on mainline kernel. No idea if there are differences to the olimex kernel.

mbosschaert