Giter Site home page Giter Site logo

homebridge-nut's Introduction

Homebridge-nut

NPM Version

NUT (Network UPS Tools) Plugin for Homebridge leveraging node-nut.

This plugin allows you to monitor your UPS's with HomeKit and Siri via a NUT Client.

Installation

  1. Install homebridge using: npm install -g homebridge
  2. Install this plugin using: npm install -g homebridge-nut
  3. Update your configuration file like the example below.
  4. Ensure you have a NUT Client running somewhere. For assistance - http://wynandbooysen.com/raspberry-pi-ups-server-using-nut.html.

This plugin will create a ContactSensor element with BatteryService for each USB returned from your NUT Client.

  • ContactSensorState will show OPEN if UPS Status starts with OB (On Battery).
  • StatusActive will be true if UPS Load is > 0.
  • StatusFault will be true is NUT is not reachable.
  • BatteryLevel will show the BatteryCharge percent.
  • ChargingState will show Charging, Not Charging (Online and 100%), or Not Chargable (On Battery).
  • StatusLowBattery will be true if low_batt_threshold is breached. This can potentially notify you prior to your Nut shutting down its server(s).
  • Input/Output/Battery Voltage & BatteryLoad will be shown if available, otherwise may show 0 or default values.

Configuration

Example config.json:

"platforms": [
     {
         "platform": "Nut",
         "name": "Nut",
         "host": "localhost",
         "port": "3493",
         "search_time_delay": "1",
         "acc_delay": "100",
         "low_batt_threshold": "40",
         "polling": "120"
     }
]

Explanation:

Field Description
platform Required - Must always be "Nut".
name Required - Name for platform logging.
host Optional - Internal ip or hostname of Nut Client. Default is localhost.
port Optional - Port which Nut Client is listening. Default is 3493.
search_time_delay Optional - Delay on startup to list Nut devices. Defaults to 1 second.
acc_delay Optional - Delay to prevent communication collisions for multiple UPS accessories. Defaults to 100 milliseconds.
low_batt_warning Optional - Percent at which UPS will raise low battery. Default is 40.
polling Optional - Poll interval. Default is 0 sec, which is OFF or no polling.

homebridge-nut's People

Contributors

caribsky avatar jsmeyers avatar toddgreenfield avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

homebridge-nut's Issues

Notification not correctly supported

Hi again,
i installed and am using homebridge with your NUT plugin successfully.

However, when the UPS power switches on battery, the ios Home app displays a notification only when it is opened. It is the issue discussed here:
homebridge/homebridge#1006

The answer of homebridge owner seems to be "the plugin is not using notification correctly".
As you are the plugin owner, do you confirm this ?

Warning to developer with Homebridge 1.0.0

I get a warning with the latest homebridge. I had a similar error report for one of my own plugins (trailing dash in the "name" field of package.json) but the nut package.json looks correct.

[4/27/2020, 2:37:24 PM] Loaded plugin: homebridge-nut
[4/27/2020, 2:37:24 PM] Plugin 'homebridge-nut' tried to register with an incorrect plugin identifier: 'homebridge-nut-accessory'. Please report this to the developer!
[4/27/2020, 2:37:24 PM] Registering accessory 'homebridge-nut.NutAccessory'
[4/27/2020, 2:37:24 PM] Registering platform 'homebridge-nut.Nut'

I've never built a platform plugin so my knowledge is close to 'null'. In index.js I see you export both the accessory and the platform. Shouldn't the export/registration of the platform automatically register the accessory?

Cheers

Error: This callback function has already been called by someone else; it can only be called one time.

Hello,

As homebridge boots I get:

[2018-2-23 10:50:13] [SERVER_UPS] Received Nut accessory ROUTER_UPS (Server UPS) from the SERVER_UPS platform.
[2018-2-23 10:50:13] [SERVER_UPS] Received Nut accessory SERVER_UPS (SERVER UPS) from the SERVER_UPS platform.
[2018-2-23 10:50:13] [SERVER_UPS] Nut Error: ERROR getting UPSVars: Other communication still running

