From 5860e8a56aec36e5ebb491708cd1151d07894193 Mon Sep 17 00:00:00 2001 From: Charles Powell Date: Sat, 6 May 2023 12:53:27 -0700 Subject: [PATCH] General cleanup --- senselink/__init__.py | 2 ++ senselink/senselink.py | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/senselink/__init__.py b/senselink/__init__.py index a0be3ae..a393411 100644 --- a/senselink/__init__.py +++ b/senselink/__init__.py @@ -1 +1,3 @@ from .senselink import SenseLink +from .plug_instance import PlugInstance +from .data_source import DataSource, MutableSource, AggregateSource diff --git a/senselink/senselink.py b/senselink/senselink.py index 47a2cae..d6695b5 100644 --- a/senselink/senselink.py +++ b/senselink/senselink.py @@ -122,7 +122,7 @@ class SenseLink: should_respond = True has_aggregate = False - def __init__(self, config, port=9999): + def __init__(self, config=None, port=9999): self.config = config self.port = port self.target = None @@ -195,16 +195,16 @@ def create_instances(self): port = mqtt_conf.get('port') or 1883 username = mqtt_conf.get('username') or None password = mqtt_conf.get('password') or None - mqtt_controller = MQTTController(host, port, username, password) + mqtt_cont = MQTTController(host, port, username, password) # Generate plug instances plugs = mqtt_conf[PLUGS_KEY] logging.info("Generating MQTT instances") - instances = PlugInstance.configure_plugs(plugs, MQTTSource, mqtt_controller) + instances = PlugInstance.configure_plugs(plugs, MQTTSource, mqtt_cont) self.add_instances(instances) # Start controller - mqtt_task = mqtt_controller.connect() + mqtt_task = mqtt_cont.connect() self.tasks.add(mqtt_task) # Aggregate-type Plugs