pbkhrv / rtl_433-hass-addons

Collection of Home Assistant add-ons that use rtl_433
236 stars 108 forks source link

Hanging on [rtl_433] Allocating 15 zero-copy buffers #202

Open LavaTiger99 opened 1 month ago

LavaTiger99 commented 1 month ago

The problem

Setup: HomeAssistant Green device Mosquitto broker installed & working rtl_433_next never worked (didn't auto-connect to mosquitto) Successfully installed rtl_433, and device pings started showing up in the logs, and it was automatically pushing to MQTT (seen in mqtt explorer) After a couple hours, it stopped publishing/working. After trying to restart it multiple times, the startup of rtl_433 keeps hanging on [rtl_433] Allocating 15 zero-copy buffers Strange, since it worked fine a few hours ago. Tried uninstalling it, reinstalling it. Tried updating librtlsdr:

[core-ssh ~]$ apk add librtlsdr
(1/2) Installing libusb (1.0.26-r3)
(2/2) Installing librtlsdr (2.0.1-r0)
OK: 107 MiB in 103 packages

What addon are you reporting the bug for?

rtl_443

What is the addon version?

0.5.2

What type of MQTT Broker are you using?

Home Assistant Mosquitto MQTT Broker

Addon log messages

Starting rtl_433 with rtl_433.conf...
[rtl_433] rtl_433 version 23.11 branch  at 202311281352 inputs file rtl_tcp RTL-SDR
[rtl_433] Found Rafael Micro R820T/2 tuner
[rtl_433] Exact sample rate is: 250000.000414 Hz
[rtl_433] [SDR] Using device 0: Realtek, RTL2838UHIDIR, SN: 00000001, "Generic RTL2832U OEM"
[rtl_433] Allocating 15 zero-copy buffers

Additional information

No response

deviantintegral commented 1 month ago

Installing librtlsdr won’t do anything there because that’s not inside the addon container. But, we already include otherwise your radio wouldn’t show up at all.

I would start by enabling verbose mode, enabling key / value output, and disabling any protocol filters. See if you’re getting any data at all, even if it’s not from devices you care about.

I’ll also say some of the radios out there are not very robust. In one of my installs I had to both move the radio to a separate powered USB hub, and I had to disable frequency hopping and use two radios because they would lock up after a while.

uffevedenbrant commented 1 month ago

My first SDR radio i bought last week Beginning oct 2024 worked without any issues at all. Took the complete setup to my summer house as its there i have the need for 433. But it was a little fun to have it in town as well so i ordered a second one. Failed completely. I could see rtl_433 (next) seeing 433 devices but it really did not look like the first one. rtl_433 MQTT Auto Discovery (next) actually never added the devices..

However as i had one working instance and one failing i did some comparision. The one that worked had a file ../config/rtl_433/rtl_433.conf.template with a lot of config in it. The one that failed hada empty file.

I copied the content from the working HA instans to the failing and then the failing started to wrok. No clue if the installation in some way created the 0-byte file or something else happened. However while testing i removed/installed the rtl- addons multiple times so i guess it should have been fixed with reinstallations.

Config in working HA instance. ( note that i never configured this file in the working HA instance.. )

uffevedenbrant commented 1 month ago

Unfortunately the comments created a mess in the config example.. But below is the config statements only without comments..

output mqtt://${host}:${port},user=${username},pass=${password},retain=${retain} report_meta time:iso:usec:tz

protocol -59 protocol -60 protocol -82 protocol -88 protocol -89 protocol -90 protocol -95 protocol -110 protocol -123 protocol -140 protocol -156 protocol -168

uffevedenbrant commented 1 month ago

Only diff that i now can think of is that on the first install i went for the standard rtl_433 and then later decided to install the "next" version.

On the second i installed the "next" version immediately. If there is a diff in the installation and the file is zerobyte in "next" and has some reasonable content in the standard version.. But if the file exists.. It will not be touched/replaced..

LavaTiger99 commented 1 month ago

Ok, so now devices are being detected by it, but on startup it does not seem to be publishing to MQTT (mosquito, default settings). Initially when I first installed the rtl433 addon, it automatically published to mqtt without any config file. Since then I have installed, uninstalled the addons, tried next and non-next versions trying to get things to work. Now it is not publishing to mqtt on startup even when I created a manual config file with mqtt credentials... I'm thinking all of my installing & uninstalling has messed things up. I removed the config/rtl_433 folder after uninstalling, but is there anything else I need to remove to completely fresh install everything?

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
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
Starting rtl_433 with rtl_433.conf...
[rtl_433] rtl_433 version 23.11 branch  at 202311281352 inputs file rtl_tcp RTL-SDR
[rtl_433] Detached kernel driver
[rtl_433] Found Rafael Micro R820T/2 tuner
[rtl_433] [SDR] Using device 0: Realtek, RTL2838UHIDIR, SN: 00000001, "Generic RTL2832U OEM"
[rtl_433] Exact sample rate is: 250000.000414 Hz
[rtl_433] Allocating 15 zero-copy buffers
[rtl_433] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[rtl_433] 
[rtl_433] time      : 2024-10-15 16:32:39
[rtl_433] model     : Govee-Water
[rtl_433] id        : 27188
[rtl_433] event     : Button Press
[rtl_433] detect_wet: 0
[rtl_433] Raw Code  : 6a34305439e8
[rtl_433] Integrity : CRC
deviantintegral commented 1 month ago

I removed the config/rtl_433 folder after uninstalling, but is there anything else I need to remove to completely fresh install everything?

That should be it. It should create the rtl_433 folder and default configuration file on first start. Does your addon config have the legacy conf_file directive set? If so, remove that:

https://github.com/pbkhrv/rtl_433-hass-addons/blob/main/rtl_433/run.sh#L27

Robbi-Wan-Kenobi commented 2 weeks ago

Where you able to solve this issue? I'm having the same Allocating 15 zero-copy buffers problem. Is there a way to debug this issue, or get more information on ways to solve it?