Cześć, próbuję uruchomić wmbusmeters - dokładniej, zapis odczytów do pliku, dalej jeszcze nie grzebałem.
- zainstalowałem rtl_sdr:
apt install rtl-sdr
- skompilowałem rtl_wmbus:
git clone https://github.com/xaelsouth/rtl-wmbus.git
cd rtl_wmbus
make
make install
- Weryfikacja czy otrzymuję dane - tak, dostaję przykładowe ramki:
/usr/bin/rtl_sdr -f 868.9M -s 1.6e6 - | /usr/bin/rtl_wmbus
Przykładowa ramka:
"T1;1;1;2022-02-16 05:57:27.000;135;129;21136099;0x1944304c99601321cc01a2011b001310a0b9b92e702c8cccdf9a<0A>"
- Zainstalowałem wmbusmeters:
git clone https://github.com/weetmuts/wmbusmeters.git
cd wmbusmeters
./configure
make install
- Ustawiłem plik /etc/wmbusmeters.conf:
loglevel=debug
device=rtlwmbus:868.9M
logtelegrams=false
format=json
meterfiles=/var/log/wmbusmeters/meter_readings
meterfilesaction=append
logfile=/var/log/wmbusmeters/wmbusmeters.log
- Stworzyłem plik konfiguracyjny /etc/wmbusmeters.d/adaptor21136099:
name=izar21136099
type=izar
id=21136099
key=00000000000000000000000000000000
Teraz próbowałem startować wg różnych znalezionych instrukcji:
systemctl start wmbusmeters@-dev-rtlsdr_2.service
To jednak nie zadziałało, nie widzę w /dev/ żadnego urządzenia z rtlsdr w nazwie.
Za to w dmesg:
[314504.164545] rtl2832 11-0010: Realtek RTL2832 successfully attached
[314504.164668] usb 1-1.1.3: DVB: registering adapter 0 frontend 0 (Realtek RTL2832 (DVB-T))...
[314504.164717] dvbdev: dvb_create_media_entity: media entity 'Realtek RTL2832 (DVB-T)' registered.
[314504.171727] i2c i2c-12: fc0012: Fitipower FC0012 successfully identified
[314504.200798] rtl2832_sdr rtl2832_sdr.0.auto: Registered as swradio0
[314504.200818] rtl2832_sdr rtl2832_sdr.0.auto: Realtek RTL2832 SDR attached
[314504.200843] rtl2832_sdr rtl2832_sdr.0.auto: SDR API is still slightly experimental and functionality changes may follow
[314504.209802] Registered IR keymap rc-empty
[314504.210047] rc rc0: Realtek RTL2832U reference design as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.3/rc/rc0
[314504.210270] rc rc0: lirc_dev: driver dvb_usb_rtl28xxu registered at minor = 0, raw IR receiver, no transmitter
[314504.210501] input: Realtek RTL2832U reference design as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.3/rc/rc0/input7
[314504.212622] usb 1-1.1.3: dvb_usb_v2: schedule remote query interval to 200 msecs
[314504.221148] usb 1-1.1.3: dvb_usb_v2: 'Realtek RTL2832U reference design' successfully initialized and connected
[315159.851602] dvb_usb_v2: 'Realtek RTL2832U reference design:1-1.1.3' successfully deinitialized and disconnected
[315572.221315] usb 1-1.1.3: dvb_usb_v2: found a 'Realtek RTL2832U reference design' in warm state
[315572.251927] usb 1-1.1.3: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer
[315572.251978] dvbdev: DVB: registering new adapter (Realtek RTL2832U reference design)
[315572.252000] usb 1-1.1.3: media controller created
[315572.255260] dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered.
[315572.288816] i2c i2c-11: Added multiplexed i2c bus 12
[315572.288842] rtl2832 11-0010: Realtek RTL2832 successfully attached
[315572.289036] usb 1-1.1.3: DVB: registering adapter 0 frontend 0 (Realtek RTL2832 (DVB-T))...
[315572.289071] dvbdev: dvb_create_media_entity: media entity 'Realtek RTL2832 (DVB-T)' registered.
[315572.296262] i2c i2c-12: fc0012: Fitipower FC0012 successfully identified
[315572.307907] rtl2832_sdr rtl2832_sdr.0.auto: Registered as swradio0
[315572.307925] rtl2832_sdr rtl2832_sdr.0.auto: Realtek RTL2832 SDR attached
[315572.307933] rtl2832_sdr rtl2832_sdr.0.auto: SDR API is still slightly experimental and functionality changes may follow
[315572.320387] Registered IR keymap rc-empty
[315572.320570] rc rc0: Realtek RTL2832U reference design as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.3/rc/rc0
[315572.320759] rc rc0: lirc_dev: driver dvb_usb_rtl28xxu registered at minor = 0, raw IR receiver, no transmitter
[315572.321093] input: Realtek RTL2832U reference design as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.3/rc/rc0/input8
[315572.321468] usb 1-1.1.3: dvb_usb_v2: schedule remote query interval to 200 msecs
[315572.329876] usb 1-1.1.3: dvb_usb_v2: 'Realtek RTL2832U reference design' successfully initialized and connected
[315577.752908] dvb_usb_v2: 'Realtek RTL2832U reference design:1-1.1.3' successfully deinitialized and disconnected
(chociaż teraz nie wiem dlaczego ostatni komunikat jest jako disconnected )
Wystartowało dopiero przy tej komendzie:
sudo systemctl start wmbusmeters
i… /var/log/wmbusmeters/wmbusmeters.log teoretycznie łapie dane:
(main) rtl_wmbus found in path
(main) rtlsdr device 00000001 not currently used.
(main) found specified device (rtlwmbus:868.9M) that matches detected device (:rtlwmbus[00000001]:0/0)
(main) opening rtlwmbus:868.9M
[2022-02-16_07:40:44] Started config rtlwmbus[00000001] listening on none using fq 868.9M
(rtlwmbus) using command: /usr/bin/rtl_sdr -d 0 -f 868.9M -s 1.6e6 - 2>/dev/null | /usr/bin/rtl_wmbus
(rtlwmbus) opening 00000001
(serial) EVENT thread interrupted
(bgshell) exec background "/bin/sh"
(bgshell) arg "-c"
(bgshell) arg "/usr/bin/rtl_sdr -d 0 -f 868.9M -s 1.6e6 - 2>/dev/null | /usr/bin/rtl_wmbus"
(serialcmd) opened /bin/sh pid 1319 fd 6 (rtlwmbus)
(main) regular reset of rtlwmbus will happen every 82800 seconds
(wmbus) no alarm (expected activity) for rtlwmbus
(serial) registered regular callback HOT_PLUG_DETECTOR(0) every 2 seconds
(wmbusmeters) waiting for telegrams
No meters configured. Printing id:s of all telegrams heard!
(serial) waiting for stop
[2022-02-16_07:40:46] (memory) rss 3317760 peak 3.16 MiB
(serial) received ascii "T1;1;1;2022-02-16 06:40:52.000;128;165;21136099;0x1944304c99601321cc01a2511b001310d42bd629d6b0327ba292<0A>"
(rtlwmbus) checkRTLWMBusFrame "T1;1;1;2022-02-16 06:40:52.000;128;165;21136099;0x1944304c99601321cc01a2511b001310d42bd629d6b0327ba292<0A>"
(rtlwmbus) received full frame
(diehl) preprocess necessary SAP_PRIOS
(diehl) Pre-processing: setting device type to water meter for SAP PRIOS
(wmbus) parseDLL @0 26
(telegram) DLL L=19 C=44 (from meter SND_NR) M=4c30 (SAP) A=21136099 VER=00 TYPE=07 (Water meter) (driver izar) DEV=rtlwmbus[00000001] RSSI=128
(wmbus) parseELL @10 16
(wmbus) parseNWL @10 16
(wmbus) parseAFL @10 16
(wmbus) parseTPL @10 16
(telegram) TPL CI=a2
Received telegram from: 21136099
manufacturer: (SAP) Sappel (0x4c30)
type: Water meter (0x07)
ver: 0x00
device: rtlwmbus[00000001]
rssi: 128 dBm
driver: izar
(wmbus) 000 : 19 length (25 bytes)
(wmbus) 001 : 44 dll-c (from meter SND_NR)
(wmbus) 002 : 304c dll-mfct (SAP)
(wmbus) 004 : 99601321 dll-id (21136099)
(wmbus) 008 : 00 dll-version
(wmbus) 009 : 07 dll-type (Water meter)
(wmbus) 010 : a2 tpl-ci-field (Mfct specific)
(wmbus) 011 C?: 511B001310D42BD629D6B0327BA292 mfct specific
Późniejsze logi wyglądają już tak:
(serial) received ascii "T1;1;1;2022-02-16 06:47:49.000;129;116;21136099;0x1944304c99601321cc01a2511b001310d72bd629d6b0327ba292<0A>"
(rtlwmbus) checkRTLWMBusFrame "T1;1;1;2022-02-16 06:47:49.000;129;116;21136099;0x1944304c99601321cc01a2511b001310d72bd629d6b0327ba292<0A>"
(rtlwmbus) received full frame
(wmbus) skipping already handled telegram.
(serial) received ascii "T1;1;1;2022-02-16 06:47:57.000;129;120;21136099;0x1944304c99601321cc01a2611b001310ee5a0cd4b4c458168995<0A>"
(rtlwmbus) checkRTLWMBusFrame "T1;1;1;2022-02-16 06:47:57.000;129;120;21136099;0x1944304c99601321cc01a2611b001310ee5a0cd4b4c458168995<0A>"
(rtlwmbus) received full frame
(wmbus) skipping already handled telegram.
(serial) received ascii "T1;0;0;2022-02-16 06:48:06.000;91;113;FFFFFFFF;0x1944ffffffffffffffffffffffffffffffffffffffffffffffff<0A>"
(rtlwmbus) checkRTLWMBusFrame "T1;0;0;2022-02-16 06:48:06.000;91;113;FFFFFFFF;0x1944ffffffffffffffffffffffffffffffffffffffffffffffff<0A>"
(rtlwmbus) telegram received but incomplete or with errors, since rtl_wmbus reports that CRC checks failed.
(rtlwmbus) error in received message.
(serial) received ascii "T1;1;1;2022-02-16 06:48:06.000;129;117;21136099;0x1944304c99601321cc01a2711b001310f975457f951781cd9097<0A>"
(rtlwmbus) checkRTLWMBusFrame "T1;1;1;2022-02-16 06:48:06.000;129;117;21136099;0x1944304c99601321cc01a2711b001310f975457f951781cd9097<0A>"
(rtlwmbus) received full frame
(wmbus) skipping already handled telegram.
Ale folder /var/log/wmbusmeters/meter_readings jest cały czas pusty.
Wcześniej zrobiłem błąd i źle nazwałem plik w wmbusmeters.d (+ zły sterownik) - kiedy zmieniłem mu nazwę nagle pojawiły się oba - ze starą i nową nazwą w log. Usunąłem oba żeby zacząć od zera, ale nic się nie pojawia…
Co może być tego przyczyną? Jest jakiś konfigurowalny czas po jakim pliki się pojawiają?
Docelowo chciałem przesyłać dane do bazy i na home assistanta, ale zatrzymałem się w tym momencie