Network UPS Tools (nut) setup issues

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

HI Mihai, have you seen this error before with regards to the NUT and your .js script to convert run tme? Only occurs during bootup of OH2

Failed transforming the state 'NULL' on item 'UPS_Battery_Runtime' with pattern 'JS(duration_from_seconds.js):%s': An error occurred while executing script.

Hey all, I just wanted to say thanks for this discussion. I set up a UPS on my openHAB Pi tonight, and picked up a lot of great info here.

I started writing a tutorial to help others through the process (starting with installation of NUT). Iā€™ll be sure to tag all you if and when I publish it.

Hi @Mihai_Badea do you know what id ned to change in your transform js to stop the null errors when the string is empty/null?

Thanks

Hi all,

I benefited a lot from this thread when I was setting up NUT, and Iā€™ve written an installation guide that relies heavily on it (as well as some other things Iā€™ve picked up from the Web). If you have any comments or suggestions, Iā€™d love to hear them.

Thanks to everyone for your efforts!

1 Like