Homeassistant - Integrate USV
Introduction
I build a relatively large amount of my house distribution and am also
someone who likes to play at the house electrical. Be it new
Plugs, individual connection solutions or other, with me
the house installation is adjusted almost weekly.
♪
not only tech-interessed, but sometimes also a little stupid,
can it happen that the FI could trigger me here and there, or
a LS cuts the circuit (if I didn't do that anyway). From
That is why I had already deported at the beginning,
to operate virtualization computer behind an online USV, which it
allows me to use the technology without grid voltage for at least 30
to operate minutes. It's not much, but it doesn't have to.
I do not want to bridge a power failure (because in this case anyway
nothing would work) but only wants to cushion short current gaps
and finally also protect the technology (a nice side effect of the USV).
I therefore have cheap USV system bought which runs my entire house IT (Router,
Virtualization host, NAS, switch etc.). But it must be said that
a USV *NO* should lead to fewer or no backups
to create! – A good backup strategy is the most important, just
in case of a fault or hardware failure, the
system to be able to recover quickly.
With me, backups are made daily on one SSD so that the data is always available at least twice.
Important
is that a USV is not necessarily against data loss or damage to
to protect PC, a USV has as its main sense the
to supply connected systems with voltage and possibly a safe
to allow shutdown. However, data are not
protected as soon as the USV is empty and the systems are not
have been shut down, the light is also emitted in the devices.
Therefore,
I will show in the following article how to use a USB USV in Homeassistant
can integrate and react to the respective states.
Connection to Homeassistant
In my case, the USV is connected via USB cable. There are
Possibility to integrate the USV via NUT (Network UPS Tools). Thank you
Other Driver support are very many devices supported.
In my case, I need the “Standard USB Driver” – usbhid-ups.
Um...
using the integration we first need the NUT server.
This establishes a connection to the USV and then can the values
pass on.
For this we install the “NUT” addon under “Settings > Addons > Add-ON Store > “NUT”.
Before
the start must be clicked on the rider “Configuration” to
to enter the necessary data. Here you have to follow the documentation
to enter appropriate values, the configuration of the respective
USV’s plus the Trteiber can be found here and here.
My configuration with an EATON Eclipse ECO 650 looks as follows:
devices:
- name: myups
driver: usbhid-ups
port: auto
host: a0d7b954-nut ;Diese Einstellung ermöglicht die direkte Kommunikation zwischen Addon und Integration!
config: []
pollfreq: 2
mode: netserver
shutdown_host: false ;Wenn true wird Homeassistant heruntergefahren
users:
- actions: []
instcmds:
- all
password: AUserPassword
username: AUsername
leave_front_door_open: false ;Username and Password is not required - do not use...
After the configuration is created, the addon can start and the zugehgörige Log should be large green and approx. look:
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/00-banner.sh
-----------------------------------------------------------
Add-on: Network UPS Tools
Manage battery backup (UPS) devices
-----------------------------------------------------------
Add-on version: 0.11.0
You are running the latest version of this add-on.
System: Home Assistant OS
Home Assistant Core: << none >>
Home Assistant Supervisor: << none >>
-----------------------------------------------------------
Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
cont-init: info: running /etc/cont-init.d/02-set-timezone.sh
[18:12:54] INFO: Configuring timezone
cont-init: info: /etc/cont-init.d/02-set-timezone.sh exited 0
cont-init: info: running /etc/cont-init.d/nut.sh
[18:12:54] INFO: Setting mode to netserver...
[18:12:54] INFO: Generating /etc/nut/upsd.users...
[18:12:54] INFO: Configuring user: AUsername
[18:12:55] INFO: Password is NOT in the Have I Been Pwned database! Nice!
[18:12:55] INFO: Configuring Device named myups...
[18:12:55] INFO: Starting the UPS drivers...
Using subdriver: MGE HID 1.40
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
USB communication driver 0.33
Network UPS Tools - UPS driver controller 2.7.4
cont-init: info: /etc/cont-init.d/nut.sh exited 0
cont-init: info: running /etc/cont-init.d/nutclient.sh
cont-init: info: /etc/cont-init.d/nutclient.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun upsd (no readiness notification)
services-up: info: copying legacy longrun upsmon (no readiness notification)
s6-rc: info: service legacy-services successfully started
[18:13:00] INFO: Starting the UPS information server...
0.000000 fopen /run/nut/upsd.pid: No such file or directory
0.000248 listening on 0.0.0.0 port 3493
0.000418 Connected to UPS [myups]: usbhid-ups-myups
[18:13:01] INFO: Starting the UPS monitor and shutdown controller...
0.000000 fopen /run/nut/upsmon.pid: No such file or directory
0.000151 Using power down flag file /etc/killpower
0.000235 UPS: myups@localhost (master) (power value 1)
0.000300 debug level is '1'
0.000473 Init SSL without certificate database
0.001564 Trying to connect to UPS [myups@localhost]
0.499896 User upsmonmaster@127.0.0.1 logged into UPS [myups]
0.002174 Logged into UPS myups@localhost
If this looks so similar, the UPS is configured and will can be requested. Now the device has to be added as “Device” will be, accordingly, next under “Settings > Devices & Services > Add-Integration > “Nut” ” Intergration installed and then host the assigned host or “a0d7b954-nut” specified so that integration speaks directly with the UPS server can. Username and Password are still entered and should display the USV directly. This can be as follows:
For example, if the system automatically shuts down (and that is not enabled in the configuration), you can now by automation, query the state of the battery and the devices one after the other (incl. home assistant) let down or other trigger functions.
Back…