Commit 873a913b authored by Peter-Bernd Otte's avatar Peter-Bernd Otte

Update python/relais-control/relais-control.py,...

Update python/relais-control/relais-control.py, python/enocean-concentrator/enocean-concentrator.py files
parent 1fa9fe9b
#!/usr/bin/python
#!/usr/bin/python3
import paho.mqtt.client as paho
import json
import time
from datetime import datetime
import re
import os
import logging, argparse
import sys
import yaml # pip3 install pyyaml
......@@ -15,7 +16,7 @@ logger = logging.getLogger("Concentrator")
parser = argparse.ArgumentParser(description='Workload distributor for trivial parallelism.')
parser.add_argument("-v", "--verbosity", help="increase output verbosity", default=0, action="count")
parser.add_argument("-c", "--config-file", help="provide filepath for YAML configuration file", default="config.yml", type=str)
parser.add_argument("-b", "--mqtt-broker-host", help="MQTT broker hostname", default="locahlhost")
parser.add_argument("-b", "--mqtt-broker-host", help="MQTT broker hostname", default="localhost")
parser.add_argument("mqtt_client_name", help="MQTT client name. Needs to be unique in the MQTT namespace, eg enocean-eg-concentrator.", type=str)
args = parser.parse_args()
logger.setLevel(logging.WARNING-(args.verbosity*10 if args.verbosity <=2 else 20) )
......@@ -34,7 +35,7 @@ with open(args.config_file, 'r') as ymlfile:
data = {k.lower(): v for k, v in data.items()} #make all dict keys lowercase
for k,v in data.items():
if v['type'] not in supportedSensors:
logger.error("In senders file, type: "+v['type']+" is not supported.")
logger.error("In configuration file ('"+args.config_file+"'), type: "+v['type']+" is not supported.")
sys.exit(1)
def on_connect(client, userdata, flags, rc):
......@@ -147,4 +148,4 @@ while True:
client.disconnect()
client.loop_stop()
logger.info("Program stopped.")
\ No newline at end of file
logger.info("Program stopped.")
......@@ -15,7 +15,7 @@ logger = logging.getLogger("Actor")
parser = argparse.ArgumentParser(description='Workload distributor for trivial parallelism.')
parser.add_argument("-v", "--verbosity", help="increase output verbosity", default=0, action="count")
parser.add_argument("-c", "--config-file", help="provide filepath for YAML configuration file", default="config.yml", type=str)
parser.add_argument("-b", "--mqtt-broker-host", help="MQTT broker hostname", default="locahlhost")
parser.add_argument("-b", "--mqtt-broker-host", help="MQTT broker hostname", default="localhost")
parser.add_argument("mqtt_client_name", help="MQTT client name. Needs to be unique in the MQTT namespace, eg fsr-ww.", type=str)
args = parser.parse_args()
logger.setLevel(logging.WARNING-(args.verbosity*10 if args.verbosity <=2 else 20) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment