Adding rtl_wmbus and rtl_433 to snap

pull/153/head
BIBOLV 2020-08-23 21:01:28 +03:00
rodzic 78a353de59
commit b5ffbad590
2 zmienionych plików z 28 dodań i 4 usunięć

Wyświetl plik

@ -9,6 +9,9 @@ then
cp $SNAP/etc/wmbusmeters.conf $SNAP_COMMON/etc/wmbusmeters.conf
sed -i "s|^meterfiles=.*|meterfiles=$SNAP_COMMON/logs/meter_readings|g" "$SNAP_COMMON/etc/wmbusmeters.conf"
sed -i "s|^logfile=.*|logfile=$SNAP_COMMON/logs/wmbusmeters.log|g" "$SNAP_COMMON/etc/wmbusmeters.conf"
sed -i "/^device=.*/a listento=t1" "$SNAP_COMMON/etc/wmbusmeters.conf"
sed -i "/^device=.*/a # To use rtl_433 uncomment following line \n#device=rtlwmbus:LD_LIBRARY_PATH=/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/wmbusmeters/x1/lib/x86_64-linux-gnu:/snap/wmbusmeters/x1/usr/lib/x86_64-linux-gnu::/snap/wmbusmeters/x1/lib:/snap/wmbusmeters/x1/usr/lib:/snap/wmbusmeters/x1/lib/x86_64-linux-gnu:/snap/wmbusmeters/x1/usr/lib/x86_64-linux-gnu /snap/wmbusmeters/current/usr/bin/rtl_433 -F csv -f 868.95M" "$SNAP_COMMON/etc/wmbusmeters.conf"
sed -i "/^device=.*/a # To use rtl_wmbus uncomment following line \n#device=rtlwmbus:LD_LIBRARY_PATH=/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/wmbusmeters/x1/lib/x86_64-linux-gnu:/snap/wmbusmeters/x1/usr/lib/x86_64-linux-gnu::/snap/wmbusmeters/x1/lib:/snap/wmbusmeters/x1/usr/lib:/snap/wmbusmeters/x1/lib/x86_64-linux-gnu:/snap/wmbusmeters/x1/usr/lib/x86_64-linux-gnu /snap/wmbusmeters/current/usr/bin/rtl_sdr -f 868.95M -s 1600000 - 2>/dev/null | /snap/wmbusmeters/current/usr/bin/rtl_wmbus" "$SNAP_COMMON/etc/wmbusmeters.conf"
fi
# Launch the snap

Wyświetl plik

@ -7,7 +7,7 @@ description: |
The readings can then be published using MQTT, curled to a REST api,
inserted into a database or stored in a log file.
Following must be executed "sudo snap connect wmbusmeters:raw-usb core:raw-usb"
to allow snap read USB devices and check that root user of your system is
to allow snap read USB devices and check that root user of your system is
added to group that can read USB devices
base: core18
@ -48,22 +48,43 @@ parts:
build-packages:
- g++
- make
- libncurses-dev
- librtlsdr-dev
- libncurses5-dev
stage-packages:
- mosquitto-clients
- curl
- libusb-1.0-0
- rtl-sdr
prime:
- usr/bin/
- usr/lib/
- lib/
- etc/wmbusmeters.conf
rtl-wmbus:
source: "https://github.com/weetmuts/rtl-wmbus.git"
plugin: make
artifacts:
- build/rtl_wmbus
organize:
build/rtl_wmbus: usr/bin/rtl_wmbus
prime:
- usr/bin/rtl_wmbus
rtl-433:
source: "https://github.com/merbanan/rtl_433.git"
plugin: cmake
organize:
bin/rtl_433: usr/bin/rtl_433
prime:
- usr/bin/rtl_433
apps:
wmbusmeters:
command: launcher.sh
command: /bin/sh $SNAP/launcher.sh
daemon: simple
restart-condition: always
plugs:
- network
- network-bind
- raw-usb
- raw-usb