Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cyberpower 1500 reconnects USB on status change and Hassio gets Data stale #30

Closed
etatus opened this issue Mar 20, 2020 · 8 comments
Closed

Comments

@etatus
Copy link

etatus commented Mar 20, 2020

Problem/Motivation

I've configured the addon and everything works fine (I can see all the information), but when the UPS enters on battery mode usb disconnects and connects again (I can see with dmesg) so hassio lost connection with the ups and nut server seems to be down because the message Date stale shows up. If I restart the addon, everything works fine again.

Expected behavior

The driver should support short usb disconnections.

Actual behavior

The connection with the ups is lost and nut server is down (Data stale).

Steps to reproduce

Just force to enter on battery mode on Cyberpower CP1500EPFCLCD

Proposed changes

Is there a way to keep the nut server running after a short usb disconnection? Otherwise, is it possible to restart the nut server through hassio.addon_stdin service?

@addons-assistant
Copy link

👋 Thanks for opening your first issue here! If you're reporting a 🐛 bug, please make sure you include steps to reproduce it. Also, logs, error messages and information about your hardware might be useful.

@sinclairpaul
Copy link
Member

Not sure really what you are asking here, so the UPS disconnects from the host and reconnects? And the time out period for the driver gets hit?

Addons can be restarted using HA automation's if needed, not sure how the addon could detect if its disconnected based on a cable pull vs the scenario you describe.

@etatus
Copy link
Author

etatus commented Mar 20, 2020

The problem is that after UPS disconnection, despite it reconnects again (USB), Home Assistant can't monitor the ups anymore until the ups server is restarted manually, so I cannot receive alerts related with low battery, etc. I can restart the addon from Home Assistant, but it takes a while, so I miss information. It would be better to restart only the nut server without restarting the entire addon.

@sinclairpaul
Copy link
Member

Does the pollinterval option on the driver, and other settings not help?

Personally I have a Cyberpower UPS connected via USB and haven't seen this issue. Unfortunately it would be impossible to tell when your issue exists.

@etatus
Copy link
Author

etatus commented Mar 21, 2020

I think this issue is not related with poll interval since it only happens when the ups change the status from online to on battery mode (or viceversa). Here is the host dmesg:

...
[287392.327784] usb 1-1.4: new full-speed USB device number 33 using xhci_hcd
[287392.464443] usb 1-1.4: New USB device found, idVendor=0764, idProduct=0501, bcdDevice= 0.01
[287392.464451] usb 1-1.4: New USB device strings: Mfr=3, Product=1, SerialNumber=2
[287392.464456] usb 1-1.4: Product: CP1500EPFCLCD
...
>>>>>>> Here UPS enters On Battery mode <<<<<<<<
..
[286938.072105] usb 1-1.4: USB disconnect, device number 31
[286938.370822] usb 1-1.4: new full-speed USB device number 32 using xhci_hcd
[286938.507477] usb 1-1.4: New USB device found, idVendor=0764, idProduct=0501, bcdDevice= 0.01
[286938.507484] usb 1-1.4: New USB device strings: Mfr=3, Product=1, SerialNumber=2
[286938.507490] usb 1-1.4: Product: CP1500EPFCLCD
[286938.507495] usb 1-1.4: Manufacturer: CPS
...

image

And here is the addon log:

-----------------------------------------------------------
 Add-on: Network UPS Tools
 Manage battery backup (UPS) devices
-----------------------------------------------------------
 Add-on version: 0.1.0
 You are running the latest version of this add-on.
 System: Raspbian GNU/Linux 10 (buster)  (armv7 / raspberrypi4)
 Home Assistant Core: 0.107.1
 Home Assistant Supervisor: 209
-----------------------------------------------------------
 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... 
[01:56:06] INFO: Setting mode to netserver...
[01:56:06] INFO: Generating /etc/nut/upsd.users...
[01:56:07] INFO: Configuring user: admin
[01:56:07] INFO: Password is NOT in the Have I Been Pwned database! Nice!
[01:56:08] INFO: Configuring Device named saisil...
[01:56:09] INFO: Starting the UPS drivers...
Network UPS Tools - UPS driver controller 3.8.0-3396-gcdc7c4b5b1
Network UPS Tools - Generic HID driver 0.41 (3.8.0-3396-gcdc7c4b5b1)
Using subdriver: CyberPower HID 0.4
USB communication driver 0.33
[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.
[01:56:09] INFO: Starting the UPS information server...
Network UPS Tools upsd 3.8.0-3396-gcdc7c4b5b1
   0.000000	fopen /var/run/nut/upsd.pid: No such file or directory
   0.000455	listening on 0.0.0.0 port 3493
   0.001487	Connected to UPS [saisil]: usbhid-ups-saisil
[01:56:09] INFO: Starting the UPS monitor and shutdown controller...
Network UPS Tools upsmon 3.8.0-3396-gcdc7c4b5b1
   0.000000	fopen /var/run/upsmon.pid: No such file or directory
   0.000491	Using power down flag file /etc/killpower
   0.000896	UPS: saisil@localhost (master) (power value 1)
   0.001097	debug level is '1'
   0.007504	Trying to connect to UPS [saisil@localhost]
   0.023589	User upsmonmaster@127.0.0.1 logged into UPS [saisil]
   0.008446	Logged into UPS saisil@localhost
 143.571115	Data for UPS [saisil] is stale - check driver
 145.018084	Poll UPS [saisil@localhost] failed - Data stale
 150.018951	Poll UPS [saisil@localhost] failed - Data stale
 155.019566	Poll UPS [saisil@localhost] failed - Data stale

@sinclairpaul
Copy link
Member

sinclairpaul commented Mar 21, 2020

It appears to be hardware related, personally I would try different USB ports, cable, possibly a hub. Also see if it occurs on a different hardware platform, to rule out if it is the Pi itself.

There really isn't anything that can be done here from an add on perspective. The HA integration result would be expected as the NUT server can no longer communicate with the UPS.

The addon runs existing software maintained elsewhere, I would suggest looking at https://networkupstools.org/

Power Devices support

@etatus
Copy link
Author

etatus commented Mar 21, 2020

Hmmm, you were right, it was a hardware problem related to the Raspberry Pi 4.

  • UPS connected to the Raspberry Pi 4 in different USB ports --> It disconnects the same
  • UPS connected to the Raspberry Pi 4 with different charger --> It disconnects the same
  • UPS connected to the Raspberry Pi 4 through a powered USB hub --> It disconnects the same
  • UPS connected to a Raspberry Pi 3 --> It works fine (no disconnections)

Conclusion: something weird happens with the USB ports of the Raspberry Pi 4 only when the UPS changes to on battery mode :( (BTW, the external hard disk attached to the next USB port doesn't disconnect).

I wonder if the issue is related to the Argon ONE Case I'm currently using...

Anyway, thank you for your comments @sinclairpaul

@addons-assistant
Copy link

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@addons-assistant addons-assistant bot locked as resolved and limited conversation to collaborators Apr 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants