Network UPS Tools (nut) setup issues

this has something to do with the JS transformation
is the addon installed on your OH2 system?
You also need the actual JS file (duration_from_seconds.js)

Yes Sir, its installed. 1050 is the run time in seconds.

Then Mihai should share with you the duration_from_seconds.js contents :slight_smile: (to be placed under $OPENHAB_CONF/transform/ folder)

1 Like

Yes haha! just realised that :smiley: @Mihai_Badea

1 Like

I use 2 Items and a rule to do this: Ubiquiti Unifi Binding Feature Discussion

but it should be better with a JS xform

/etc/openhab2/transform/duration_from_seconds.js:

// computes nicely formatted duration from given seconds
(function(i){

        var date = new Date(null);
        date.setSeconds(parseInt(i)); // specify value for SECONDS here
        return date.toISOString().substr(11, 8);

})(input)

:laughing:

2 Likes

QNAP UPS info:
image

OH UPS section - BasicUI:

1 Like

Wow over 1 hr!! Thats impressive. Ive got a 1500VA unit and mines 18 minutes :smiley:

Its powering a Cisco 3945 with UCS module, QNAP 880 and a Cisco 2960 :stuck_out_tongue:

The important thing here is estimated protection time :laughing:
I had a power outage a few weeks ago, in the middle of the night…
Funny stuff… The beeper of the UPS was enabled (at that time) and I had to wait for the battery to run out to get rid of the alert beeps.
I wasn’t over an hour… maybe 50 minutes, but those were the longest 50 minutes of my life. Cursing the damn beeper cause I wasn’t able to close my eyes :laughing: :laughing: :laughing:
The power came back 15 minutes after the battery ran out and guess what? As I couldn’t sleep anymore I had to disable the beeper to prevent future wake-ups :slight_smile:

1 Like

hahah! :slight_smile: Mines in the garage, where i wont hear it!

Has anyone configured NUT client on another unix box?? I cant get it to function either.

I added the user in and also defined the mode as slave…

Network UPS Tools upsmon 2.7.2
fopen /var/run/nut/upsmon.pid: No such file or directory
Unable to use old-style MONITOR line without a username
Convert it and add a username to upsd.users - see the documentation
Fatal error: unusable configuration

Hi Guys

Is this Network UPS Tools binding meant to accept shutdown signals from the Master NUT server (in this case, the QNAP NAS) or does it ONLY monitor the status of the UPS health?

I just tried a test shutdown and it didnt signal my OH2 box to shutdown

:frowning:

The Binding is for monitoring purposes only.

You need a local NUTS deployment and upsmon.conf configured to shutdown the O/S on the host where OH2 is running.

1 Like

Roger Dim, figured as much. I’ve managed to get it working now, it seems to see On Battery & On Power Events but doesnt shut the OH2 box down. More troubleshooting! sigh

1 Like

you could configure a rule to shutdown your localhost running OH2 but it’s better to use the NUTS tools for this

rule	"UPS Rules"
	when
		Item	UPS_Status	changed	from	OL	to OB
	then
		sendMail("santa@claus.com", "Home UPS", "Home lost mains power! Servers on UPS Battery !!!")
        sendPushoverMessage(pushoverBuilder("Home lost mains power! Running on UPS Battery !!!").withEmergencyPriority())
        <timer>... (with cancel timer if it comes back to OL (Online from OB=On Battery))
                <some stuff like shutdown selected PoE ports on a Switch to lower power consumption, etc>
                <exec action to call a shutdown.sh script>
end

Thanks, i didnt have the UPS status channel! I do now :smiley:

1 Like

Dim, this should be enough to translate OL and OB to Online and On Battery, right? Because I will use these more common names when displaying the ItemValue in HabPanel.

String UPS_Status "UPS Status [MAP(en.map):%]" (gUPS) {networkupstools="ups1:ups.status"}

en.map


CLOSED=closed
OPEN=open
NULL=unknown
Gate_status=The Rear Gate
Gate_status_Timer=The Rear Gate
Garage_status=The Garage Door
Garage_status_Timer=The Garage Door
OL=Online
OB=On Battery

yeah, should be enough

I use separate *.map files and my UPS.map looks like:

LB=Low Battery
OB=On Battery
OL=Online
NULL=Unknown

It also depends on what your UPS can report as status options. These are the 3 that my specific unit spits out.

Fair enough, I’m using en.map for just english translations.

Doesnt appear to convert it though in HabPanel. It still shows OL instead of Online.

<div class="sectionIconContainer"><div class="sectionIcon"><svg viewBox="0 0 48 48"><use xlink:href="/static/matrix-theme/squidink.svg#drive"></use></svg></div></div>
	<div class="title">UPS - {{itemValue('UPS_Status')}}</div>
	<div class="controls">

strange
I just tried your widget template code and it works for me:
image

<div class="title">UPS - {{itemValue('UPS_Status')}}</div>

make sure that you *.map is working
test it out in a sitemap to see if the label changes

1 Like

Fixed it by using the site map :wink:

1 Like