summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormm-chen <github@malte-modler.de>2018-04-09 21:29:04 +0200
committerSebastian Reichel <sre@ring0.de>2018-06-28 01:52:53 +0200
commit764c39f4facfe42d926cd952dcf0f7e2768097a8 (patch)
tree0c08a3808c056169117f1937e79fb403515ae0b3 /src
parentab2ea719ee4a86e082f8d205c1d33a048e1cfe57 (diff)
downloadserial-barcode-scanner-764c39f4facfe42d926cd952dcf0f7e2768097a8.tar.bz2
Display on/off
Turns the display off and on via MQTT
Diffstat (limited to 'src')
-rwxr-xr-xsrc/display-on-off/display-on-off.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/display-on-off/display-on-off.sh b/src/display-on-off/display-on-off.sh
new file mode 100755
index 0000000..23ab10a
--- /dev/null
+++ b/src/display-on-off/display-on-off.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+function getMqttConfig
+{
+ echo `busctl --system call io.mainframe.shopsystem.Config /io/mainframe/shopsystem/config io.mainframe.shopsystem.Config GetString ss MQTT $1 | sed -s "s;s ;;"`
+}
+
+BROKER=$(getMqttConfig broker)
+TOPIC=$(getMqttConfig topic)
+ON=$(getMqttConfig displayOn)
+OFF=$(getMqttConfig displayOff)
+
+mosquitto_sub -h $BROKER -t $TOPIC | while read RAW_DATA
+do
+ case $RAW_DATA in
+ $ON)
+ vbetool dpms on
+ ;;
+ $OFF)
+ vbetool dpms off
+ ;;
+ *)
+ #vbetool dpms on
+ ;;
+ esac
+done