......

[2018-2-23 10:50:52] Homebridge is running on port 51826.

/homebridge/node_modules/node-nut/node-nut.js:74
callback(vars, null);
^
Error: This callback function has already been called by someone else; it can only be called one time.
at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/util/once.js:12:13
at /homebridge/node_modules/homebridge-nut/index.js:66:7
at /homebridge/node_modules/homebridge-nut/index.js:112:6
at /homebridge/node_modules/node-nut/node-nut.js:99:4
at parseKeyValueList (/homebridge/node_modules/node-nut/node-nut.js:74:4)
at Nut.parseFunc (/homebridge/node_modules/node-nut/node-nut.js:97:3)
at Socket. (/homebridge/node_modules/node-nut/node-nut.js:33:9)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)

My 2 UPS are working perfectly with other monitoring tools that are based on upsc.

Occasional Error in the log.

Hello,
I am seeing this error occasionally in the log but everything is working as it should be.
What could be the problem?
Nut Error: ERROR getting UPSVars: Other communication still running

config is set like this:
{
"platform": "Nut",
"name": "ups",
"host": "localhost",
"port": "3493",
"search_time_delay": "1",
"acc_delay": "100",
"low_batt_threshold": "40",
"polling": "120"
}

UPS is APC SRT5KXLI Smart-UPS SRT 5000VA 230V
connected to the ethernet switch.
Native NUT is running on a synology NAS DS1815+
UPS is connected to NAS with SNMP v2c.
Homebridge running on the same synology NAS with docker.

Voltage, Freq from UPS

Plugin should show parameters from UPS like input voltage, input frequency... all needed data is available through NUT

Eaton Protection Station support

I have an Eaton Protection Station 650 and I want to integrate it in Homekit.
First to obtain a notification when power failure occurs and next to integrate the event in automatisation.
On a fresh raspberryPI2, I installed Jessie, a standalone default nut, home bridge and the plug in.
The PI in powered by the Eaton and is also connected to it with USB cable.
I did the integration on iOs with Apple Home app but I tried also Eve app.
Everything was easy and seems to work; I disconnected the input power to understand more.

Running test.js, I discovered that input.voltage was not present (the main problem)
and also battery.voltage, ups.temperature

the ups.status is only OL during charging

I join a test.js output file after power reconnection.

eaton.txt

I have the impression it is better in place of input.voltage checking to see if ups.status starts with OL or OB to know if the power is obtained with the battery or not.

build error with node v8.2.1

