Closed meirmsn closed 2 years ago
Fixed it. It was permissions of the usb dongle.
I had to log to homebridge the stderr of the rtl_433 childProcess spawn, to get more details on the error, I saw this on homebridge logs:
usb_open error -3
Please fix the device permissions, e.g. by installing the udev rules file rtl-sdr.rules
which led me to this rtl_433 issue which has a link to an example solution (and had to make sure there the rules file is named "rtl-sdr.rules" and use an appropriate group for it to work)
i fixt it with entering additional lines in HB config:
"platforms": [ { "platform": "rtl_433", "rtl433Path": "/usr/local/bin/", "rtp433Bin": "rtl_433", "killCommand": "pkill", "devices": [ { "id": "227", "name": "Teich", "type": "temperature" }, { "id": "216", "name": "Pool", "type": "temperature" } ] },
i don't know why i had to add this default values, but after that all worked. i don't need any rules file ether.
good luck!
Thank you so much @OE5DRO!
I noticed this error in the logs: (logging to homebridge the stderr of the rtl_433 childProcess spawn)
/bin/sh: 1: Syntax error: ";;" unexpected
It seems to come from the ";" added at the end of the pkill command https://github.com/NorthernMan54/homebridge-rtl/blob/80b51f69be0e7f88b8c9b2b610c9b0df10ec5618/sensor.js#L33
Notice how when the pkill command is invoked, an extra ";" is added, hence explaining the syntax error mentioned above: https://github.com/NorthernMan54/homebridge-rtl/blob/80b51f69be0e7f88b8c9b2b610c9b0df10ec5618/sensor.js#L64
Given the kill command can be overwritten from the config (see the reference to line 33 above), I think that is why/how you fixed the problem by adding the default kill command to the config.
The only thing I don't understand is that I had to add the rtl_433 to the kill command in the config ("killCommand": "pkill rtl_433",
) so that line 64 above would actually kill the rtl_433, but your example kill command config is plain pkill with no rtl_433 . I wonder if yours now works because the syntax error is no longer present, but indeed no rtl_433 command is being killed? Perhaps you can see on top
multiple instances of rtl_433? Idk
This was part of this change from last year
https://github.com/NorthernMan54/homebridge-rtl/commit/46e6b5726eb8f7ceb4839eeca1bee485448ea043
Is is possibly the use of double quotes then single quotes ?
@NorthernMan54 I don't think so but I'm no expert. I think the semicolon added at the end of line 33 on sensor.js (the definition of killCommand) gets concatenated to the semicolon on line 64 (the invocation of killCommand) and hence produces the Syntax error: ";;" unexpected
.
The commit you link interestingly does not have the semicolon on the invocation (it shows this.killCommand + ' '
) but commit aa38713 (from later that day) does add it (leaving it looking like this.killCommand + '; '
).
So it seems like the semicolon should be added only once: either in the killCommand definition, or in the invocation, but not in both places?
I'm going to remove it from line 33
Fixed in release 0.0.6
is still have the problem with 0.0.6: [22/11/2023, 23:06:22] [rtl_433] Spawning rtl_433 pkill; /usr/local/bin/rtl_433 [22/11/2023, 23:06:22] [rtl_433] child exit code (spawn) 2 [22/11/2023, 23:06:22] [rtl_433] child close code (spawn) 2 if i reboot my raspberry the error dissapears and all is running fine. after updating a plugin and restarting homebridge the error is back again, until i reboot the system?!
@OE5DRO I had to log the stderr of the rtl process spawn in sensor.js (as referenced above) to be able to understand what the reason behind the exit code 2 was. Two year ago was a permission error, recently was the double semicolon issue. I bet if you log it you can get some insight into what might be causing troubles on your end?
how do i log this?
@OE5DRO on sensor.js when it does var proc = childProcess.spawn(...
you can add right below something like this:
proc.stderr.on('data', (data) => {
this.log(`stderr: ${data}`);
});
(you can also do it for stdout, in case useful: see reference here)
Hi,
I followed the installation(*) and configuration instructions, but this is what I see on the homebridge logs every 10 seconds:
Any idea what could be going on? I'm not sure what code 2 is, I only found this reference on the repo but not really sure what is happening
Please let me know if you need any more details to understand the problem,
Thank you so much for your time and help, and for doing this plugin! This will help us monitor the fridge/freezer and make sure the doors are not left open
Meir
More details
rtl_433
on the raspberypi console, and I see the readings from the sensors, as well as their ids.rtl_433 -q -F json -C si
I also see the readings from the sensors and their ids. In case it's useful, I noted it sayswhich rtl_433
returns/usr/local/bin/rtl_433
(which seems the same as in the plugin)