diff options
author | xengineering <mail2xengineering@protonmail.com> | 2020-09-27 21:12:51 +0200 |
---|---|---|
committer | xengineering <mail2xengineering@protonmail.com> | 2020-09-27 21:12:51 +0200 |
commit | 449b490f233371fe28e9089a05982cd5634285d2 (patch) | |
tree | 64ccdf7879f0312f477cd381b5f10bd01b9dafbb /main.py | |
parent | 30551b56cb20d6cd8dbf72277dc829e0041722ed (diff) | |
download | iot-barcode-scanner-449b490f233371fe28e9089a05982cd5634285d2.tar iot-barcode-scanner-449b490f233371fe28e9089a05982cd5634285d2.tar.zst iot-barcode-scanner-449b490f233371fe28e9089a05982cd5634285d2.zip |
Implement MVP
Diffstat (limited to 'main.py')
-rwxr-xr-x | main.py | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -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() |