pbkhrv / rtl_433-hass-addons

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

Support SoapySDR devices #198 #199

Closed deviantintegral closed 1 month ago

deviantintegral commented 2 months ago

Summary

Adds the required libraries for SoapySDR devices, now that they are included in Alpine as of 3.19.

I don't have a SoapySDR, but I can manually run the addon and see SoapySDR in the output:

$ docker run --rm -it sha256:9d465e6498a95d9fa0e7a12d46067e5947aa7fc9034a2e59039071d3e09a67f3
s6-linux-init: warning: parent wrote to fd 3!
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
[20:10:28] INFO: The mqtt addon is not available.
[20:10:28] INFO: This is not a problem if you are using an external MQTT broker.
[20:10:28] INFO: If you are using the Home Assistant Mosquitto Broker addon, try restarting it, and then restart the rtl_433 addon.
[20:10:28] INFO: For an external broker, manually update the output line in the configuration file with mqtt connection settings, and restart the addon.
curl: (6) Could not resolve host: supervisor
[20:10:28] ERROR: Something went wrong contacting the API
[20:10:28] WARNING: rtl_433 now supports automatic configuration and multiple radios. The rtl_433_conf_file option is deprecated. See the documentation for migration instructions.
Starting rtl_433 -c /config/null
rtl_433 version 23.11 branch  at 202311281352 inputs file rtl_tcp RTL-SDR SoapySDR
Failed to stat "/config/null"
[SDR] No supported devices found.
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Testing Steps

  1. Log in with the debug shell in HAOS or using the advanced terminal addon so you can run docker commands.
  2. Pull this PR's image with docker pull ghcr.io/pbkhrv/rtl_433-hass-addons-rtl_433_mqtt_autodiscovery-next-armv7:199-merge, replacing armv7 with whatever architecture your system has from the list at https://github.com/pbkhrv/rtl_433-hass-addons/blob/main/rtl_433/config.json#L8.
  3. Overwrite the normal tag with this image: docker tag ghcr.io/pbkhrv/rtl_433-hass-addons-rtl_433_mqtt_autodiscovery-next-armv7:199-merge ghcr.io/pbkhrv/rtl_433-hass-addons-rtl_433_mqtt_autodiscovery-next-armv7:0.5.2 (replacing the architecture as well.
  4. Stop / start the addon.
  5. You should see rtl_433 version 23.11 branch at 202311281352 inputs file rtl_tcp RTL-SDR SoapySDR in the output, and hopefully it will connect to the radio.
deviantintegral commented 2 months ago

According to https://github.com/merbanan/rtl_433/issues/1335 it looks like this will also need the SoapyHackRF plugin too from https://github.com/pothosware/SoapyHackRF/wiki. I think that will have to be built from source as I don't see an alpine package for it.

deviantintegral commented 2 months ago

I was testing and having trouble getting my hackrf to show up. Then I re-plugged it in and it worked. Unfortunately, it's not picking anything up, and if I remember right it needs settings tweaked. Regardless, I think this branch is ready for others to test now. Here's my console output - I have two radios configured:

Starting rtl_433 with doorbell.conf...
Starting rtl_433 with weather_station-hackrf.conf...
[doorbell] rtl_433 version 23.11 branch  at 202311281352 inputs file rtl_tcp RTL-SDR SoapySDR
[doorbell] 
[doorbell] New defaults active, use "-Y classic -s 250k" if you need the old defaults
[doorbell] 
[doorbell] MQTT: Publishing MQTT data to core-mosquitto port 1883
[doorbell] MQTT: Publishing device info to MQTT topic "rtl_433/local-rtl433/devices[/type][/model][/subtype][/channel][/id]".
[doorbell] MQTT: Publishing events info to MQTT topic "rtl_433/local-rtl433/events".
[doorbell] MQTT: Publishing states info to MQTT topic "rtl_433/local-rtl433/states".
[doorbell] Use "-F log" if you want any messages, warnings, and errors in the console.
[weather_station-hackrf] rtl_433 version 23.11 branch  at 202311281352 inputs file rtl_tcp RTL-SDR SoapySDR
[weather_station-hackrf] Using device HackRF One: clock source=internal part id=a000cb3c00584f58 serial=0000000000000000f77c60dc285e4bc3 version=2023.01.1 
[weather_station-hackrf] Found 1 antenna(s): TX/RX 
[weather_station-hackrf] Found 3 gain(s): LNA 0 - 116 (step 0) AMP 0 - 116 (step 0) VGA 0 - 116 (step 0) 
[weather_station-hackrf] Found 1 frequencies: RF 
[weather_station-hackrf] Found 1 frequency range(s): 0 - 7250000000 (step 0) 
[weather_station-hackrf] Found 20 sample rate range(s): 1000000 2000000 3000000 4000000 5000000 6000000 7000000 8000000 9000000 10000000 11000000 12000000 13000000 14000000 15000000 16000000 17000000 18000000 19000000 20000000 
[weather_station-hackrf] Found 16 bandwidth range(s): 1750000 - 1750000 (step 0) 2500000 - 2500000 (step 0) 3500000 - 3500000 (step 0) 5000000 - 5000000 (step 0) 5500000 - 5500000 (step 0) 6000000 - 6000000 (step 0) 7000000 - 7000000 (step 0) 8000000 - 8000000 (step 0) 9000000 - 9000000 (step 0) 10000000 - 10000000 (step 0) 12000000 - 12000000 (step 0) 14000000 - 14000000 (step 0) 15000000 - 15000000 (step 0) 20000000 - 20000000 (step 0) 24000000 - 24000000 (step 0) 28000000 - 28000000 (step 0) 
[weather_station-hackrf] Found current bandwidth 0
[weather_station-hackrf] Found 4 stream format(s): CS8 CS16 CF32 CF64 
[weather_station-hackrf] Found native stream format: CS8 (full scale: 128.0)
[doorbell] Found Rafael Micro R820T tuner
[doorbell] Exact sample rate is: 1000000.026491 Hz
[doorbell] [R82XX] PLL not locked!
deviantintegral commented 2 months ago

Based on https://github.com/merbanan/rtl_433/issues/1402 I don't think I'll get normal messages with my HackRF. I am getting a few security sensors, but not my normal weather station.