Okay, perhaps it goes into yaml instead of a file for home automation purposes. My file is located at /etc/nut/ups.conf
and I found it by running the command find /etc -name ups.conf
. Maybe find /usr -name ups.conf
would be right on other systems.
My file has a config similar to above. It also has a lot of explanation of other parameters. Maybe the documentation will be useful for you in the future? I’ll include the whole file below. You’ll see that I also have a productid
, though no vendorid
. Anyway, the productid
is unique among all the USB devices on my system so maybe that’s enough to specify it. I’m able to see the list of all connected USB devices along with their IDs by typing lsusb
.
Here’s my file, maybe some of the other options will be interesting to you, too?
# Network UPS Tools: example ups.conf
#
# --- SECURITY NOTE ---
#
# If you use snmp-ups and set a community string in here, you
# will have to secure this file to keep other users from obtaining
# that string. It needs to be readable by upsdrvctl and any drivers,
# and by upsd.
#
# ---
#
# This is where you configure all the UPSes that this system will be
# monitoring directly. These are usually attached to serial ports, but
# USB devices and SNMP devices are also supported.
#
# This file is used by upsdrvctl to start and stop your driver(s), and
# is also used by upsd to determine which drivers to monitor. The
# drivers themselves also read this file for configuration directives.
#
# The general form is:
#
# [upsname]
# driver = <drivername>
# port = <portname>
# < any other directives here >
#
# The section header ([upsname]) can be just about anything as long as
# it is a single word inside brackets. upsd uses this to uniquely
# identify a UPS on this system.
#
# If you have a UPS called snoopy, your section header would be "[snoopy]".
# On a system called "doghouse", the line in your upsmon.conf to monitor
# it would look something like this:
#
# MONITOR snoopy@doghouse 1 upsmonuser mypassword master
#
# It might look like this if monitoring in slave mode:
#
# MONITOR snoopy@doghouse 1 upsmonuser mypassword slave
#
# Configuration directives
# ------------------------
#
# These directives are used by upsdrvctl only and should be specified outside
# of a driver definition:
#
# maxretry: Optional. Specify the number of attempts to start the driver(s),
# in case of failure, before giving up. A delay of 'retrydelay' is
# inserted between each attempt. Caution should be taken when using
# this option, since it can impact the time taken by your system to
# start.
#
# The default is 1 attempt.
#
# retrydelay: Optional. Specify the delay between each restart attempt of the
# driver(s), as specified by 'maxretry'. Caution should be taken
# when using this option, since it can impact the time taken by your
# system to start.
#
# The default is 5 seconds.
#
# These directives are common to all drivers that support ups.conf:
#
# driver: REQUIRED. Specify the program to run to talk to this UPS.
# apcsmart, bestups, and sec are some examples.
#
# port: REQUIRED. The serial port where your UPS is connected.
# /dev/ttyS0 is usually the first port on Linux boxes, for example.
#
# sdorder: optional. When you have multiple UPSes on your system, you
# usually need to turn them off in a certain order. upsdrvctl
# shuts down all the 0s, then the 1s, 2s, and so on. To exclude
# a UPS from the shutdown sequence, set this to -1.
#
# The default value for this parameter is 0.
#
# nolock: optional, and not recommended for use in this file.
#
# If you put nolock in here, the driver will not lock the
# serial port every time it starts. This may allow other
# processes to seize the port if you start more than one by
# mistake.
#
# This is only intended to be used on systems where locking
# absolutely must be disabled for the software to work.
#
# maxstartdelay: optional. This can be set as a global variable
# above your first UPS definition and it can also be
# set in a UPS section. This value controls how long
# upsdrvctl will wait for the driver to finish starting.
# This keeps your system from getting stuck due to a
# broken driver or UPS.
#
# The default is 45 seconds.
#
# synchronous: optional. The driver work by default in asynchronous
# mode (i.e *synchronous=no*). This means that all data
# are pushed by the driver on the communication socket to
# upsd (Unix socket on Unix, Named pipe on Windows) without
# waiting for these data to be actually consumed. With
# some HW, such as ePDUs, that can produce a lot of data,
# asynchronous mode may cause some congestion, resulting in
# the socket to be full, and the driver to appear as not
# connected. By enabling the 'synchronous' flag
# (value = 'yes'), the driver will wait for data to be
# consumed by upsd, prior to publishing more. This can be
# enabled either globally or per driver.
#
# The default is 'no' (i.e. asynchronous mode) for backward
# compatibility of the driver behavior.
#
# Anything else is passed through to the hardware-specific part of
# the driver.
#
# Examples
# --------
#
# A simple example for a UPS called "powerpal" that uses the blazer_ser
# driver on /dev/ttyS0 is:
#
# [powerpal]
# driver = blazer_ser
# port = /dev/ttyS0
# desc = "Web server"
#
# If your UPS driver requires additional settings, you can specify them
# here. For example, if it supports a setting of "1234" for the
# variable "cable", it would look like this:
#
# [myups]
# driver = mydriver
# port = /dev/ttyS1
# cable = 1234
# desc = "Something descriptive"
#
# To find out if your driver supports any extra settings, start it with
# the -h option and/or read the driver's documentation.
# Set maxretry to 3 by default, this should mitigate race with slow devices:
maxretry = 3
[myups]
driver = usbhid-ups
productid = 3024
port = auto
desc = "Workstation"
lowbatt = 30
offdelay = 20
ondelay = 30
pollonly = "enabled"
You can see in there that both you and I are using usbhid-ups
as a driver. As explained in the text above, you can use options in addition to driver
and port
that are specific to the UPS and the help page from running /lib/nut/usbhid-ups -h
lists them:
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
USB communication driver 0.33
usage: usbhid-ups -a <id> [OPTIONS]
-a <id> - autoconfig using ups.conf section <id>
- note: -x after -a overrides ups.conf settings
-V - print version, then exit
-L - print parseable list of driver variables
-D - raise debugging level
-q - raise log level threshold
-h - display this help
-k - force shutdown
-i <int> - poll interval
-r <dir> - chroot to <dir>
-u <user> - switch to <user> (if started as root)
-x <var>=<val> - set driver variable <var> to <val>
- example: -x cable=940-0095B
Acceptable values for -x or ups.conf in this driver:
Set low battery level, in % (default=30). : -x lowbatt=<value>
Set shutdown delay, in seconds (default=20) : -x offdelay=<value>
Set startup delay, in seconds (default=30) : -x ondelay=<value>
Set polling frequency, in seconds, to reduce data flow (default=30) : -x pollfreq=<value>
Don't use interrupt pipe, only use polling : -x pollonly
Regular expression to match UPS Manufacturer string : -x vendor=<value>
Regular expression to match UPS Product string : -x product=<value>
Regular expression to match UPS Serial number : -x serial=<value>
Regular expression to match UPS Manufacturer numerical ID (4 digits hexadecimal) : -x vendorid=<value>
Regular expression to match UPS Product numerical ID (4 digits hexadecimal) : -x productid=<value>
Regular expression to match USB bus name : -x bus=<value>
Force redundant call to usb_set_altinterface() (value=bAlternateSetting; default=0) : -x usb_set_altinterface=<value>
Diagnostic matching of unsupported UPS : -x explore
Activate tweak for buggy APC Back-UPS firmware : -x maxreport
Don't use polling, only use interrupt pipe : -x interruptonly
Number of bytes to read from interrupt pipe : -x interruptsize=<value>
pollonly
is in there along with the vendorid
and productid
options that we are already using. There are other options that you could try there like interruptonly
or whatever.
Maybe some of this info will be of use to you or whoever reads this next time!
The problem
Dears,
I am trying to enable the integration of Network UPS Tools (NUT) in HASS, but I get the error message «Failed to connect».
at the same time error in the log:
Failure getting NUT ups alias, Socket error.
Failure getting NUT ups alias, ERR INVALID-ARGUMENT
i use latest version of Network UPS Tools addon with config:
users:
- username: nutty
password: mypassword
instcmds:
- all
actions: []
devices:
- name: myups
driver: usbhid-ups
port: auto
config: []
mode: netserver
shutdown_host: 'false'
addon’s log:
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] nut: applying...
[fix-attrs.d] nut: exited 0.
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing...
-----------------------------------------------------------
Add-on: Network UPS Tools
Manage battery backup (UPS) devices
-----------------------------------------------------------
Add-on version: 0.8.0
You are running the latest version of this add-on.
System: Raspbian GNU/Linux 10 (buster) (armv7 / raspberrypi4)
Home Assistant Core: 2021.9.7
Home Assistant Supervisor: 2021.09.4
-----------------------------------------------------------
Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing...
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] nut.sh: executing...
[11:29:07] INFO: Setting mode to netserver...
[11:29:07] INFO: Generating /etc/nut/upsd.users...
[11:29:08] INFO: Configuring user: nutty
[11:29:08] INFO: Password is NOT in the Have I Been Pwned database! Nice!
[11:29:08] INFO: Configuring Device named myups...
[11:29:08] INFO: Starting the UPS drivers...
Using subdriver: MGE HID 1.39
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.d] nut.sh: exited 0.
[cont-init.d] nutclient.sh: executing...
[cont-init.d] nutclient.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[11:29:15] INFO: Starting the UPS information server...
0.000000 fopen /var/run/nut/upsd.pid: No such file or directory
0.001653 listening on 0.0.0.0 port 3493
0.003978 Connected to UPS [myups]: usbhid-ups-myups
Ignoring duplicate password for nutty
Ignoring duplicate password for nutty
Ignoring duplicate password for nutty
Ignoring duplicate password for nutty
[11:29:16] INFO: Starting the UPS monitor and shutdown controller...
0.000000 fopen /var/run/nut/upsmon.pid: No such file or directory
0.001140 Using power down flag file /etc/killpower
0.001824 UPS: myups@localhost (master) (power value 1)
0.002201 debug level is '1'
0.002255 Warning: running as one big root process by request (upsmon -p)
0.003606 Init SSL without certificate database
0.009912 Trying to connect to UPS [myups@localhost]
0.541584 User upsmonmaster@127.0.0.1 logged into UPS [myups]
0.014071 Logged into UPS myups@localhost
What is version of Home Assistant Core has the issue?
core-2021.9.7
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
Network UPS Tools (NUT)
Link to integration documentation on our website
https://www.home-assistant.io/integrations/nut/
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
Suddenly, in the process of creating an issue. I found that if I entered a deliberately incorrect password in the integration settings line, this integration worked ¯_(ツ)_/¯
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
Failure getting NUT ups alias, Socket error. #198
Comments
Anton-Ka commented Nov 11, 2021
Problem/Motivation
After updating the component to version 0.9.0, all sensors became unavailable.
Expected behavior
Before the update, everything worked smoothly.
Actual behavior
I lost data from my ups.
Steps to reproduce
I don’t know.
The log file does not show any problems.
Proposed changes
I would like everything to work as before.
The text was updated successfully, but these errors were encountered:
Anton-Ka commented Nov 11, 2021
My config integration:
sinclairpaul commented Nov 11, 2021
The addon appears to be functioning, so this looks to be an issue with the integration, how do you have that configured?
Anton-Ka commented Nov 11, 2021 •
The addon appears to be functioning, so this looks to be an issue with the integration, how do you have that configured?
Earlier I clicked the + (add integration) button and added it. It worked for a long time without any problems.
Now i see:
sinclairpaul commented Nov 11, 2021
This isn’t an addon issue, as its running.
I would suggest removing and re-adding the integration, if that still fails seek help on the HA discord/forums, or log an issue against the integration.
Anton-Ka commented Nov 12, 2021
This isn’t an addon issue, as its running.
I would suggest removing and re-adding the integration, if that still fails seek help on the HA discord/forums, or log an issue against the integration.
I don’t know what exactly the problem is. I removed the integration and try to install it again, but when I try to connect, I get the message «Failed to connect.»
I will clarify that this problem appeared after updating the addon.
I will clarify that this problem appeared after updating the addon.
sinclairpaul commented Nov 12, 2021
[00:08:47] INFO: Configuring user: ha
Anton-Ka commented Nov 12, 2021
[00:08:47] INFO: Configuring user: ha
When i logged i used this name. Later I gave a different name, suggesting that it was too simple.
Footer
© 2023 GitHub, Inc.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник
Failure getting NUT ups alias, Socket error #34266
Comments
Sjeff commented Apr 15, 2020
After updating to 0.108.4 the NUT all the sensors are unavailable.
Removed the intergration.
Added the intergration the following error appears :
ERROR (SyncWorker_8) [homeassistant.components.nut] Failure getting NUT ups alias, Socket error.
Works again when reverting back to 0.108.3
Environment
- Home Assistant Core release with the issue: 0.108.4
- Last working Home Assistant Core release (if known): 0.108.3
- Operating environment (Home Assistant/Supervised/Docker/venv): Ubuntu with docker and supervised Home Assistant
- Integration causing this issue: NUT
- Link to integration documentation on our website: NUT
Problem-relevant configuration.yaml
None only configurable via intergration
Traceback/Error logs
Additional information
UPS model : Eaton Ellipse Eco 650
The text was updated successfully, but these errors were encountered:
probot-home-assistant bot commented Apr 15, 2020
Hey there @bdraco, mind taking a look at this issue as its been labeled with a integration ( nut ) you are listed as a codeowner for? Thanks!
bdraco commented Apr 15, 2020 •
Can you trying deleting setting it up again in 0.108.4? There was only a minor change between 0.108.3 and 0.108.4 which isn’t near getting the aliases
bdraco commented Apr 15, 2020
If that doesn’t work, I’ve setup a version with more debug output that can be installed in custom_components
Step 1:
Add the following to your configuration.yaml
Sjeff commented Apr 15, 2020
Hi @bdraco i allready removed the intergration and readded it in 0.108.4.
Also when i try and add the NUT intergration to my test setup (raspbian docker supervised home assistant) i never added the NUT intergration before. i receive the same error.
i will add the custom component and report back in a bit.
Sjeff commented Apr 15, 2020
Test enviroment:
Logs:
2020-04-15 21:50:02 ERROR (SyncWorker_5) [custom_components.nut] Failure getting NUT ups alias, Socket error.
2020-04-15 21:50:02 DEBUG (SyncWorker_5) [custom_components.nut] Error getting NUT vars for host xxx.xxx.xxx.xxx: Socket error.
Main enviroment:
After updating to 0.108.4 i removed the intergration and setup the custom intergration.
unfortunally i get the same error’s.
Logs:
2020-04-15 21:52:43 ERROR (SyncWorker_16) [custom_components.nut] Failure getting NUT ups alias, Socket error.
2020-04-15 21:52:43 DEBUG (SyncWorker_16) [custom_components.nut] Error getting NUT vars for host 127.0.0.1: Socket error.
bdraco commented Apr 15, 2020 •
Can you connect to the NUT UPS server manually with telnet ?
bkaufx commented Apr 15, 2020
Same issue here. All sensors unavailable after update to 0.108.4 I get the same telnet output as you:
$ telnet 127.0.0.1 3493
Trying 127.0.0.1.
Connected to 127.0.0.1.
Escape character is ‘^]’.
bdraco commented Apr 15, 2020
Is that the only error in the log ?
bkaufx commented Apr 15, 2020
I don’t have any errors in my home assistant log. It just says
2020-04-15 13:36:05 INFO (MainThread) [homeassistant.setup] Setting up nut 2020-04-15 13:36:05 INFO (MainThread) [homeassistant.setup] Setup of domain nut took 0.0 seconds.
Sjeff commented Apr 15, 2020
Yes i can connect to the server via telnet.
I updated to 0.108.5 just to see what is happening.
The custom intergration seems to work!
However when removing the custom intergration no devices are loaded in the intergration:
INFO (SyncWorker_18) [homeassistant.loader] Loaded nut from homeassistant.components.nut
bdraco commented Apr 15, 2020
@Sjeff The custom integration has a newer config format then 0.108.x so removing it after setup is expected to break.
Sjeff commented Apr 15, 2020
After reinstalling the custom intergration it works again.
When can i remove the custom intergration? 0.109.x?
bkaufx commented Apr 15, 2020
I removed the custom integration and all my sensors came back with the regular one. It still says «This integration has no devices.» in the integration configuration menu.
bdraco commented Apr 15, 2020
After reinstalling the custom intergration it works again.
When can i remove the custom intergration? 0.109.x?
bdraco commented Apr 15, 2020
I removed the custom integration and all my sensors came back with the regular one. It still says «This integration has no devices.» in the integration configuration menu.
Your UPS doesn’t provide a serial number and we couldn’t determine a unique id for the device so it won’t show up in the integration area. You can find the sensors at https://YOURHASS:8123/config/entities
Sjeff commented Apr 17, 2020
Thanks @bdraco still working with the custom intergration.
bepstein111 commented Jul 28, 2020 •
Looks like this is related. sorry for reopening this.
This is after enabling logging and installing custom component, although it’s the same error I was seeing with the normal integration. Not sure where to go from here, the integration isn’t actually showing up in «Integrations» so there’s nothing to remove and reinstall.
bdraco commented Jul 29, 2020
Looks like this is related. sorry for reopening this.
This is after enabling logging and installing custom component, although it’s the same error I was seeing with the normal integration. Not sure where to go from here, the integration isn’t actually showing up in «Integrations» so there’s nothing to remove and reinstall.
ptv1p3r commented Nov 21, 2021
Same problem here after update homeassistant. i just removed integration, and add again.. all is working again
18rrs commented Jan 22, 2022
I was having the same error after changing the ups and readd the integration. Solution was to use another username in the addon.
Источник
Failure getting NUT ups alias #55888
Comments
pcwilcox commented Sep 7, 2021
The problem
I’ve got my UPS setup with the NUT integration. When I go through a fresh install it gets setup and the sensors appear in the dash. When I check later (anything more than an hour or so) the integration has lost connection with this error message in the log:
It looks like the log message may have more to it that’s cut off, but I’m not sure how to read it, so I can’t tell if this is a repeat of #52635 or #42154.
What is version of Home Assistant Core has the issue?
What was the last working version of Home Assistant Core?
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Network UPS Tools (NUT)
Link to integration documentation on our website
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
The text was updated successfully, but these errors were encountered:
probot-home-assistant bot commented Sep 7, 2021
probot-home-assistant bot commented Sep 7, 2021
Hey there @bdraco, mind taking a look at this issue as it has been labeled with an integration ( nut ) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
flaektrem commented Sep 13, 2021
Same problem here!
Moxser commented Oct 28, 2021 •
I have the same problem
gadafivg commented Nov 3, 2021
Have same issues. After restart everything works for short time.
bdraco commented Nov 3, 2021
I’ve only seen this happen when the time is out of sync between Home Assistant and the nut server. Installing ntpd and restarting the nut server fixed it for me.
flaektrem commented Nov 4, 2021
Adding this solved my problem:
upsmon_deadtime: 25
ptv1p3r commented Nov 21, 2021
Same problem here after updating home assistant. Just removed integration of NUTS, and add it again, all is working
kzkz22 commented Jan 6, 2022
I have to replace the host address in the NUT integration (not in the addon) from localhost to the addon hostname, and after that I successfully connected to my HA NUT server.
CrouchingWorm commented Feb 2, 2022 •
I’m trying to add the NUT integration for the first time and I’m getting this error.
Not sure if I’m doing something wrong, but the add-on won’t load at all.
github-actions bot commented May 3, 2022
There hasn’t been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
pcwilcox commented May 5, 2022
I’m still getting this problem. upsmon_deadtime: 25 does not resolve it.
martinezpenya commented May 8, 2022
After upgrading HA I’ve lost my NUT UPS. I’m using docker for HA and the UPS is connected to real machine outside HA. Before upgrade it was working, but I’ve also upgraded Debian on real machine to 11, so i’m not sure which is the upgrade that caused failure.
norey commented Jun 27, 2022 •
I’m not able to make it work. NUTS add-on log looks fine but it doesn’t seem to be listening.
When I try using the NUT integration, I get
What am I doing wrong?
martymarty004 commented Jul 8, 2022
I just installed this addon, and I’m getting the same error while configuring the integration
martymarty004 commented Jul 8, 2022
Ok, I used a0d7b954-nut as the hostname, and it finally worked.
norey commented Jul 16, 2022
Same with me actually, I used the hostname instead of localhost and it connected. I guess localhost in this context refers to hass and not the container running NUTS.
norey commented Jul 18, 2022 •
So around 12 hours after I got the integration working, I saw its entities become not available anymore so I check the add-on’s log and see this:
Restarting the add-on fixed it. Any ideas behind the cause of this? I guess it’s back to OP’s issue.
norey commented Jul 19, 2022
This time after the sensors became unavailable the add-on log showed
randomhammer commented Aug 1, 2022 •
I installed the nut add-on a couple days ago and it has been solid until I rebooted. No updates applied, and I am running Home Assistant Core, no containers. I just stopped working for no apparent reason.
nagyrobi commented Aug 3, 2022
I have to replace the host address in the NUT integration (not in the addon) from localhost to the addon hostname, and after that I successfully connected to my HA NUT server.
This fixed it for me too, thanks!
Dude4Linux commented Sep 10, 2022
I’m running Home Assistant on a Raspberry Pi4 using HAOS with the NUT Add-on and Integrations. For months I’ve been struggling with this issue. I happen to have a Tripplite SMART1500LCDT UPS. I’ve tried about every combination of pollinterval, deadtime, and maxage that I found on this and other threads. I even upgraded the Pi’s firmware to the latest version. None of these suggestions seem to help for very long.
Now I tried setting pollonly = «enabled» and it appears to be working without disconnection (48 hours +).
Thanks @eyal0 for the hint! See usbhid-ups stops working after 10-20 minutes.
eyal0 commented Sep 10, 2022
To get NUT working out of the box on my system, I needed to do two things: pollonly and also fix permissions. The permissions issue is perfectly described here and the solution described works without modification:
norey commented Sep 10, 2022
I’m running Home Assistant on a Raspberry Pi4 using HAOS with the NUT Add-on and Integrations. For months I’ve been struggling with this issue. I happen to have a Tripplite SMART1500LCDT UPS. I’ve tried about every combination of pollinterval, deadtime, and maxage that I found on this and other threads. I even upgraded the Pi’s firmware to the latest version. None of these suggestions seem to help for very long.
Now I tried setting pollonly = «enabled» and it appears to be working without disconnection (48 hours +). Thanks @eyal0 for the hint! See usbhid-ups stops working after 10-20 minutes.
How are you adding that setting to the options yaml?
is failing to save.
eyal0 commented Sep 10, 2022
So my solution is, instead of the pollinterval, to put pollonly = «enabled» into /usr/nut/ups.conf. Hopefully this will work.
Did you put it in the correct file?
norey commented Sep 11, 2022
So my solution is, instead of the pollinterval, to put pollonly = «enabled» into /usr/nut/ups.conf. Hopefully this will work.
Did you put it in the correct file?
How can I reach that? I’m running Home Assistant OS in a VM and the Terminal & SSH addon. When I ssh into the system, /usr/nut does not exist.
Dude4Linux commented Sep 11, 2022
How are you adding that setting to the options yaml?
is failing to save.
The YAML syntax that I’m using looks like this:
eyal0 commented Sep 11, 2022
Okay, perhaps it goes into yaml instead of a file for home automation purposes. My file is located at /etc/nut/ups.conf and I found it by running the command find /etc -name ups.conf . Maybe find /usr -name ups.conf would be right on other systems.
My file has a config similar to above. It also has a lot of explanation of other parameters. Maybe the documentation will be useful for you in the future? I’ll include the whole file below. You’ll see that I also have a productid , though no vendorid . Anyway, the productid is unique among all the USB devices on my system so maybe that’s enough to specify it. I’m able to see the list of all connected USB devices along with their IDs by typing lsusb .
Here’s my file, maybe some of the other options will be interesting to you, too?
# # # The section header ([upsname]) can be just about anything as long as # it is a single word inside brackets. upsd uses this to uniquely # identify a UPS on this system. # # If you have a UPS called snoopy, your section header would be «[snoopy]». # On a system called «doghouse», the line in your upsmon.conf to monitor # it would look something like this: # # MONITOR snoopy@doghouse 1 upsmonuser mypassword master # # It might look like this if monitoring in slave mode: # # MONITOR snoopy@doghouse 1 upsmonuser mypassword slave # # Configuration directives # ———————— # # These directives are used by upsdrvctl only and should be specified outside # of a driver definition: # # maxretry: Optional. Specify the number of attempts to start the driver(s), # in case of failure, before giving up. A delay of ‘retrydelay’ is # inserted between each attempt. Caution should be taken when using # this option, since it can impact the time taken by your system to # start. # # The default is 1 attempt. # # retrydelay: Optional. Specify the delay between each restart attempt of the # driver(s), as specified by ‘maxretry’. Caution should be taken # when using this option, since it can impact the time taken by your # system to start. # # The default is 5 seconds. # # These directives are common to all drivers that support ups.conf: # # driver: REQUIRED. Specify the program to run to talk to this UPS. # apcsmart, bestups, and sec are some examples. # # port: REQUIRED. The serial port where your UPS is connected. # /dev/ttyS0 is usually the first port on Linux boxes, for example. # # sdorder: optional. When you have multiple UPSes on your system, you # usually need to turn them off in a certain order. upsdrvctl # shuts down all the 0s, then the 1s, 2s, and so on. To exclude # a UPS from the shutdown sequence, set this to -1. # # The default value for this parameter is 0. # # nolock: optional, and not recommended for use in this file. # # If you put nolock in here, the driver will not lock the # serial port every time it starts. This may allow other # processes to seize the port if you start more than one by # mistake. # # This is only intended to be used on systems where locking # absolutely must be disabled for the software to work. # # maxstartdelay: optional. This can be set as a global variable # above your first UPS definition and it can also be # set in a UPS section. This value controls how long # upsdrvctl will wait for the driver to finish starting. # This keeps your system from getting stuck due to a # broken driver or UPS. # # The default is 45 seconds. # # synchronous: optional. The driver work by default in asynchronous # mode (i.e *synchronous=no*). This means that all data # are pushed by the driver on the communication socket to # upsd (Unix socket on Unix, Named pipe on Windows) without # waiting for these data to be actually consumed. With # some HW, such as ePDUs, that can produce a lot of data, # asynchronous mode may cause some congestion, resulting in # the socket to be full, and the driver to appear as not # connected. By enabling the ‘synchronous’ flag # (value = ‘yes’), the driver will wait for data to be # consumed by upsd, prior to publishing more. This can be # enabled either globally or per driver. # # The default is ‘no’ (i.e. asynchronous mode) for backward # compatibility of the driver behavior. # # Anything else is passed through to the hardware-specific part of # the driver. # # Examples # ——— # # A simple example for a UPS called «powerpal» that uses the blazer_ser # driver on /dev/ttyS0 is: # # [powerpal] # driver = blazer_ser # port = /dev/ttyS0 # desc = «Web server» # # If your UPS driver requires additional settings, you can specify them # here. For example, if it supports a setting of «1234» for the # variable «cable», it would look like this: # # [myups] # driver = mydriver # port = /dev/ttyS1 # cable = 1234 # desc = «Something descriptive» # # To find out if your driver supports any extra settings, start it with # the -h option and/or read the driver’s documentation. # Set maxretry to 3 by default, this should mitigate race with slow devices: maxretry = 3 [myups] driver = usbhid-ups productid = 3024 port = auto desc = «Workstation» lowbatt = 30 offdelay = 20 ondelay = 30 pollonly = «enabled»»>
You can see in there that both you and I are using usbhid-ups as a driver. As explained in the text above, you can use options in addition to driver and port that are specific to the UPS and the help page from running /lib/nut/usbhid-ups -h lists them:
pollonly is in there along with the vendorid and productid options that we are already using. There are other options that you could try there like interruptonly or whatever.
Maybe some of this info will be of use to you or whoever reads this next time!
Источник