[RELEASE] Network UPS Tools (NUT) monitor and shutdown controller (upsmon)

Thank you, much appreciated and interesting reading.

Ideally I guess I should set up a NUT server on my unused pi 3. However, it seems to me that the primary issue I'm facing (HE hubs in limbo until manually restarted) is somewhat of an edge case in that power needs to be restored during the relatively short window between the time the hubs are told to shut down and the time the UPS actually runs out of power.

Setting up NUT on a pi is probably not all that big of a deal, but I could also solve the issue by putting the whole network rack on a z-wave switch paired to my alarm system. My alarm system is rock solid and only depends on the cell network, so if this happens again I could just shut down the whole network for 20 minutes or so until the UPS runs dry.

Maybe I'll do both; being able to remotely toggle power to the entire network might come in handy someday for other reasons.

14 posts were split to a new topic: Discussion on RMCARD205 card for CyberPower OR500LCDRM UPS

Hi @dennypage

I've seen things here on the forum that may be similar to my situation, but I can't identify the problem if you can help me?

dev:1572025-01-23 08:41:28.251 PMinfo
connected to upsd on 192.168.50.8:3493 - monitoring TrippLite every 30 seconds
dev:1572025-01-23 08:40:58.205 PMerror
telnet connect error: java.net.ConnectException: Connection refused (Connection refused)
dev:1572025-01-23 08:40:28.177 PMerror
telnet connect error: java.net.ConnectException: Connection refused (Connection refused)
dev:1572025-01-23 08:40:00.258 PMinfo
disconnected from upsd
dev:1572025-01-23 08:40:00.227 PMerror
telnet status: receive error: Stream is closed
dev:1572025-01-23 08:40:00.183 PMwarn
upsd: Stale data
dev:1572025-01-23 08:40:00.168 PMwarn
upsd: Stale data
dev:1572025-01-23 08:40:00.153 PMwarn
upsd: Stale data
dev:1572025-01-23 08:40:00.137 PMwarn
upsd: Stale data

The UPS goes into Stale Data, and the only way to get it back is to stop and restart the service.

systemctl stop nut-server
systemctl start nut-server

I ended up putting it in the crontab to do this operation every 10 minutes, because I can't get it to work. Sometimes it goes on for an hour without a problem, but I spend most of the day in this situation, and thus without proper monitoring.

I've tripled the parameter times in all the NUT configurations, and in the case of HOSTSYNC it's 30s.

Any recommendations on what I can check?

Thanks.

These indicate that you have a UPS driver to UPS or driver to upsd communication problem. What I would do:

  1. Put everything in the NUT configuration on your server back to normal.
  2. Start the UPS driver by hand in debug mode and see what it says.

Please, could you help me explain how to set it to debug? Thanks.

A bit outside the bounds of the Hubitat driver, however you can find example instructions here. For followup on the diagnostics, you probably should head to the NUT user list.

1 Like

I just pushed an update that implements a backoff for connection attempts to avoid log flooding. Shout out to @hubitrep for the idea and the push. :slight_smile:

2 Likes

I want to make a request. I couldn't find this in the thread. If it's there, please point me to it. Is there any way to expose the upsd connect state as an attribute that rule machine could access? I would like to make a rule that notifies me that the upsd connection is not “true” because sometimes I find it not connected and therefore the power rules are not trustworthy. It would also help me troubleshoot why sometimes I see this in a non-connected state. If you wanted to take this request to the next level you could write a routine that automatically sends a message to either pushover or some other notification message methodology when upsd connection is not true after so many attempts or after a period of time.

I would love to hear your thoughts on this.

LJ

You can determine if the device is connected by either the powerSource attribute. If there is not an active connection, the value will be 'unknown'.

You can also look at the status attribute, but that is slightly more complicated.

Yes, thanks for the reply. I have looked at at the code and I can use those. I just thought it might be more straightforward to get the direct message from the Upsd.connect string than those but if that is reliable then that is good. Will the power source always be unknown if upsd state is other than true? If so then I can rely on that.

I do not understand what this refers to.

Power source will be one of:

  • unknown
  • mains
  • battery

You will see 'unknown' if the hub driver has no connection to upsd or if upsd does not know the state of the UPS. Otherwise, you will see 'mains' or 'battery'.

1 Like

Thanks Denny!

1 Like