pbkhrv / rtl_433-hass-addons

Collection of Home Assistant add-ons that use rtl_433
225 stars 103 forks source link

Bug: Logging gets truncated #24

Closed BarryMar closed 2 years ago

BarryMar commented 2 years ago

In trying to diagnose the problems in https://github.com/pbkhrv/rtl_433-hass-addons/issues/23 on my Raspberry Pi, I noticed that the Log output provided in the Home Assistant UI was initially truncated and didn't show what the full startup messaging looks like.

For example, if I run the following command in HAOS Root:

docker run --device /dev/bus/usb/001/003 hertzg/rtl_433:debian -f 915M

... the initial console output looks like this:

# docker run --device /dev/bus/usb/001/003 hertzg/rtl_433:debian -f 915M
rtl_433 version 21.05 (2020-05-09) inputs file rtl_tcp RTL-SDR SoapySDR with TLS
Use -h for usage help and see https://triq.org/ for documentation.
Trying conf file at "rtl_433.conf"...
Trying conf file at "/root/.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" for the old defaults!

Registered 157 out of 186 device decoding protocols [ 1-4 8 11-12 15-17 19-23 25-26 29-36 38-60 63 67-71 73-100 102-105 108-116 119 121 124-128 130-149 151-161 163-168 170-175 177-186 ]
Detached kernel driver
Found Rafael Micro R820T tuner
Exact sample rate is: 1000000.026491 Hz
[R82XX] PLL not locked!
Sample rate set to 1000000 S/s.
Tuner gain set to Auto.
Tuned to 915.000MHz.
Allocating 15 zero-copy buffers
baseband_demod_FM: low pass filter for 1000000 Hz at cutoff 200000 Hz, 5.0 us
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
time      : 2021-10-25 00:13:26
model     : LaCrosse-TH3 Sensor ID : 13efb7
Sequence  : 0            unknown   : 0             Temperature: 22.9 C       Humidity  : 37 %          Integrity : CRC

But if I run my (currently malfunctioning) rtl_433-hass-addons setup the header info gets chopped off and it starts much deeper in the sequence. I took the default rtl_433.example.conf and just changed the contents to match what I needed in the base config.

    [94]  Philips outdoor temperature sensor (type AJ3650)
    [95]  Schrader TPMS EG53MA4, PA66GF35
    [96]  Nexa
    [97]  Thermopro TP08/TP12/TP20 thermometer
    [98]  GE Color Effects
    [99]  X10 Security
    [100]  Interlogix GE UTC Security Devices
    [101]* Dish remote 6.3
    [102]  SimpliSafe Home Security System (May require disabling automatic gain for KeyPad decodes)
    [103]  Sensible Living Mini-Plant Moisture Sensor
    [104]  Wireless M-Bus, Mode C&T, 100kbps (-f 868950000 -s 1200000)
    [105]  Wireless M-Bus, Mode S, 32.768kbps (-f 868300000 -s 1000000)
    [106]* Wireless M-Bus, Mode R, 4.8kbps (-f 868330000)
    [107]* Wireless M-Bus, Mode F, 2.4kbps
    [108]  Hyundai WS SENZOR Remote Temperature Sensor
    [109]  WT0124 Pool Thermometer
    [110]  PMV-107J (Toyota) TPMS
    [111]  Emos TTX201 Temperature Sensor
    [112]  Ambient Weather TX-8300 Temperature/Humidity Sensor
    [113]  Ambient Weather WH31E Thermo-Hygrometer Sensor, EcoWitt WH40 rain gauge
    [114]  Maverick et73
    [115]  Honeywell ActivLink, Wireless Doorbell
    [116]  Honeywell ActivLink, Wireless Doorbell (FSK)
    [117]* ESA1000 / ESA2000 Energy Monitor
    [118]* Biltema rain gauge
    [119]  Bresser Weather Center 5-in-1
    [120]* Digitech XC-0324 temperature sensor
    [121]  Opus/Imagintronix XT300 Soil Moisture
    [122]* FS20
    [123]* Jansite TPMS Model TY02S
    [124]  LaCrosse/ELV/Conrad WS7000/WS2500 weather sensors
    [125]  TS-FT002 Wireless Ultrasonic Tank Liquid Level Meter With Temperature Sensor
    [126]  Companion WTR001 Temperature Sensor
    [127]  Ecowitt Wireless Outdoor Thermometer WH53/WH0280/WH0281A
    [128]  DirecTV RC66RX Remote Control
    [129]* Eurochron temperature and humidity sensor
    [130]  IKEA Sparsnas Energy Meter Monitor
    [131]  Microchip HCS200 KeeLoq Hopping Encoder based remotes
    [132]  TFA Dostmann 30.3196 T/H outdoor sensor
    [133]  Rubicson 48659 Thermometer
    [134]  Holman Industries iWeather WS5029 weather station (newer PCM)
    [135]  Philips outdoor temperature sensor (type AJ7010)
    [136]  ESIC EMT7110 power meter
    [137]  Globaltronics QUIGG GT-TMBBQ-05
    [138]  Globaltronics GT-WT-03 Sensor
    [139]  Norgo NGE101
    [140]  Elantra2012 TPMS
    [140]  Elantra2012 TPMS
    [141]  Auriol HG02832, HG05124A-DCF, Rubicson 48957 temperature/humidity sensor
    [142]  Fine Offset Electronics/ECOWITT WH51 Soil Moisture Sensor
    [143]  Holman Industries iWeather WS5029 weather station (older PWM)
    [144]  TBH weather sensor
    [145]  WS2032 weather station
    [146]  Auriol AFW2A1 temperature/humidity sensor
    [147]  TFA Drop Rain Gauge 30.3233.01
    [148]  DSC Security Contact (WS4945)
    [149]  ERT Standard Consumption Message (SCM)
    [150]* Klimalogg
    [151]  Visonic powercode
    [152]  Eurochron EFTH-800 temperature and humidity sensor
    [153]  Cotech 36-7959 wireless weather station with USB
    [154]  Standard Consumption Message Plus (SCMplus)
    [155]  Fine Offset Electronics WH1080/WH3080 Weather Station (FSK)
    [156]  Abarth 124 Spider TPMS
    [157]  Missil ML0757 weather station
    [158]  Sharp SPC775 weather station
    [159]  Insteon
    [160]  ERT Interval Data Message (IDM)
    [161]  ERT Interval Data Message (IDM) for Net Meters
    [162]* ThermoPro-TX2 temperature sensor
    [163]  Acurite 590TX Temperature with optional Humidity
    [164]  Security+ 2.0 (Keyfob)
    [165]  TFA Dostmann 30.3221.02 T/H Outdoor Sensor
    [166]  LaCrosse Technology View LTV-WSDTH01 Breeze Pro Wind Sensor
    [167]  Somfy RTS
    [168]  Schrader TPMS SMD3MA4 (Subaru)
    [169]* Nice Flor-s remote control for gates
    [170]  LaCrosse Technology View LTV-WR1 Multi Sensor
    [171]  LaCrosse Technology View LTV-TH Thermo/Hygro Sensor
    [172]  Bresser Weather Center 6-in-1, 7-in-1 indoor, new 5-in-1, 3-in-1 wind gauge, Froggit WH6000, Ventus C8488A
    [173]  Bresser Weather Center 7-in-1
    [174]  EcoDHOME Smart Socket and MCEE Solar monitor
    [175]  LaCrosse Technology View LTV-R1 Rainfall Gauge
    [176]  BlueLine Power Monitor
    [177]  Burnhard BBQ thermometer
    [178]  Security+ (Keyfob)
    [179]  Cavius smoke, heat and water detector
    [180]  Jansite TPMS Model Solar
    [181]  Amazon Basics Meat Thermometer
    [182]  TFA Marbella Pool Thermometer
    [183]  Auriol AHFL temperature/humidity sensor
    [184]  Auriol AFT 77 B2 temperature sensor 
    [185]  Honeywell CM921 Wireless Programmable Room Thermostat
    [186]  Hyundai TPMS (VDO)
* Disabled by default, use -R n or -G
[cmd] /run.sh exited 1
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

Is it possible to slow down the initial startup of the code with a SLEEP or something so the logger can properly capture more debug info?

deviantintegral commented 2 years ago

I don't think this is a rate limiting issue, as we'd likely see much more corruption of the output. My guess is something is setting the width of the terminal incorrectly, though we don't do anything like that in the addon.

This may be already fixed in #14. Running there, I can see multiline output correctly, such as this which wraps at my browser width:

[doorbell] baseband_demod_FM: low pass filter for 1000000 Hz at cutoff 200000 Hz, 5.0 us[weather_station] Use -h for usage help and see https://triq.org/ for documentation.

Or, is it possible it's a UI bug on the web side? Can you horizontally scroll the text if you have a trackpad?

BarryMar commented 2 years ago

OK, so I figured out what causes the weirdness to happen.

There's no horizontal scroll bar at the bottom of the log window, so it doesn't look like a width problem Screen Shot Failed - Top Screen Shot Failed - Bottom

However, I did get an interesting result when I intentionally misconfigured the rtl_433_conf_file variable to a nonexistant file - I can see the startup messages now and the device seems to be recognized. So I rewrote the config file again from scratch and can see normal startup stuff now. MQTT isn't working, but figuring out how that is supposed to work I'll leave for another day.

Screen Shot - Working

So in this case it looks like I wasn't actually getting slammed by the armhf issue on my HA0S setup because it must be using ARM64 of some sort or other? The other issue is still a valid problem if there are any folks using 32bit HAOS or normal RPOS Supervised installations.

When I took the same configuration file I was using back to the Mac and ran it, it gave me a "Protocol number specified (187) is larger than number of protocols" error. This in turn spits out a list of protocols it supports, of which the tail end is what we're seeing in the first two screenshots. Turns out the default file found at https://github.com/merbanan/rtl_433/blob/master/conf/rtl_433.example.conf has configurations for protocols 187 - 199. Comment them out and everything works great.

Looks like a warning in https://github.com/pbkhrv/rtl_433-hass-addons/blob/main/rtl_433/README.md is worthwhile here to not include those protocols. Maybe they only apply to a later RTL_433 build or something?

It would also be nice to be able to see all the spew from rtl_433 when a bad configuration file like that is sent to it.

deviantintegral commented 2 years ago

So in this case it looks like I wasn't actually getting slammed by the armhf

armhf is different than armv7l. I also have an HA installation on a Raspberry Pi 4, and I'm able to run rtl_433 fine using Alpine 3.14. Let's keep any discussion of that over at #23 .

it gave me a "Protocol number specified (187) is larger than number of protocols" error.

Yes, that's because you're using the configuration from "master" which represents the in-development work. You'd need to switch to the 21.05 tag from the dropdown to see the example config from that version.

A similar topic came up recently on the forums: https://community.home-assistant.io/t/home-assistant-add-on-rtl-433-with-mqtt-auto-discovery/260665/105?u=deviantintegral

Since it sounds like the logging issue is solved, are we good to close this?