Hi
I am running a RPi 4B with a Witty Pi 4 L3V7 module to apply power management. Predominatley it is running Home Assistant in a Docker container
Also in the setup is a RPi 3B acting as a slave - this handles external interactions involving, mostly, the use of a relay hat to control the watering system, openinf nd closing the garage door etc.
As you can imagine there are issues with 2 or more indepandent components keeping in sync. This is currently achieved by use of MQTT 'heartbeat' challenges and responses.
The Witty Pi 4 unit is a recent addition in an attempt to stop corruption introduced by repeated house power supply failures.
So far all good...
Now I would like to know if I can tell if the Main unit (Under the control of the Witty unit) is running on Battery or not.
This is so I can suspend the heartbeat messages (and resultant SMS messages for failure) because the 'slave' unit will be down if the power has gone out.
Can this be determined by IO pins or querying the I2C registers?
Thanks
JC
This information is provided by I2C register #7: https://github.com/uugear/Witty-Pi-4/blob/main/Firmware/WittyPi4_L3V7/WittyPi4_L3V7.ino#L54
For Witty Pi 4 L3V7 this register can either be 0 (powered via USB-C 5V) or 2 (powered by battery).
Excellent - just what I needed thank you 🙂