PiSupply / PiJuice

Resources for PiJuice HAT for Raspberry Pi - use your Pi Anywhere
https://www.pi-supply.com/product/pijuice-standard/
GNU General Public License v3.0
435 stars 102 forks source link

NUT support? #124

Open NdK73 opened 6 years ago

NdK73 commented 6 years ago

Would it be possible to have NUT support so that PiJuice data can be accessed from other hosts?

shawaj commented 6 years ago

You mean network UPS tools yeah?

What functionality are you looking for exactly?

shawaj commented 6 years ago

@wikipedia555 can you look into this?

NdK73 commented 6 years ago

@shawaj actually it could be useful from read-only (to have other nodes able to monitor it) to full-control (having all the options of the current GUI/CLI). A basic use could simply be exporting the state to Domoticz dashboard (just because I'm sure Domoticz supports NUT). Maybe aggregating multiple nodes.

shawaj commented 6 years ago

Sounds very interesting. Need to look into this further

rodgers-95 commented 6 years ago

Hi !

I'm very interested too for NUT support !

For me it's the same reasons, but i'm sure that it could be interesting for others thinks because many softwares supports NUT like Domoticz but also NAS... ;)

Great idea ! I hope it will be integrated !

thank you very much !

wewen79 commented 4 years ago

Hello whatever happened to this request?

tvoverbeek commented 4 years ago

Somebody (Andrew Anderson aander07@gmail.com) already did it. There is a pull request for PiJuice HAT support in the network ups tools github: https://github.com/networkupstools/nut/pull/730

jimklimov commented 3 years ago

Hello all, thanks for contributing to NUT. Sadly that PR stalled for organizational reasons, but was now merged.

It would be very helpful if someone went over the stub man-page that I added, and proposed PRs to update the text if something there is blatantly wrong regarding anything - from driver features and custom toggles (@aander07 probably?) to description of hardware or interesting URLs about the project (anyone informed better than myself): https://github.com/networkupstools/nut/blob/master/docs/man/pijuice.txt

shawaj commented 3 years ago

@jimklimov the looks great! Nice work to you and @aander07

I'll let someone else reply about the man-page - it looks ok to me but I have no experience of nut or what this should look like exactly.

Quick question - is it worth us adding PiJuice to this list? And what's the process for doing so https://networkupstools.org/stable-hcl.html

jimklimov commented 3 years ago

Thanks for the reply, I'll ask around about the process for HCL.

I suppose there is also worth in having devices with known compatibility status (good or bad) listed, helping end-users make a choice what to buy if they want to use NUT with it, and helping hardware vendors to know whether/where they need to improve ;)

aquette commented 3 years ago

hi there, to me, it's indeed worth to list PiJuice in NUT HCL, since, as told by @jimklimov , this is intended to give visibility to users on the 1) fact that this device is supported (we don't list unsupported ... yet at least) 2) the general level of support and possible implication of the manufacturer (i.e. protocol specs provided, ...) 3) with the additional DDL, provide a detailed view on the data and features and possible means to replay (simulation) to developers / testers. cheers

jimklimov commented 3 years ago

One more point came up, it is worth mentioning the vendor's effort at https://github.com/networkupstools/nut/blob/master/docs/acknowledgements.txt

shawaj commented 3 years ago

@jimklimov by the way if you need any samples for testing or anything else we would be happy to provide some

jimklimov commented 3 years ago

@shawaj Thanks for the offer. Sadly, I'm not an RPi user yet, but got a NUT team mate who is (@aquette above) :)

I wonder if I should hop on board and get a berry too these days, though...

aquette commented 3 years ago

Just to confirm that I'd be interested in getting a sample, since I'll be resuming my home automation work (possibly still jeedom, where I'm still an official developer, or dominica which seems interesting too), now that the old house revamp has well progressed. I must however note that I still just own an old pi b+ and I'm definitely thinking about a v4 since it's out... Though I still have other priorities to spend the family bucks 😕 if you had to choose, prefer @jimklimov since I've recently retired from nut dev and leadership... The organizational lag that he mentioned. Cheers

shawaj commented 3 years ago

@aquette @jimklimov can you email sales@pi-supply.com with your name, address, phone for sending samples and link to this issue and I will get some sent accross :-)

shawaj commented 3 years ago

@aquette @jimklimov did you get the samples ok?

jimklimov commented 3 years ago

Not yet on my side, I believe the sending side was waiting for stock to replenish back then, and we did not contact since.

On Sat, Dec 5, 2020, 21:25 Aaron Shaw notifications@github.com wrote:

@aquette https://github.com/aquette @jimklimov https://github.com/jimklimov did you get the samples ok?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PiSupply/PiJuice/issues/124#issuecomment-739405744, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMPTFCNWDOJZNXQP5FV273STKJKHANCNFSM4FAUBO3A .

shawaj commented 3 years ago

You're right. For some reason I forgot that part. The good news is we have 2k pcs dropping in Monday or Tuesday so should ship to you next week :-)

jimklimov commented 3 years ago

Sounds great, thanks!

On Sat, Dec 5, 2020, 21:37 Aaron Shaw notifications@github.com wrote:

You're right. For some reason I forgot that part. The good news is we have 2k pcs dropping in Monday or Tuesday so should ship to you next week :-)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PiSupply/PiJuice/issues/124#issuecomment-739412794, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMPTFBTZFU4CLDPH3CX7WTSTKKYJANCNFSM4FAUBO3A .

jimklimov commented 3 years ago

BTW, that awaited shipment - was it of the Raspberries or of PiJuices? ;)

On Sat, Dec 5, 2020, 21:38 Jim Klimov jimklimov@gmail.com wrote:

Sounds great, thanks!

On Sat, Dec 5, 2020, 21:37 Aaron Shaw notifications@github.com wrote:

You're right. For some reason I forgot that part. The good news is we have 2k pcs dropping in Monday or Tuesday so should ship to you next week :-)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PiSupply/PiJuice/issues/124#issuecomment-739412794, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMPTFBTZFU4CLDPH3CX7WTSTKKYJANCNFSM4FAUBO3A .

aquette commented 3 years ago

Hi Aaron, Just to confirm, nothing received on my side neither.

Cheers from the snowy French Alps Arno

Le sam. 5 déc. 2020 à 23:17, Jim Klimov notifications@github.com a écrit :

BTW, that awaited shipment - was it of the Raspberries or of PiJuices? ;)

On Sat, Dec 5, 2020, 21:38 Jim Klimov jimklimov@gmail.com wrote:

Sounds great, thanks!

On Sat, Dec 5, 2020, 21:37 Aaron Shaw notifications@github.com wrote:

You're right. For some reason I forgot that part. The good news is we have 2k pcs dropping in Monday or Tuesday so should ship to you next week :-)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <https://github.com/PiSupply/PiJuice/issues/124#issuecomment-739412794 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAMPTFBTZFU4CLDPH3CX7WTSTKKYJANCNFSM4FAUBO3A

.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PiSupply/PiJuice/issues/124#issuecomment-739423736, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHA43LBE6HAJ5D2ZUH6GHLSTKWPFANCNFSM4FAUBO3A .

shawaj commented 3 years ago

@aquette @jimklimov it's actually the Pi and the PiJuice all going out together :-)

jimklimov commented 3 years ago

Great news, thank you! Looking forward to Santa Shaw's delivery ;)

On Sun, Dec 6, 2020, 10:06 Aaron Shaw notifications@github.com wrote:

@aquette https://github.com/aquette @jimklimov https://github.com/jimklimov it's actually the Pi and the PiJuice all going out together :-)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PiSupply/PiJuice/issues/124#issuecomment-739475278, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMPTFARMY4S5WZKLENWCIDSTNCPVANCNFSM4FAUBO3A .

jimklimov commented 3 years ago

Sorry for the delay reporting: we've got our packages a few days ago.

Jim

On Sun, Dec 6, 2020, 11:09 Jim Klimov jimklimov@gmail.com wrote:

Great news, thank you! Looking forward to Santa Shaw's delivery ;)

On Sun, Dec 6, 2020, 10:06 Aaron Shaw notifications@github.com wrote:

@aquette https://github.com/aquette @jimklimov https://github.com/jimklimov it's actually the Pi and the PiJuice all going out together :-)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PiSupply/PiJuice/issues/124#issuecomment-739475278, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMPTFARMY4S5WZKLENWCIDSTNCPVANCNFSM4FAUBO3A .

shawaj commented 3 years ago

Awesome 👍

999LV commented 3 years ago

@jimklimov or @aquette , this may not be the right place to ask this question, but do you know if this driver (many thanks for this) is included in the current apt packages for Raspian (sorry Pi OS) ?

Installed version of NUT is "nut/stable,now 2.7.4-8 all [installed]"

I have now been battling for hours but keep getting this error: upsc hat Error: Driver not connected

while my /etc/nut/ups.conf indeed is set to: [hat] driver = pijuice port = /dev/i2c-1 desc = "PiJuice HAT"

Any pointer ?

jimklimov commented 3 years ago

Probably not, the driver was added to NUT master branch a couple of months ago and there was no release (e.g. 2.7.5) containing it yet, alas.

On Sat, Feb 6, 2021, 18:50 Logread notifications@github.com wrote:

@jimklimov https://github.com/jimklimov or @aquette https://github.com/aquette , this may not be the right place to ask this question, but do you know if this driver (many thanks for this) is included in the current apt packages for Raspian (sorry Pi OS) ?

Installed version of NUT is "nut/stable,now 2.7.4-8 all [installed]"

I have now been battling for hours but keep getting this error: upsc hat Error: Driver not connected

while my /etc/nut/ups.conf indeed is set to: [hat] driver = pijuice port = /dev/i2c-1 desc = "PiJuice HAT"

Any pointer ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PiSupply/PiJuice/issues/124#issuecomment-774514574, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMPTFHU7BPVPOUIL4H4PNTS5V6M7ANCNFSM4FAUBO3A .

999LV commented 3 years ago

Thanks for the quick response. I’ll try to compile the master branch then. Cheers

patricknooijen commented 3 years ago

how can i install the patch to get the pijuice to work with nut?

TGMivo commented 3 years ago

I'm also interested

jimklimov commented 3 years ago

Please see NUT build instructions to compile from the master branch at github

On Tue, Jul 27, 2021, 22:38 TGMivo @.***> wrote:

I'm also interested

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PiSupply/PiJuice/issues/124#issuecomment-887818662, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMPTFEMBCLG3SYHMY4N6SLTZ4KN5ANCNFSM4FAUBO3A .

TGMivo commented 3 years ago

Hi Jimklimov, I installed Nut, edit sudo nano /etc/nut/ups.conf with [hat] driver = pijuice port = /dev/i2c-1 desc = "PiJuice HAT"

pi@raspberrypi:~ $ sudo upsdrvctl start Network UPS Tools - UPS driver controller 2.7.4 Can't start /lib/nut/pijuice: No such file or directory

pi@raspberrypi:~ $ upsc hat Error: Connection failure: Connection refused

jimklimov commented 3 years ago

Installed from custom build? Or OS package?

The pijuice driver is a recent addition, there was no release yet to include it and so no official in-distro packages, probably.

On Tue, Jul 27, 2021, 23:21 TGMivo @.***> wrote:

Hi Jimklimov, I installed Nut, edit sudo nano /etc/nut/ups.conf with [hat] driver = pijuice port = /dev/i2c-1 desc = "PiJuice HAT"

@.***:~ $ sudo upsdrvctl start Network UPS Tools - UPS driver controller 2.7.4 Can't start /lib/nut/pijuice: No such file or directory

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PiSupply/PiJuice/issues/124#issuecomment-887843537, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMPTFGVICGH6OVHVMFLRDTTZ4POPANCNFSM4FAUBO3A .

TGMivo commented 3 years ago

Pi-Juice OS is running, PiJuice-MQTT is also running. Custom build? Where?

jimklimov commented 3 years ago

On the Pi. I do not currently have one running, but generally it is a linux system so get prerequisites (i2c dev libs+headers in particular) and roughly

git clone <url>
./autogen.sh
./configure ### (maybe with --flags for your system, like tweak paths: defaults
to not conflict with packaging and go to /usr/local/ups)
make
make install

On Wed, Jul 28, 2021, 06:58 TGMivo @.***> wrote:

Pi-Juice OS is running, PiJuice-MQTT is also running. Custom build? Where?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PiSupply/PiJuice/issues/124#issuecomment-888010462, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMPTFEU3H5X5Y7SDRKBOX3TZ6E73ANCNFSM4FAUBO3A .

TGMivo commented 3 years ago

Hmm I don't really know what you mean, but i'm run Raspbian OS, last version. libi2c-dev is installed

jimklimov commented 2 years ago

While revising NUT CI setups recently, I documented the prerequisites needed to build "everything possible" on a number of operating systems. Here is part of that list picked for Debian 10: https://github.com/networkupstools/nut/blob/fightwarn/docs/config-prereqs.txt#L47

As documented nearby, the big build itself usually goes like:

:; mkdir -p nut ; cd nut
:; git clone https://github.com/networkupstools/nut/ -b fightwarn .
:; ./autogen.sh && \
    ./configure --with-doc=all --with-all --with-cgi && \
    make all && make check && make spellcheck

The docs/ directory contains a lot of other chapters on configuration of the software and practical setups.

TGMivo commented 2 years ago

