[DRIVER] NUT Discovery + UPS & Outlet Status

For the record the nut server I'm connecting to (running on a synology) acted like it was timing out until I didn't put a username/password in. You might try it with those blank.

Once it said it was getting ups names now just waiting for events. It should be giving me the status and other info correct?

That is without a usernamd and password

What a difference the night makes. My impatience to see the UPS found in HE was rewarded this morning! Thank you so much for this effort!!

A couple of questions:

  1. There are some attributes from NUT that aren't passed to the Child. Here is what I get from running NUT
    battery.charge: 100
    battery.charge.low: 10
    battery.charge.warning: 50
    battery.date: 2001/09/25
    battery.mfr.date: 2012/04/02
    battery.runtime: 36000
    battery.runtime.low: 120
    battery.type: PbAc
    battery.voltage: 13.7
    battery.voltage.nominal: 12.0
    device.mfr: American Power Conversion
    device.model: Back-UPS ES 750G
    device.serial: 3B1214X00646
    device.type: ups
    driver.name: usbhid-ups
    driver.parameter.pollfreq: 30
    driver.parameter.pollinterval: 2
    driver.parameter.port: auto
    driver.parameter.synchronous: no
    driver.version: 2.7.4
    driver.version.data: APC HID 0.96
    driver.version.internal: 0.41
    input.sensitivity: high
    input.transfer.high: 136
    input.transfer.low: 96
    input.transfer.reason: input voltage out of range
    input.voltage: 124.0
    input.voltage.nominal: 120
    ups.beeper.status: enabled
    ups.delay.shutdown: 20
    ups.firmware: 841.I4 .D
    ups.firmware.aux: I4
    ups.load: 0
    ups.mfr: American Power Conversion
    ups.mfr.date: 2012/04/02
    ups.model: Back-UPS ES 750G
    ups.productid: 0002
    ups.realpower.nominal: 450
    ups.serial: 3B1214X00646
    ups.status: OL
    ups.test.result: No test initiated
    ups.timer.reboot: 0
    ups.timer.shutdown: -1
    ups.vendorid: 051d
    For Instance if I wanted to add battery voltage and UPS real Power nominal Where would I do that? And the other thing that comes to mind is the Status message for instance: OnLine and mains to indicate that the UPS is online and that it is powered by the mains.

Don't know if this can happen or not. I tried to setup a RM notification for when it switches to battery, but there is nothing to work with in RM for the UPS Child.

Anyway thanks so much for sharing, My opinion this is a great idea!!

Open live logs, and turn on debugging on the Child UPS device, you'll see any variables that the driver doesn't display scroll by. The request gets everything then uses a series of case statements to display the relevant/useful ones.

@guyeeba or myself or you could easily add others, but it does run into a bit of an issue in general:

Different UPS's put out different parameters, so we'd likely need to create different sets of support variables per device mfr/model combos.

If you want to add a few specific ones look in the child driver for the case statements (it takes the variables and breaks them up using period as the breakpoint, so it flips through all the battery variables, then all the device variables etc). Just follow the pattern and add an attribute and set it within the loops.

I'll probably add battery.voltage and ups.realpower.nominal too, as they seem to generally be available for most UPS's based on a quick search. I think the nominal real power would be useful as HE supports doing a few things with power readings.

As for the RM, that's something that we need to add something addition for as Hubitat can't yet use any of the parameters that are defined as triggers for rules. They have stated that adding "powersource" is on the to do list, but there are a few easy work arounds I should be able to get in this weekend so you can have rules triggered when the power goes out (which was my ultimate goal).

We should also create a little how to, @guyeeba's method of auto-adding is slick but doesn't tell you that it added UPS's as children to go look at, which sounds like caught you up for a bit.

Thanks Chris

I figured that there would be some "missing" stats people would want. Its not like there are only a couple of UP manufacturers out there. Anyway I was gifted this one and I am not going to look that horse in the mouth. I will look at the Child driver to see what I can do. Yeah the RM notification was / is a goal for me as well. Knowing when all my stuff is without power is some good info.

Looking at the live logs I see that my telnet session is not connecting. In fact th eChild isn't listed in live logging. Do I need to figure out how to have the Pi allow a non-authenticated telnet session? The Parent askes for the NUT user/password but nothing for the telnet session itself.

Thanks alot!

I just uploaded a version that supports batteryVoltage. And moved inputVoltage to voltage, so now it properly implements the VoltageMeasurement capability...

2 Likes

In fact it's not a telnet connection t your raspi, just a TCP socket to NUT's port. Can you open the NUT port (3493 by default) on your raspi with telnet/putty?

Using putty /telnet on port 3493 I get an "error command unknown" I am assuming that means it is open ?

After some fiddling around and leaving the user/password blank in the parent setup, I am now getting info in the live log and the dashboard is updating.
Thanks guys for all your help. I might tweek the info for my UPS.

I just uploaded a new version that authenticates properly to NUT... 10 hours late... :slight_smile:

:smiley::smiley::smiley::smiley:

Thank you for saying this. I found my old config of a PC I have receiving broadcasts from my NAS and I got HE connected to my NAS. I now just need to edit the code to parse the details provided by my NAS but this is great that I can now integrate these two.

@guyeeba thank you for posting this code!

1 Like

I put together the simplest app I could to notify me when the powerSource changes since it's not availalbe in RM/HSM. You can find it here: [Release] Send Alert when powerSource changes

I need to preface this by saying I know nothing Jon Snow, about NUT UPS's.

That said, I've got it working with my synology NAS. I have an EATON UPS. I tried firstly with passwords, based on this website, indicating usernames/passwords, which worked, but some errors. Then I tried without passwords/usernames, and got the same errors.

Are you experts able to help a newbie.

Is it normal to have that much logging, every 10 seconds? I realise I can turn off debug logging, but still that's a lot of stuff going on behind the scenes, every 10 seconds? Will that bog down my hub?

You may want to try my driver as others with Synology NAS has success using it. You can find a link here and it was based on @guyeeba’s work. He gave me permission to post my own version.

For anyone that has a Cyber Power System CP1500 AVR and you have debian you need to manually create /etc/udev/rules.d/52-nut-usbups.rules with

# set permissions for CyberPower UPS -jea 2010-06-02
SUBSYSTEM=="usb", ATTRS{idVendor}=="0764", GROUP="nut", MODE="0660"

Then plug the usb cable back in.

In your ups.conf file you need

[myups]
      driver = usbhid-ups
      port = /dev/usb/hiddev0
      desc = "My UPS"

Make sure you have MODE=netserver in nut.conf

Thanks, I'll have a look there soon. But maybe you can help with another issue I'm having. I've been using the awesome nodered integration for downloading HE backups. However, I've just got node-red going on my synology NAS. Took a while, since I had to chmod some directories, which was really unsual.

Anway, I can't figure out how to get it to download to the synology NAS. I've got the same flow as previously, just not sure how to structure the syntax.

This is my flow, copied from other node-red thread.

It downloads the backup from HE, but I'm not sure of the syntax in the third node (string).

I've tried
//diskstation etc
\diskstation etc (where etc is the backup path)
/diskstation etc
\diskstation etc
/volume1 etc
/etc

any thoughts? It's driving me crazy. I do have the data files stored outside of the docker container, under docker/nodered, and the backup file is not in there either.

I don’t own a Synology so unsure specific details. In my QNAP I did have to map a share folder when setting up my NodeRed container so it has access to the host NAS. I would expect Synology to have a similar feature. From there the path depends on your folder mapping.

Thank you for writing these drivers. Now I can properly shutdown my hub when my Cyberpower UPS is on battery and gets low. Very helpful!