Skip to main content

Integrating NUT into openHAB

 


Background

This article describes the steps necessary for integrating a NUT installation on a Raspberry Pi into openHAB for a GreenCell USB UPS. For setting up NUT on a Raspberry Pi see here.

Install openHAB Network UPS Binding

For details of the Binding see openHAB documentation here.

Log into the openHAB Web Console as Administrator.

Click on Settings:


Select Bindings:

Select the Binding "Network UPS", you may need to click on "Show xxx More" in the list under the heading "openHAB Distribution":


Click on "INSTALL" (here is shown "REMOVE" as I already installed it).

Once the binding has been installed click on Things:



Click on the Add icon in the bottom right hand corner of the page: 

Click on "Network UPS Tool" in the list of "Choose Binding":

Click on "Network UPS Tool Thing" in the list of "Add a new Thing: networkupstools":

In the following screen input values for "Location", "Device" name, "Username", "Password" and "Port": 


Select Save (Ctrl S).

Selecting the "Network UPS Tool Thing" again the status should be online:

Select "Channels":

Copy the UUID (small icon to the right of the property) for the following channels and insert in the Network UPS items file in /etc/openhab/conf:

Note in the following the text "ups8fbc111bd7" after "channel='networkupstools:" should be replaced with your own thing ID:


/************************************************************************************/
/* Device: Green Cell USB UPS */
/* Description: USB UPS System for System Protection */ 
/************************************************************************************/
Group gups "Green Cell UPS" <network> (hall, status)
Number:Dimensionless ups_battery_charge "Battery Charge [%d %%]"<battery>(gups){channel="networkupstools:ups:8fbc111bd7:batteryCharge"}
Number:ElectricPotential ups_battery_voltage "Battery Voltage [%.1f V]" <chart>(gups){channel="networkupstools:ups:8fbc111bd7:batteryVoltage"}
Number:ElectricPotential ups_input_voltage "Input Voltage [%.1f V]" <poweroutlet> (gups)
{channel="networkupstools:ups:8fbc111bd7:inputVoltage"}
Number:ElectricPotential ups_output_voltage "Output Voltage [%.1f V]" <poweroutlet> (gups) {channel="networkupstools:ups:8fbc111bd7:outputVoltage"}
String ups_alarm "Alarm" <error> (gups) {channel="networkupstools:ups:8fbc111bd7:upsAlarm"}
Number:Dimensionless ups_load "UPS Load [%d %%]" <battery> (gups)
{channel="networkupstools:ups:8fbc111bd7:upsLoad"}
String ups_status "UPS Status" <status> (gups)
{channel="networkupstools:ups:8fbc111bd7:upsStatus"}
String ups_test_result "UPS Test Result" <status> (gups)
{channel="networkupstools:ups:8fbc111bd7:upsTestResult"}












Comments