How to disable USB autosuspend?

Every night my Sonoff Zigbee 3.0 USB dongle plus (flashed for Zigbee2MQTT) stops working and I suspect USB autosuspend to be the culprit.

I’m running HASS.IO on a Raspberry Pi 4.
cat /sys/module/usbcore/parameters/autosuspend returns ‘2’

What can I do to permanently disable USB autosuspend? I tried adding a file to /etc/modprobe.d containing the line ‘options usbcore autosuspend=-1’ but that didn’t survive a reboot.

Help would be greatly appreciated!

1 Like

No, you are running Home Assistant OS. It hasn’t been called hassio for over two years!

As for the sleep issue a seach returned no results for a HA OS fix, only for VM installs. :frowning:

You should open an issue on github.

Thanks! I will do that

Hello… did you ever find a way to disable this? I think I’m in the same boat as you with my Zigbee stick. Thanks!

1 Like

No, not yet. I’m still looking for a good solution, will post it here when I found one

1 Like

Having the same issue, but on Supervised install (Raspbian bullseye, so no official support for me :frowning: ). Did you find any solution yet?

Adding usbcore.autosuspend=-1 to the kernel command line in /boot/cmdline.txt should do it, at least on bullseye.

1 Like

Well, I tried it and it seems to work… running for 48 hours and no USB disconnections so far… I hope it remains so. Thx a lot for the hint.

Just confirming, that it works great - after full seven days uptime no USB suspend happened (before this hack it happened at least once a day). Thx once again for the solution.

I did not find a solution yet but the problem seems te be over since April 15 anyway. I looked through the update release history but could not find any mention about this problem in there.
I’m happy now

Just in case it helps someone else… it was not the “usbcore.autosuspend=-1” which solved my issue, but the USB hub (not powered, just passive one), that I added at the same time as I added the command to cmdline. After removing the hub (but with the command present) I again had dongle disconnects.
So, now I removed the command from cmdline, but I kept the USB hub and it works. Obviously the hub does something, that the dongle itself doesn’t.

Not sure if this is the case for someone else, but might be helpfull.

Hi, i got the same trouble I think. Zigbee & Zwave disconnect sometimes (every 8-48h max) and USB device are just not anymore present on hardware

A full PC reboot solve it, but it makes me crazy.
PC is Dell Optiplex and I play with BIOS sleep options but no change.

Has anyone an idea ?

Home Assistant 2023.4.2
Supervisor 2023.04.0
Operating System 9.5
Frontend 20230406.1

How did you solve?

I had the same issue with my Zigbee dongle powering down and my smart buttons not working until I woke it up via the UI. I followed the rabbit trail of how to disable usb autosuspend and landed here:

Here’s what I did.

In terminal on your HassOS system go to following path:

/sys/bus/usb/devices/

Inside there go into each device folder and run the following command to find the device you are looking for:

cat product

for example my folder labeled “1-1” came back “SONOFF Zigbee 3.0 USB Dongle Plus V2” and that was what I was looking for.

After you find the correct device stay in that directory and type the following to find
the vendor and product Id’s and make note of them:

cat idProduct
cat idVendor

for example my Product ID was “55d4” and Vendor ID was “1a86”

now following the instructions here
https://github.com/home-assistant/operating-system/blob/dfdd3b443812136f25aebdb1a3b5c2b8628cb28e/Documentation/configuration.md
make your usb CONFIG drive.

inside the udev directory you just added, create a file called “usb-power.rules”.
In that file add the following

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="yourIDVendor", ATTR{idProduct}=="yourIDProduct", TEST=="power/control", ATTR{power/control}="on"

replacing the values yourIDVendor and yourIDProduct with the values you noted earlier.

Plug the USB drive into your HassOS box and reboot.

You can confirm if it worked by typing the following while inside the following directory

/sys/bus/usb/devices/[YOURDEVICEFOLDER]/power/
cat control

It should return “on” if it worked correctly.

I do not fully understand everything that’s going on here so do at your own risk. I’m not sure if the [ TEST==“power/control” ] key in the above is necessary or can be omitted, I left it in because of that.

I can’t help you troubleshoot if it doesn’t work. Sorry, I’m just a hobbyist, not a guru.

1 Like