networkupstools / nut

The Network UPS Tools repository. UPS management protocol Informational RFC 9271 published by IETF at https://www.rfc-editor.org/info/rfc9271 Please star NUT on GitHub, this helps with sponsorships!
https://networkupstools.org/
Other
2.12k stars 355 forks source link

Temperature not reported for SMT1500i #2489

Open cristianstoica opened 5 months ago

cristianstoica commented 5 months ago

Do I need a different firmware or is there a different issue? https://networkupstools.org/ddl/APC/Smart-UPS_1500.html shows battery.temperature variable but I don't see it on the status page.

"status": { "battery.charge": "100", "battery.charge.low": "10", "battery.charge.warning": "50", "battery.runtime": "20100", "battery.runtime.low": "120", "battery.type": "PbAc", "battery.voltage": "27.4", "battery.voltage.nominal": "24.0", "device.mfr": "American Power Conversion ", "device.model": "Smart-UPS 1500", "device.serial": "AS1239220678 ", "device.type": "ups", "driver.name": "usbhid-ups", "driver.parameter.pollfreq": "30", "driver.parameter.pollinterval": "2", "driver.parameter.port": "auto", "driver.parameter.synchronous": "auto", "driver.parameter.vendorid": "051d*", "driver.version": "2.8.0", "driver.version.data": "APC HID 0.98", "driver.version.internal": "0.47", "driver.version.usb": "libusb-1.0.26 (API: 0x1000109)", "ups.beeper.status": "enabled", "ups.delay.shutdown": "20", "ups.firmware": "UPS 08.3 / ID=18", "ups.mfr": "American Power Conversion ", "ups.mfr.date": "2012/09/24", "ups.model": "Smart-UPS 1500", "ups.productid": "0003", "ups.serial": "AS1239220678 ", "ups.status": "OL", "ups.timer.reboot": "-1", "ups.timer.shutdown": "-1", "ups.vendorid": "051d" },

jimklimov commented 5 months ago

Not really sure here. Probably a discrepancy between what the device reports and how the NUT driver interprets the data. Chances are, the different model of device (or version of the firmware) just does not sense and report that data point, or they moved it to some other report descriptor which we do not look into.

According to sources, in drivers/apc-hid.c we look at "UPS.Battery.Temperature" report descriptor. Other vendors have it in e.g. "UPS.BatterySystem.Temperature", "UPS.BatterySystem.Battery.Temperature" or "UPS.PowerSummary.Temperature, or even in vendor extensions like "UPS.EVER1.EVER43" or "PowercomUPS.PowercomBatterySystem.PowercomTemperature"...

I am not fully sure OTOH if USB HID subdrivers allow several mappings for the same data point (in powercom-hid.c it seems to be the case); many other NUT drivers do support this to adapt to mostly-similar device nuances in the field. Maybe a rebuild of your driver with a few added lines for these other possible common report descriptor names would help.

As an experiment, can you cross-check it with some other software (apcupsd or some vendor tool)? Is there some LCD panel that would report the value (so we'd know it is at all available)?

jimklimov commented 5 months ago

FWIW, https://github.com/networkupstools/nut/wiki/Building-NUT-for-in%E2%80%90place-upgrades-or-non%E2%80%90disruptive-tests can help about the NUT-building part, if you dare :) Should not be difficult, just needs many prerequisite/tool packages installed for the job.

Also, your post was in JSON. NUT tools do not emit it so far; is your use of NUT further wrapped by some HA/Storage/etc. platform?

cristianstoica commented 5 months ago

Indeed, using HA NUT add on https://github.com/hassio-addons/addon-nut (based on 2.8.0) version. However, battery temperature seems to have been available since (at least) 2.7.1.

jimklimov commented 5 months ago

In that case https://github.com/networkupstools/nut/wiki/Building-NUT-integration-for-Home-Assistant from community members could also help with a custom build.