A Network UPS Tools daemon to allow you to easily manage battery backup (UPS) devices connected to your Hass.io machine.
The primary goal of the Network UPS Tools (NUT) project is to provide support for Power Devices, such as Uninterruptible Power Supplies, Power Distribution Units, Automatic Transfer Switch, Power Supply Units and Solar Controllers.
NUT provides many control and monitoring features, with a uniform control and management interface.
More than 140 different manufacturers, and several thousands models are compatible.
The Network UPS Tools (NUT) project is the combined effort of many individuals and companies.
Be sure to add a NUT Sensor to your configuration.yaml
after starting the
add-on:
sensor:
- platform: nut
name: "CyberPower 1500"
host: a0d7b954-nut
username: nutty
password: changeme
resources:
- battery.charge
- battery.runtime
- ups.load
- ups.status
For more information on how to configure the NUT Sensor in Home Assistant see the NUT Sensor documentation.
The installation of this add-on is pretty straightforward and not different in comparison to installing any other Hass.io add-on.
- Add our Hass.io add-ons repository to your Hass.io instance.
- Install the "Network UPS Tools" add-on.
- Configure the
users
anddevices
options. - Start the "Network UPS Tools" add-on.
- Check the logs of the "Network UPS Tools" add-on to see if everything went well.
- Configure NUT Sensor in your
configuration.yaml
file.
NOTE: Do not add this repository to Hass.io, please use:
https://github.com/hassio-addons/repository
.
Even though this add-on is just a basic add-on, it does come with some configuration options to play around with.
Note: Remember to restart the add-on when the configuration is changed.
Network UPS Tools add-on configuration:
{
"log_level": "info",
"users": [
{
"username": "nutty",
"password": "changeme",
"instcmds": [
"all"
],
"actions": []
}
],
"devices": [
{
"name": "myups",
"driver": "usbhid-ups",
"port": "auto",
"config": []
}
],
"upsd": [
"LISTEN 0.0.0.0"
],
"nut": {
"mode": "netserver"
}
}
The log_level
option controls the level of log output by the add-on and can
be changed to be more or less verbose, which might be useful when you are
dealing with an unknown issue. Possible values are:
trace
: Show every detail, like all called internal functions.debug
: Shows detailed debug information.info
: Normal (usually) interesting events.warning
: Exceptional occurrences that are not errors.error
: Runtime errors that do not require immediate action.fatal
: Something went terribly wrong. Add-on becomes unusable.
Please note that each level automatically includes log messages from a
more severe level, e.g., debug
also shows info
messages. By default,
the log_level
is set to info
, which is the recommended setting unless
you are troubleshooting.
This option allows you to specify a list of one or more users. Each user can have its own privileges like defined in the sub-options below.
Refer to the upsd.users(5)
documentation for more information.
The username the user needs to use to login to the NUT server. A valid username
contains only a-z
, A-Z
, 0-9
and underscore characters (_
).
Set the password for this user.
A list of instant commands that a user is allowed to initiate. Use all
to
grant all commands automatically.
A list of actions that a user is allowed to perform. Valid actions are:
set
: change the value of certain variables in the UPS.fsd
: set the forced shutdown flag in the UPS. This is equivalent to an "on battery + low battery" situation for the purposes of monitoring.
The list of actions is expected to grow in the future.
Add the necessary actions for a upsmon
process to work. This is either set to
master
or slave
.
This option allows you to specify a list of UPS devices attached to your system.
Refer to the ups.conf(5)
documentation for more information.
The name of the UPS. The name default
is used internally, so you can’t use
it in this file.
This specifies which program will be monitoring this UPS. You need to specify
the one that is compatible with your hardware. See nutupsdrv(8)
for more information on drivers in general and pointers to the man pages of
specific drivers.
This is the serial port where the UPS is connected. The first serial port
usually is /dev/ttyS0
. Use auto
to automatically detect the port.
A list of additional options to configure for this UPS. The common
usbhid-ups
driver allows you to distinguish between devices by
using a combination of the vendor
, product
, serial
, vendorid
, and
productid
options:
{
...
"devices": [
{
"name": "mge",
"driver": "usbhid-ups",
"port": "auto",
"config": [
"vendorid = 0463"
]
},
{
"name": "apcups",
"driver": "usbhid-ups",
"port": "auto",
"config": [
"vendorid = 051d*"
]
},
{
"name": "foocorp",
"driver": "usbhid-ups",
"port": "auto",
"config": [
"vendor = \"Foo.Corporation.*\""
]
},
{
"name": "smartups",
"driver": "usbhid-ups",
"port": "auto",
"config": [
"product = \".*(Smart|Back)-?UPS.*\""
]
}
],
...
A list of configuration options for the upsd
server. Most users will only
need to use the LISTEN <interface> <port>
option.
Refer to the upsd.conf(5)
documentation for more information.
A set of configuration options for NUT. It is recommended that you do not change these options unless you know what you are doing.
Refer to the nut.conf(5)
documentation for more information.
Recognized values are none
, standalone
, netserver
and netclient
.
none
: Indicates that NUT should not get started automatically, possibly because it is not configured or that an Integrated Power Management or some external system, is used to startup the NUT components.standalone
: Addresses a local only configuration, with 1 UPS protecting the local system. This implies to start the 3 NUT layers (driver,upsd
andupsmon
), with the related configuration files. This mode can also address UPS redundancy.netserver
: Like thestandalone
configuration, but also possibly need one or more specificLISTEN
options inupsd
section. Since this mode is open to the network, a special care should be applied to security concerns.netclient
: When onlyupsmon
is required, possibly because there are other hosts that are more closely attached to the UPS, the mode should be set tonetclient
.
Set upsd
specific options. See upsd(8)
for more details. It is
ignored when mode
above indicates that no upsd
should be running.
Set upsmon
specific options. See upsmon(8)
for more details. It
is ignored when mode
above indicates that no upsmon
should be running.
At the end of an emergency system halt, the upsmon
master will signal the UPS
to switch off. This may fail for a number of reasons. Most notably is the case
that mains power returns during the shutdown process. The system will wait this
long for the UPS to cut power, and then reboot. It should be long enough to
exhaust the batteries, in case line power continues to be unavailable. On the
other hand, it should not be so long that the system remains offline for an
unreasonable amount of time if line power has returned. See sleep(1)
for compatible time syntax. If you specify the time in seconds, use the s
suffix.
Adding this option to the add-on configuration allows to you bypass the
HaveIBeenPwned password requirement by setting it to true
.
Note: We STRONGLY suggest picking a stronger/safer password instead of using this option! USE AT YOUR OWN RISK!
Adding this option to the add-on configuration allows you to disable
authentication on the NUT server by setting it to true
and leaving the
username and password empty.
Note: We STRONGLY suggest, not to use this, even if this add-on is only exposed to your internal network. USE AT YOUR OWN RISK!
This repository keeps a change log using GitHub's releases functionality. The format of the log is based on Keep a Changelog.
Releases are based on Semantic Versioning, and use the format
of MAJOR.MINOR.PATCH
. In a nutshell, the version will be incremented
based on the following:
MAJOR
: Incompatible or major changes.MINOR
: Backwards-compatible new features and enhancements.PATCH
: Backwards-compatible bugfixes and package updates.
Got questions?
You have several options to get them answered:
- The Community Hass.io Add-ons Discord chat server for add-on support and feature requests.
- The Home Assistant Discord chat server for general Home Assistant discussions and questions.
- The Home Assistant Community Forum.
- Join the Reddit subreddit in /r/homeassistant
You could also open an issue here GitHub.
This is an active open-source project. We are always open to people who want to use the code or contribute to it.
We have set up a separate document containing our contribution guidelines.
Thank you for being involved! 😍
The original setup of this repository is by Dale Higgs.
For a full list of all authors and contributors, check the contributor's page.
Want some more functionality to your Hass.io Home Assistant instance?
We have created multiple add-ons for Hass.io. For a full list, check out our GitHub Repository.
MIT License
Copyright (c) 2018-2019 Dale Higgs
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.