merbanan / rtl_433

Program to decode radio transmissions from devices on the ISM bands (and other frequencies)
GNU General Public License v2.0
6.13k stars 1.32k forks source link

MQTT: MQTT connect error: Unknown error -1 #2573

Closed jjkoehorst closed 1 year ago

jjkoehorst commented 1 year ago

Any possible way to get more information regarding this message?

rtl_433 -f 868M -s 1024k -F mqtt://homeassistant.local:1883,user=mosquitto,pass=somepassword,retain=0,events=rtl_433[/model][/id] -F log -F json -M utc -vvv -R 142

rtl_433 version nightly-12-g406918d3 branch master at 202307181439 inputs file rtl_tcp RTL-SDR
Use -h for usage help and see https://triq.org/ for documentation.
Trying conf file at "rtl_433.conf"...
Trying conf file at "/home/jasper/.config/rtl_433/rtl_433.conf"...
Trying conf file at "/usr/local/etc/rtl_433/rtl_433.conf"...
Trying conf file at "/etc/rtl_433/rtl_433.conf"...

New defaults active, use "-Y classic -s 250k" if you need the old defaults

MQTT: Publishing MQTT data to homeassistant.local port 1883
MQTT: Publishing events info to MQTT topic "rtl_433[/model][/id]".
Registering protocol [142] "Fine Offset Electronics/ECOWITT WH51, SwitchDoc Labs SM23 Soil Moisture Sensor"
Protocols: Registered 1 out of 245 device decoding protocols
Input: The internals of input handling changed, read about and report problems on PR #1978
SDR: Found 1 device(s)
SDR: trying device 0: Realtek, RTL2838UHIDIR, SN: 00000001
Detached kernel driver
Found Rafael Micro R820T tuner
SDR: Using device 0: Realtek, RTL2838UHIDIR, SN: 00000001, "Generic RTL2832U OEM"
[R82XX] PLL not locked!
SDR: Sample rate set to 1024000 S/s.
Input: Bit detection level set to 0.0 (Auto).
SDR: Tuner gain set to Auto.
Input: Reading samples in async mode...
SDR: rtlsdr_set_center_freq 868000000 = 0
SDR: Tuned to 868.000MHz.
acquire_thread: acquire_thread enter...
Allocating 15 zero-copy buffers
Baseband: low pass filter for 1024000 Hz at cutoff 204800 Hz, 4.9 us
MQTT: MQTT connect error: Unknown error -1
zuckschwerdt commented 1 year ago

Did you check the quoting? If that's run through a shell then comma and brackets might have special meaning, and your pass might be mangled.

jjkoehorst commented 1 year ago

-F 'mqtt://homeassistant.local:1883,user=mosquitto,pass=mosquitto,retain=0,events=rtl_433[/model][/id]'

but even if I type a non-existing webserver or wrong port or wrong password I get the same issues. I am running it on a minimal 22.04 ubuntu on a raspberry pi 4 maybe a dependency is missing?

jjkoehorst commented 1 year ago

I think that might be the issue, not sure if this library makes use of mosquito_pub or similar but that is also not yet working here...

mosquitto_pub -h '192.168.1.114' -u mosquitto -p mosquitto -t "test/light1" -m "hello world" -d
Error: No such file or directory
zuckschwerdt commented 1 year ago

Strange that mosquitto_pub won't work. Must be some underlying cause. rtl_433 does not use libs for MQTT though.

jjkoehorst commented 1 year ago

Might be an authentication issue or something else entirely as without any credentials at least a

mosquitto_pub -h '192.168.1.114' -t "test/light1" -m "hello world" -d
Client (null) sending CONNECT
Client (null) received CONNACK (5)
Connection error: Connection Refused: not authorised.
Error: The connection was refused.

pops up! The quest continues!

-P != -p for the password at least...

gdt commented 1 year ago

You should absolutely work through getting everything working with mosquitto_pub before trying rtl_433. That may mean learning and understanding a fair bit.

Also, run tcpdump and watch the packets.

gdt commented 1 year ago

Given that mosquitto_pub does not work, this issue doesn't point to a bug in rtl_433.