Hi, I got lots of build errors with node v8.2.1 (and it doesn't install at all), is there any chance we can get updated package compatible with this version.
I have node-gyp version v3.8.0
I have node version v8.2.1

thank you!!

Remote Monitoring

Can you monitor a remove nut server or must the server be running locally on the machine that homebridge is running on.

If you, how can you add a username a password for remote monitoring?

Freezings with Homebridge 1.0

Hi.
I'v recently updated Homebridge and I'm experiencing freezings. I suspect it'd be Nut related... If I remove this accessory freezings are gone...
Chances for recompiling/updating the plugin?

thanks!

Plugin 'homebridge-nut' tried to register with an incorrect plugin identifier: 'homebridge-nut-accessory'. Please report this to the developer!

[6/29/2020, 3:29:35 PM] Loaded plugin: [email protected]
[6/29/2020, 3:29:35 PM] Plugin 'homebridge-nut' tried to register with an incorrect plugin identifier: 'homebridge-nut-accessory'. Please report this to the developer!
[6/29/2020, 3:29:35 PM] Registering accessory 'homebridge-nut.NutAccessory'
[6/29/2020, 3:29:35 PM] Registering platform 'homebridge-nut.Nut'

Everything works great, but can you please update this plugin to be aligned with the new homebridge rules?

Can't get it to start

Probably missing something elementary, thought it may have been a username/password issue, but I just get an immediate crash and this is the first error it throws.

/homebridge-nut/node_modules/node-nut/node-nut.js:71
vars[matches[1]] = matches[2];

Any Idea where I'm going wrong here?

UPS not showing as a Power Point in HomeKit

Not sure how to fix this but using your code in Homebridge and in HomeKit its gives me the options of:

Blinds
Contact Sensor
Door
Garage Door
Window

Not option for power!

Any ideas how to correct this?

Missing parameters

Hi,

thank you so much for this great plugin, it should be very useful.

I configured my config.json with this:

...
{
         "platform": "Nut",
         "name": "Nut",
         "host": "localhost",
         "port": "3493",
         "search_time_delay": "1",
         "low_batt_warning": "40",
         "polling": "120"
}
... 

but when I start home bridge I found

[8/14/2017, 11:17:04 AM] Loading 0 accessories...
Scan this code with your HomeKit App on your iOS device to pair with Homebridge:
                        
      
                        
[8/14/2017, 11:17:06 AM] Missing parameters.
[8/14/2017, 11:17:07 AM] Homebridge is running on port 51826.

Why "Missing parameters" ? In fact home bridge is not showing any new ups device in homelike.

Thank you

Constant Reconnects

Hey,

many thanks for your plugin.

I do have reconnects to the nut service on my synology every few minutes (or every minute).

Also the device is reported as "description unavailable", but I cannot change this in the synology.

Any idea why or how to overcome this issue?

Greets

//log:

[8/9/2017, 8:34:29 PM] [Nut] Nut eventDisconnect occured.
[8/9/2017, 8:35:26 PM] [Nut] Nut is Polling for Description unavailable...
[8/9/2017, 8:35:26 PM] [Nut] Nut checking connection to Nut Server for Description unavailable.
[8/9/2017, 8:35:26 PM] [Nut] Nut NOT connected, attempting 1st reconnection attempt...
[8/9/2017, 8:35:26 PM] [Nut] Nut eventReady received. Successful reconnect after disconnection.
[8/9/2017, 8:35:28 PM] [Nut] Nut request to get vars for Description unavailable.
[8/9/2017, 8:36:29 PM] [Nut] Nut eventDisconnect occured.
[8/9/2017, 8:37:26 PM] [Nut] Nut is Polling for Description unavailable...
[8/9/2017, 8:37:26 PM] [Nut] Nut checking connection to Nut Server for Description unavailable.
[8/9/2017, 8:37:26 PM] [Nut] Nut NOT connected, attempting 1st reconnection attempt...
[8/9/2017, 8:37:26 PM] [Nut] Nut eventReady received. Successful reconnect after disconnection.
[8/9/2017, 8:37:28 PM] [Nut] Nut request to get vars for Description unavailable.
[8/9/2017, 8:38:29 PM] [Nut] Nut eventDisconnect occured.
[8/9/2017, 8:39:26 PM] [Nut] Nut is Polling for Description unavailable...
[8/9/2017, 8:39:26 PM] [Nut] Nut checking connection to Nut Server for Description unavailable.
[8/9/2017, 8:39:26 PM] [Nut] Nut NOT connected, attempting 1st reconnection attempt...
[8/9/2017, 8:39:26 PM] [Nut] Nut eventReady received. Successful reconnect after disconnection.
[8/9/2017, 8:39:28 PM] [Nut] Nut request to get vars for Description unavailable.
[8/9/2017, 8:40:29 PM] [Nut] Nut eventDisconnect occured.
[8/9/2017, 8:41:26 PM] [Nut] Nut is Polling for Description unavailable...
[8/9/2017, 8:41:26 PM] [Nut] Nut checking connection to Nut Server for Description unavailable.
[8/9/2017, 8:41:26 PM] [Nut] Nut NOT connected, attempting 1st reconnection attempt...
[8/9/2017, 8:41:26 PM] [Nut] Nut eventReady received. Successful reconnect after disconnection.
[8/9/2017, 8:41:28 PM] [Nut] Nut request to get vars for Description unavailable.
[8/9/2017, 8:42:30 PM] [Nut] Nut eventDisconnect occured.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.