pi@raspberrypi:~/nut $ ./autogen.sh && ./configure --with-doc=all --with-all --with-cgi && make all && make check && make spellcheck Calling autoreconf... autoreconf: Entering directory `.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal -I m4 autoreconf: configure.ac: tracing autoreconf: configure.ac: not using Libtool autoreconf: running: /usr/bin/autoconf autoreconf: running: /usr/bin/autoheader autoreconf: running: automake --add-missing --copy --no-force clients/Makefile.am:29: error: Libtool library used but 'LIBTOOL' is undefined clients/Makefile.am:29: The usual way to define 'LIBTOOL' is to add 'LT_INIT' clients/Makefile.am:29: to 'configure.ac' and run 'aclocal' and 'autoconf' again. clients/Makefile.am:29: If 'LT_INIT' is in 'configure.ac', make sure clients/Makefile.am:29: its definition is in aclocal's search path. common/Makefile.am:5: error: Libtool library used but 'LIBTOOL' is undefined common/Makefile.am:5: The usual way to define 'LIBTOOL' is to add 'LT_INIT' common/Makefile.am:5: to 'configure.ac' and run 'aclocal' and 'autoconf' again. common/Makefile.am:5: If 'LT_INIT' is in 'configure.ac', make sure common/Makefile.am:5: its definition is in aclocal's search path. drivers/Makefile.am:300: error: Libtool library used but 'LIBTOOL' is undefined drivers/Makefile.am:300: The usual way to define 'LIBTOOL' is to add 'LT_INIT' drivers/Makefile.am:300: to 'configure.ac' and run 'aclocal' and 'autoconf' again. drivers/Makefile.am:300: If 'LT_INIT' is in 'configure.ac', make sure drivers/Makefile.am:300: its definition is in aclocal's search path. tools/nut-scanner/Makefile.am:19: error: Libtool library used but 'LIBTOOL' is undefined tools/nut-scanner/Makefile.am:19: The usual way to define 'LIBTOOL' is to add 'LT_INIT' tools/nut-scanner/Makefile.am:19: to 'configure.ac' and run 'aclocal' and 'autoconf' again. tools/nut-scanner/Makefile.am:19: If 'LT_INIT' is in 'configure.ac', make sure tools/nut-scanner/Makefile.am:19: its definition is in aclocal's search path. autoreconf: automake failed with exit status: 1

jimklimov commented 2 years ago

Seems like you need a package for libtool, and other prereqs did not install it as their dependency there?.. :\

On Tue, Aug 3, 2021, 13:06 TGMivo @.***> wrote:

@.***:~/nut $ ./autogen.sh && ./configure --with-doc=all --with-all --with-cgi && make all && make check && make spellcheck Calling autoreconf... autoreconf: Entering directory `.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal -I m4 autoreconf: configure.ac: tracing autoreconf: configure.ac: not using Libtool autoreconf: running: /usr/bin/autoconf autoreconf: running: /usr/bin/autoheader autoreconf: running: automake --add-missing --copy --no-force clients/Makefile.am:29: error: Libtool library used but 'LIBTOOL' is undefined clients/Makefile.am:29: The usual way to define 'LIBTOOL' is to add 'LT_INIT' clients/Makefile.am:29: to 'configure.ac' and run 'aclocal' and 'autoconf' again. clients/Makefile.am:29: If 'LT_INIT' is in 'configure.ac', make sure clients/Makefile.am:29: its definition is in aclocal's search path. common/Makefile.am:5: error: Libtool library used but 'LIBTOOL' is undefined common/Makefile.am:5: The usual way to define 'LIBTOOL' is to add 'LT_INIT' common/Makefile.am:5: to 'configure.ac' and run 'aclocal' and 'autoconf' again. common/Makefile.am:5: If 'LT_INIT' is in 'configure.ac', make sure common/Makefile.am:5: its definition is in aclocal's search path. drivers/Makefile.am:300: error: Libtool library used but 'LIBTOOL' is undefined drivers/Makefile.am:300: The usual way to define 'LIBTOOL' is to add 'LT_INIT' drivers/Makefile.am:300: to 'configure.ac' and run 'aclocal' and 'autoconf' again. drivers/Makefile.am:300: If 'LT_INIT' is in 'configure.ac', make sure drivers/Makefile.am:300: its definition is in aclocal's search path. tools/nut-scanner/Makefile.am:19: error: Libtool library used but 'LIBTOOL' is undefined tools/nut-scanner/Makefile.am:19: The usual way to define 'LIBTOOL' is to add 'LT_INIT' tools/nut-scanner/Makefile.am:19: to 'configure.ac' and run 'aclocal' and 'autoconf' again. tools/nut-scanner/Makefile.am:19: If 'LT_INIT' is in 'configure.ac', make sure tools/nut-scanner/Makefile.am:19: its definition is in aclocal's search path. autoreconf: automake failed with exit status: 1

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PiSupply/PiJuice/issues/124#issuecomment-891754792, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMPTFHVLVZB6WMEJC7W7JDT27EUNANCNFSM4FAUBO3A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

jimklimov commented 2 years ago

Just checked with current NUT master and Debian bullseye based Raspberry OS from their site: added prerequisite packages listed in docs/config-prereq.txt and quickly built with ./ci_build.sh for the test (autoconfigs itself).

Then ./drivers/pijuice -DDDDDD -d 1 -s pihat -x port=/dev/i2c-1 collected the data and ran one cycle of data-dumping (-d 1) and exited.

NOTE: if you test as root, also add -u root to driver args - device node on DEVFS is owned by pi by default, but the driver normally drops privileges to configure'd account (e.g. nut or ups in packages, or nobody by default...) from root, and can't read i2c then.

The bigger HAT was detected and seems reasonably reported, with the 1820mAh standard battery:

...
   0.060154     [D1] Power Off: 127 Seconds
   0.060229     [D3] Entering dstate_dump
battery.capacity: 1.000
battery.charge: 5.0
battery.charge.low: 25
battery.charger.status: charging
battery.current: -0.168
battery.packs: 1
battery.packs.bad: 0
battery.temperature: 56
battery.type: LiPO
battery.voltage: 3.648
battery.voltage.nominal: 4.180
device.mfr: PiJuice
device.type: HAT
driver.name: pijuice
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/i2c-1
driver.parameter.synchronous: no
driver.version: 2.7.4-4385-g2bd17f540
driver.version.internal: 0.9
input.current: -0.592
input.voltage: 4.966
ups.date: 2022-01-21
ups.firmware: 1.4
ups.mfr: PiJuice
ups.status: LB OL CHRG
ups.time: 15:15:44.88
ups.type: HAT

Same PiJuice controller later, with 12000mAh battery wired to its J4 port instead of the 1820mAh - note the weird battery.capacity - for some reason now it says 1.820, and temperature is strange (maybe a decimal shift? 251 == 25.1 *C?) :\

pi@raspberrypi:~/nut $ ./drivers/pijuice -DDDDDD -d 1 -s pij -x port=/dev/i2c-1 > pihatbig.txt 2>&1
pi@raspberrypi:~/nut $ cat pihatbig.txt
   0.000000     [D5] send_to_all: SETINFO driver.parameter.port "/dev/i2c-1"
   0.000247     [D1] debug level is '6'
   0.001303     [D5] send_to_all: SETINFO device.type "ups"
   0.001446     [D3] get_firmware_version
   0.002954     Unknown Firmware release: 1.4
   0.003016     [D1] UPS Firmware Version: 1.4
   0.003074     [D5] send_to_all: SETINFO ups.firmware "1.4"
   0.003136     [D5] send_to_all: SETINFO driver.version "2.7.4-4385-g2bd17f540"
   0.003195     [D5] send_to_all: SETINFO driver.version.internal "0.9"
   0.003252     [D5] send_to_all: SETINFO driver.name "pijuice"
   0.003309     [D5] send_to_all: SETINFO ups.mfr "PiJuice"
   0.003365     [D5] send_to_all: SETINFO ups.type "HAT"
   0.003422     [D5] send_to_all: SETINFO device.mfr "PiJuice"
   0.003477     [D5] send_to_all: SETINFO device.type "HAT"
   0.003533     [D1] Low Battery Threshold: 25%
   0.003589     [D5] send_to_all: SETINFO battery.charge.low "25"
   0.003642     [D1] Nominal Battery Voltage: 4.180V
   0.003697     [D5] send_to_all: SETINFO battery.voltage.nominal "4.180"
   0.003747     [D3] get_i2c_address
   0.004934     [D1] I2C Address: 0x14
   0.005001     [D1] Found device '0x14' on port '/dev/i2c-1'
   0.005049     [D3] get_battery_profile
   0.009196     [D1] Battery Capacity: 1.820Ah
   0.009271     [D5] send_to_all: SETINFO battery.capacity "1.820"
   0.009321     [D3] get_battery_profile_ext
   0.014312     [D1] Battery Chemistry: LiPO
   0.014389     [D5] send_to_all: SETINFO battery.type "LiPO"
   0.014444     [D3] get_status
   0.015638     [D1] Battery Status: Normal
   0.015703     [D5] send_to_all: SETINFO battery.packs "1"
   0.015763     [D5] send_to_all: SETINFO battery.packs.bad "0"
   0.015814     [D1] Power Input: Not Present
   0.015862     [D1] Power Input 5v: Present
   0.015910     [D3] get_charge_level_hi_res
   0.017323     [D1] Battery Charge Level: 51.0%
   0.017389     [D5] send_to_all: SETINFO battery.charge "51.0"
   0.017437     On USB power
   0.017548     [D1] On USB power [1:0:0]
   0.017599     [D1] Battery Charger Status: resting
   0.017653     [D5] send_to_all: SETINFO battery.charger.status "resting"
   0.017698     [D3] get_battery_temperature
   0.018972     [D1] Battery Temperature: 123°C
   0.019030     [D5] send_to_all: SETINFO battery.temperature "123"
   0.019074     [D3] get_battery_voltage
   0.020351     [D1] Battery Voltage: 3.700V
   0.020406     [D5] send_to_all: SETINFO battery.voltage "3.700"
   0.020448     [D3] get_battery_current
   0.021728     [D1] Battery Current: 0.264A
   0.021791     [D5] send_to_all: SETINFO battery.current "0.264"
   0.021834     [D3] get_io_voltage
   0.023122     [D1] Input Voltage: 4.994V
   0.023176     [D5] send_to_all: SETINFO input.voltage "4.994"
   0.023219     [D3] get_io_current
   0.024520     [D1] Input Current: 0.064A
   0.024578     [D5] send_to_all: SETINFO input.current "0.064"
   0.024621     [D3] get_time
   0.027337     [D1] UPS Time: 21:48:40.41
   0.027400     [D5] send_to_all: SETINFO ups.time "21:48:40.41"
   0.027445     [D1] UPS Date: 2022-01-21
   0.027493     [D5] send_to_all: SETINFO ups.date "2022-01-21"
   0.027536     [D3] get_power_off
   0.028605     [D1] Power Off: DISABLED
   0.028660     [D5] send_to_all: SETINFO ups.status "OL"
   0.028705     [D5] send_to_all: DATAOK
   0.028754     [D5] send_to_all: SETINFO driver.parameter.pollinterval "2"
   0.028803     [D5] send_to_all: SETINFO driver.parameter.synchronous "no"
   0.028851     [D3] get_status
   0.029951     [D1] Battery Status: Normal
   0.030010     [D1] Power Input: Not Present
   0.030052     [D1] Power Input 5v: Present
   0.030092     [D3] get_charge_level_hi_res
   0.031379     [D1] Battery Charge Level: 51.0%
   0.031431     [D1] On USB power [1:0:0]
   0.031472     [D1] Battery Charger Status: resting
   0.031516     [D3] get_battery_temperature
   0.032790     [D1] Battery Temperature: 251°C
   0.032845     [D5] send_to_all: SETINFO battery.temperature "251"
   0.032888     [D3] get_battery_voltage
   0.034167     [D1] Battery Voltage: 3.828V
   0.034228     [D5] send_to_all: SETINFO battery.voltage "3.828"
   0.034270     [D3] get_battery_current
   0.035546     [D1] Battery Current: 0.264A
   0.035596     [D3] get_io_voltage
   0.036884     [D1] Input Voltage: 4.991V
   0.036937     [D5] send_to_all: SETINFO input.voltage "4.991"
   0.036979     [D3] get_io_current
   0.038280     [D1] Input Current: 0.064A
   0.038387     [D3] get_time
   0.041102     [D1] UPS Time: 21:48:40.39
   0.041158     [D5] send_to_all: SETINFO ups.time "21:48:40.39"
   0.041202     [D1] UPS Date: 2022-01-21
   0.041247     [D3] get_power_off
   0.042321     [D1] Power Off: DISABLED
   0.042380     [D3] get_status
   0.043475     [D1] Battery Status: Normal
   0.043527     [D1] Power Input: Not Present
   0.043568     [D1] Power Input 5v: Present
   0.043610     [D3] get_charge_level_hi_res
   0.044899     [D1] Battery Charge Level: 51.0%
   0.044952     [D1] On USB power [1:0:0]
   0.044994     [D1] Battery Charger Status: resting
   0.045038     [D3] get_battery_temperature
   0.046314     [D1] Battery Temperature: 251°C
   0.046372     [D3] get_battery_voltage
   0.047647     [D1] Battery Voltage: 3.700V
   0.047701     [D5] send_to_all: SETINFO battery.voltage "3.700"
   0.047743     [D3] get_battery_current
   0.049021     [D1] Battery Current: 0.264A
   0.049071     [D3] get_io_voltage
   0.050360     [D1] Input Voltage: 4.988V
   0.050420     [D5] send_to_all: SETINFO input.voltage "4.988"
   0.050462     [D3] get_io_current
   0.051760     [D1] Input Current: 0.064A
   0.051812     [D3] get_time
   0.054527     [D1] UPS Time: 21:48:40.38
   0.054588     [D5] send_to_all: SETINFO ups.time "21:48:40.38"
   0.054633     [D1] UPS Date: 2022-01-21
   0.054678     [D3] get_power_off
   0.055747     [D1] Power Off: DISABLED
   0.055797     [D3] Entering dstate_dump
Network UPS Tools - PiJuice UPS driver 0.9 (2.7.4-4385-g2bd17f540)
Warning: This is an experimental driver.
Some features may not function correctly.

battery.capacity: 1.820
battery.charge: 51.0
battery.charge.low: 25
battery.charger.status: resting
battery.current: 0.264
battery.packs: 1
battery.packs.bad: 0
battery.temperature: 251
battery.type: LiPO
battery.voltage: 3.700
battery.voltage.nominal: 4.180
device.mfr: PiJuice
device.type: HAT
driver.name: pijuice
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/i2c-1
driver.parameter.synchronous: no
driver.version: 2.7.4-4385-g2bd17f540
driver.version.internal: 0.9
input.current: 0.064
input.voltage: 4.988
ups.date: 2022-01-21
ups.firmware: 1.4
ups.mfr: PiJuice
ups.status: OL
ups.time: 21:48:40.38
ups.type: HAT

PiJuice Zero pHAT with 12000mAh battery looks similar, though numbers also seem weird:

pi@raspberrypi:~/nut $ ./drivers/pijuice -DDDDDD -d 1 -s pij -x port=/dev/i2c-1 > pihatzero.txt 2>&1
pi@raspberrypi:~/nut $ cat pihatzero.txt
   0.000000     [D5] send_to_all: SETINFO driver.parameter.port "/dev/i2c-1"
   0.000222     [D1] debug level is '6'
   0.001321     [D5] send_to_all: SETINFO device.type "ups"
   0.001473     [D3] get_firmware_version
   0.002926     Unknown Firmware release: 1.4
   0.002987     [D1] UPS Firmware Version: 1.4
   0.003045     [D5] send_to_all: SETINFO ups.firmware "1.4"
   0.003107     [D5] send_to_all: SETINFO driver.version "2.7.4-4385-g2bd17f540"
   0.003165     [D5] send_to_all: SETINFO driver.version.internal "0.9"
   0.003223     [D5] send_to_all: SETINFO driver.name "pijuice"
   0.003281     [D5] send_to_all: SETINFO ups.mfr "PiJuice"
   0.003340     [D5] send_to_all: SETINFO ups.type "HAT"
   0.003397     [D5] send_to_all: SETINFO device.mfr "PiJuice"
   0.003454     [D5] send_to_all: SETINFO device.type "HAT"
   0.003511     [D1] Low Battery Threshold: 25%
   0.003569     [D5] send_to_all: SETINFO battery.charge.low "25"
   0.003624     [D1] Nominal Battery Voltage: 4.180V
   0.003681     [D5] send_to_all: SETINFO battery.voltage.nominal "4.180"
   0.003732     [D3] get_i2c_address
   0.004962     [D1] I2C Address: 0x14
   0.005060     [D1] Found device '0x14' on port '/dev/i2c-1'
   0.005111     [D3] get_battery_profile
   0.009269     [D1] Battery Capacity: 1.000Ah
   0.009348     [D5] send_to_all: SETINFO battery.capacity "1.000"
   0.009400     [D3] get_battery_profile_ext
   0.014219     [D1] Battery Chemistry: LiPO
   0.014293     [D5] send_to_all: SETINFO battery.type "LiPO"
   0.014349     [D3] get_status
   0.015548     [D1] Battery Status: Normal
   0.015613     [D5] send_to_all: SETINFO battery.packs "1"
   0.015673     [D5] send_to_all: SETINFO battery.packs.bad "0"
   0.015724     [D1] Power Input: Not Present
   0.015774     [D1] Power Input 5v: Not Present
   0.015823     [D3] get_charge_level_hi_res
   0.017242     [D1] Battery Charge Level: 51.4%
   0.017318     [D5] send_to_all: SETINFO battery.charge "51.4"
   0.017372     [D1] On Battery power [0:0:1]
   0.017424     [D3] get_battery_temperature
   0.018836     [D1] Battery Temperature: 248°C
   0.018900     [D5] send_to_all: SETINFO battery.temperature "248"
   0.018952     [D3] get_battery_voltage
   0.020365     [D1] Battery Voltage: 3.709V
   0.020429     [D5] send_to_all: SETINFO battery.voltage "3.709"
   0.020479     [D3] get_battery_current
   0.021896     [D1] Battery Current: 0.000A
   0.021968     [D5] send_to_all: SETINFO battery.current "0.000"
   0.022018     [D3] get_io_voltage
   0.023444     [D1] Input Voltage: 5.094V
   0.023508     [D5] send_to_all: SETINFO input.voltage "5.094"
   0.023558     [D3] get_io_current
   0.024990     [D1] Input Current: 0.012A
   0.025063     [D5] send_to_all: SETINFO input.current "0.012"
   0.025113     [D3] get_time
   0.028144     [D1] UPS Time: 00:03:11.46
   0.028210     [D5] send_to_all: SETINFO ups.time "00:03:11.46"
   0.028263     [D1] UPS Date: 2000-01-01
   0.028318     [D5] send_to_all: SETINFO ups.date "2000-01-01"
   0.028369     [D3] get_power_off
   0.029556     [D1] Power Off: 127 Seconds
   0.029628     [D5] send_to_all: SETINFO ups.status "OB DISCHRG"
   0.029682     [D5] send_to_all: DATAOK
   0.029739     [D5] send_to_all: SETINFO driver.parameter.pollinterval "2"
   0.029797     [D5] send_to_all: SETINFO driver.parameter.synchronous "no"
   0.029854     [D3] get_status
   0.031051     [D1] Battery Status: Normal
   0.031111     [D1] Power Input: Not Present
   0.031161     [D1] Power Input 5v: Not Present
   0.031210     [D3] get_charge_level_hi_res
   0.032625     [D1] Battery Charge Level: 51.4%
   0.032686     [D1] On Battery power [0:0:1]
   0.032775     [D3] get_battery_temperature
   0.034202     [D1] Battery Temperature: 248°C
   0.034261     [D3] get_battery_voltage
   0.035675     [D1] Battery Voltage: 3.709V
   0.035733     [D3] get_battery_current
   0.037147     [D1] Battery Current: 0.000A
   0.037214     [D3] get_io_voltage
   0.038638     [D1] Input Voltage: 5.094V
   0.038697     [D3] get_io_current
   0.040122     [D1] Input Current: 0.012A
   0.040181     [D3] get_time
   0.043213     [D1] UPS Time: 00:03:11.45
   0.043287     [D5] send_to_all: SETINFO ups.time "00:03:11.45"
   0.043338     [D1] UPS Date: 2000-01-01
   0.043391     [D3] get_power_off
   0.044572     [D1] Power Off: 127 Seconds
   0.044633     [D3] get_status
   0.045834     [D1] Battery Status: Normal
   0.045903     [D1] Power Input: Not Present
   0.046002     [D1] Power Input 5v: Not Present
   0.046053     [D3] get_charge_level_hi_res
   0.047469     [D1] Battery Charge Level: 51.4%
   0.047530     [D1] On Battery power [0:0:1]
   0.047581     [D3] get_battery_temperature
   0.048994     [D1] Battery Temperature: 248°C
   0.049062     [D3] get_battery_voltage
   0.050476     [D1] Battery Voltage: 3.709V
   0.050534     [D3] get_battery_current
   0.051948     [D1] Battery Current: 0.000A
   0.052007     [D3] get_io_voltage
   0.053434     [D1] Input Voltage: 5.094V
   0.053501     [D3] get_io_current
   0.054924     [D1] Input Current: 0.012A
   0.054983     [D3] get_time
   0.058016     [D1] UPS Time: 00:03:11.43
   0.058090     [D5] send_to_all: SETINFO ups.time "00:03:11.43"
   0.058142     [D1] UPS Date: 2000-01-01
   0.058194     [D3] get_power_off
   0.059374     [D1] Power Off: 127 Seconds
   0.059434     [D3] Entering dstate_dump
Network UPS Tools - PiJuice UPS driver 0.9 (2.7.4-4385-g2bd17f540)
Warning: This is an experimental driver.
Some features may not function correctly.

battery.capacity: 1.000
battery.charge: 51.4
battery.charge.low: 25
battery.current: 0.000
battery.packs: 1
battery.packs.bad: 0
battery.temperature: 248
battery.type: LiPO
battery.voltage: 3.709
battery.voltage.nominal: 4.180
device.mfr: PiJuice
device.type: HAT
driver.name: pijuice
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/i2c-1
driver.parameter.synchronous: no
driver.version: 2.7.4-4385-g2bd17f540
driver.version.internal: 0.9
input.current: 0.012
input.voltage: 5.094
ups.date: 2000-01-01
ups.firmware: 1.4
ups.mfr: PiJuice
ups.status: OB DISCHRG
ups.time: 00:03:11.43
ups.type: HAT

UPDATE: Strangely, after a couple of days on miniUSB power (although plugged from a laptop - maybe power did not suffice, at least Pi rebooted rather often), the hardwired big battery never went over "battery.charge: 47.6" reading. Popped back the 1820mAh into the PiJuice, and it is quickly growing from ~3 to ~60 by now, with flashing blue-green light near SW1 button, with the same USB connection. It first seemed the batteries are not charging if the USB-C power input is used, but with another cable and another source they do.

tedserreyn commented 4 months ago

just a FYI, install nut-i2c to get the driver for pijuice installed with current debian os (debian 12 bookworm).

thought that should be mentioned as I missed it myself and was going down the path of rebuilding nut to get this to work, until I realized there was a missing package.

root@hostname-pi-proxy:~# upsc -l Init SSL without certificate database pijuice-ups

root@hostname-pi-proxy:~# upsc pijuice-ups Init SSL without certificate database battery.capacity: 1.000 battery.charge: 96.8 battery.charge.low: 25 battery.charger.status: resting battery.current: 0.000 battery.packs: 1 battery.packs.bad: 0 battery.temperature: -232 battery.type: LiPO battery.voltage: 4.128 battery.voltage.nominal: 4.180 device.mfr: PiJuice device.type: HAT driver.name: pijuice driver.parameter.pollinterval: 2 driver.parameter.port: /dev/i2c-1 driver.parameter.synchronous: auto driver.version: 2.8.0 driver.version.internal: 0.10 input.current: 2.987 input.voltage: 5.227 ups.date: 2024-03-25 ups.firmware: 1.6 ups.mfr: PiJuice ups.status: HB OL ups.time: 22:28:16.44 ups.type: HAT