Commit faffce95 authored by Peter-Bernd Otte's avatar Peter-Bernd Otte

added relais type

parent e8717535
......@@ -112,6 +112,10 @@ for section in cfg:
MQTTName="homie/"+args.mqtt_client_name+"/"+section
logger.info("Adding Relais with MQTT topic: "+MQTTName)
logger.info("Configuration: "+str(cfg[section]))
relaisType = "relais"
if "type" in cfg[section]:
if cfg[section]["type"] == "dimmer":
relaisType = "dimmer"
if "MQTTRelaisTopic" not in cfg[section]:
logger.error("MQTTRelaisTopic property is missing. Will not be added.")
continue
......@@ -143,7 +147,7 @@ for section in cfg:
switchOffTopics=switchOffTopics,
defaultTopics=defaultTopics, inverseSwitchOnTopics=inverseSwitchOnTopics,
prolongateStateTopics=prolongateStateTopics,
defaultSwitchOffTime=defaultSwitchOffTime, debug=debugItem))
defaultSwitchOffTime=defaultSwitchOffTime, debug=debugItem, relaisType=relaisType))
logger.info("Adding successfully.")
......
......@@ -22,9 +22,9 @@ class rLightDesire(Enum):
class relais:
def __init__(self, MQTTClient, MQTTName, MQTTRelaisTopic, defaultTopics=None, toggleTopics=None, dimmTopics=None,
switchOffTopics=None,
inverseSwitchOnTopics=None, prolongateStateTopics=None, defaultSwitchOffTime=None, debug=False):
inverseSwitchOnTopics=None, prolongateStateTopics=None, defaultSwitchOffTime=None, debug=False, relaisType="relais"):
self.MQTTname = MQTTName #string
self.type = "relais"
self.type = relaisType # possible: "relais" and "dimmer"
self.debug = debug
self.MQTTClient = MQTTClient #object
self.MQTTRelaisTopic = MQTTRelaisTopic #string
......
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