1. intro

Green Cell 360W UPS 600 VA - UPS01LCD

./pic/ups001.jpg

Based on different documentations found on the internet, we had a problem with the suggested blazer_usb driver. It does not allow to send commands trough upscmd such as shutdown.return. To overcome this problem we used another driver nutdrv_qx.

Now, our homeassistant is not happy with it since we do not have the battery.charge attributename anymore. We had to manually enable the battery.voltage attribute and now everything is working.

2. installation master

curl -# https://kojipkgs.fedoraproject.org/packages/nut/2.8.0/3.el9/aarch64/nut-2.8.0-3.el9.aarch64.rpm -o nut.rpm
curl -# https://kojipkgs.fedoraproject.org/packages/nut/2.8.0/3.el9/aarch64/nut-client-2.8.0-3.el9.aarch64.rpm -o net-client.rpm
yum -y install libusbx usbutils \
       https://kojipkgs.fedoraproject.org/packages/nut/2.8.0/3.el9/aarch64/nut-2.8.0-3.el9.aarch64.rpm \
       https://kojipkgs.fedoraproject.org/packages/nut/2.8.0/3.el9/aarch64/nut-client-2.8.0-3.el9.aarch64.rpm
rm -fr /etc/ups/
mkdir -p /etc/ups
wget -N -nv http://d01cid.ddns.net/sharel/etc/ups/ups.conf -P /etc/ups/
wget -N -nv http://d01cid.ddns.net/sharel/etc/ups/upsd.conf -P /etc/ups/
wget -N -nv http://d01cid.ddns.net/sharel/etc/ups/upsd.users -P /etc/ups/
chmod 640 /etc/ups/*
chown nut: -R /etc/ups/*
systemctl disable --now nut-monitor.service
systemctl enable --now nut-server.service nut-driver@ups009.service nut.target nut-driver.target
reboot
Tip udevadm control --reload-rules

3. testing

upsc ups009
battery.voltage: 13.90
device.type: ups
driver.name: nutdrv_qx
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.synchronous: auto
driver.version: 2.8.0
driver.version.data: Q1 0.07
driver.version.internal: 0.32
driver.version.usb: libusb-1.0.26 (API: 0x1000109)
input.frequency: 49.8
input.voltage: 230.0
input.voltage.fault: 230.5
output.voltage: 230.0
ups.beeper.status: enabled
ups.delay.shutdown: 30
ups.delay.start: 180
ups.load: 12
ups.productid: 0000
ups.status: OL
ups.type: offline / line interactive
ups.vendorid: 0001
upscmd -l ups009
Instant commands supported on UPS [ups009]:

beeper.toggle - Toggle the UPS beeper
load.off - Turn off the load immediately
load.on - Turn on the load immediately
shutdown.return - Turn off the load and return when power is back
shutdown.stayoff - Turn off the load and remain off
shutdown.stop - Stop a shutdown in progress
test.battery.start - Start a battery test
test.battery.start.deep - Start a deep battery test
test.battery.start.quick - Start a quick battery test
test.battery.stop - Stop the battery test

4. the big magic: rups

4.1. master

source /etc/cid.conf
curl -ns http://${rdsserver}/sharel/bin/inst-httpd | sh
curl -ns http://${rdsserver}/sharel/img/rups/rups-20221225.tgz | tar xzP -C /
sed -i s~'upsRole = .*'~'upsRole = "master"'~ /opt/rups/etc/rups.conf
systemctl reload httpd.service
sed -i s~"#\*/1 "~"\*/1 "~ /etc/cron.d/cid-cron
echo "/opt/rups/bin/rups" >> /bin/cid-cron01

4.2. slave

source /etc/cid.conf
curl -ns http://${rdsserver}/sharel/img/rups/rups-20221225.tgz | tar xzP -C /
sed -i s~'upsRole = .*'~'upsRole = "slave"'~ /opt/rups/etc/rups.conf
sed -i s~"#\*/1 "~"\*/1 "~ /etc/cron.d/cid-cron
echo "/opt/rups/bin/rups" >> /bin/cid-cron01

5. rups testing

curl -s http://ups.d01.net/rups/
#
ups_date="20220819"
ups_time="23:02:01"
ups_batt="13.90"
ups_volt="230"
ups_load="4"
ups_stat="OL"

6. debugging (on the master)

yum -y install usbutils
lsusb
Bus 001 Device 002: ID 0001:0000 Fry's Electronics <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
nut-scanner -U
Neon library not found. XML search disabled.
AVAHI client library not found. AVAHI search disabled.
Scanning USB bus.
[nutdev1]
        driver = "nutdrv_qx"
        port = "auto"
        vendorid = "0001"
        productid = "0000"
        product = "MEC0003"
        vendor = "MEC"
        bus = "001"
Tip nutdrv_qx -DD -a ups009

7. references

8. bug in el9

nut-scanner -U
nut-scanner: error while loading libusb-1.0.so.0 from libusb-0.1.so.4: libusb-1.0.so.0: cannot open shared object file: No such file or directory
Segmentation fault (core dumped)
Cannot load SNMP library (/usr/lib64/libnetsnmp.so.40.1.0) : /usr/lib64/libnetsnmp.so.40.1.0: undefined symbol: usmDESPrivProtocol. SNMP search disabled.
Neon library not found. XML search disabled.
AVAHI client library not found. AVAHI search disabled.
Scanning USB bus.