summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'main.py')
-rwxr-xr-xmain.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/main.py b/main.py
new file mode 100755
index 0000000..b50962a
--- /dev/null
+++ b/main.py
@@ -0,0 +1,29 @@
+#!/usr/bin/python3
+
+
+"""Main executable for the Package / Service"""
+
+
+import iot_barcode_scanner as ibs
+
+
+def main():
+ try:
+ config = ibs.get_config()
+ mqtt_service = ibs.MqttService(config)
+ mqtt_service.run()
+ print("Starting Service")
+ while True:
+ text = input()
+ mqtt_service.client.publish(
+ config["mqtt"]["topic"],
+ payload=text,
+ qos=0,
+ retain=False
+ )
+ except KeyboardInterrupt:
+ print("Service stopped")
+
+
+if __name__ == "__main__":
+ main()