You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to integrate support for standard linux hwmon that can monitor power of the system? I am running a small system (baseboard: CM4-POE-UPS-BASE) with batteries that contains the ina219 I2C device. I hoped to find some generic hwmon UPS-like support here but I didn't.
I've got a short bash script that can be used as a basis for a nut driver:
#! /bin/bash
find_ina219()
{
for d in $(ls /sys/class/hwmon/); do
path="/sys/class/hwmon/${d}/name"
name=$(cat ${path})
if [ "${name}" == ina219 ]; then
echo "/sys/class/hwmon/${d}"
return 0
fi
done
return 1
}
ina219=$(find_ina219)
if [ "$?" != 0 ]; then
echo "could not find ina219 device" >&2
exit 1
fi
voltage=`cat ${ina219}/in1_input`
current=`cat ${ina219}/curr1_input`
echo "Status: "$(expr \( ${voltage} - 3000 \) / 12)" % (${voltage} mV, ${current} mA)"
if [ "${voltage}" -lt 3150 ] && [ "${current}" -gt 50 ]; then
echo "Low power"
sync
fi
if the current is positive, it means the output current of the battery (which can be considered as the Raspberry Pi load current), and if the current is negative, it means the battery charging current.
-- Battery Level Detection
Where should I start when trying to integrate this?
The text was updated successfully, but these errors were encountered:
There are a few NUT drivers using the Linux i2c bus, a relatively recent one is pijuice. I suppose taking a look at those (and their integration to build system in makefiles) would be a helpful start.
I wonder if the new driver (or its future iterations) could also talk to devices like "Waveshare UPS HAT (E) for Raspberry Pi 5/4/3B+ that takes four 21700 Lithium batteries, supports USB PD 3.0"
Sounds great! If there are any more PRs to add support, would be great to get them :)
And perhaps let WaveShare know there are more software ways to support their hardware (or even ask for support via more devices to test against), might help them promote it to people who are partial to NUT for everything in this area.
Would it be possible to integrate support for standard linux hwmon that can monitor power of the system? I am running a small system (baseboard: CM4-POE-UPS-BASE) with batteries that contains the ina219 I2C device. I hoped to find some generic hwmon UPS-like support here but I didn't.
I've got a short bash script that can be used as a basis for a nut driver:
Quick test:
Where should I start when trying to integrate this?
The text was updated successfully, but these errors were encountered: