usb scripts for openwrt

This commit is contained in:
2021-08-29 22:11:28 +02:00
parent 40c6dcd431
commit d1e4f386c3
2 changed files with 26 additions and 0 deletions

View File

@@ -5,3 +5,7 @@ config capture
option file camera.jpg option file camera.jpg
option url https://meranie.bh.ttx.sk/upload/image option url https://meranie.bh.ttx.sk/upload/image
option time 300 option time 300
config post
option host 172.16.1.254
option topic home/sensor/strecha/bme280
option mqtt_prg mosquitto_pub

View File

@@ -25,5 +25,27 @@ parse_capture() {
rm $_file rm $_file
} }
parse_post() {
local section="$1"
local _host
local _topic
local _mqtt_prg
config_get _host "$section" "host"
config_get _topic "$section" "topic"
config_get _mqtt_prg "$section" "mqtt_prg"
_tmp=`$PROG --temperature`
_hum=`$PROG --humidity`
_pre=`$PROG --pressure`
$_mqtt_prg -h $_host -t $_topic/temperature -m N:$_tmp
$_mqtt_prg -h $_host -t $_topic/humidity -m N:$_hum
$_mqtt_prg -h $_host -t $_topic/pressure -m N:$_pre
}
config_load usbserial config_load usbserial
config_foreach parse_capture capture config_foreach parse_capture capture
config_foreach parse_post post