diff --git a/Modfile.yaml b/Modfile.yaml index af97a13..bccf447 100644 --- a/Modfile.yaml +++ b/Modfile.yaml @@ -2,7 +2,7 @@ modfileVersion: "v1" id: github.com/SENERGY-Platform/mgw-smart-meter-dc name: Smart Meter Device Connector description: -version: v1.0.5 +version: v1.0.6 type: add-on deploymentType: single services: @@ -80,16 +80,6 @@ configs: type: text name: Device Prefix - discoveryPortFilter: - dataType: string - targets: - - refVar: CONF_DISCOVERY_PORT_FILTER - services: - - connector - userInput: - type: text - name: Discovery Port Filter - deviceType: dataType: string targets: @@ -104,7 +94,7 @@ configs: dataType: string value: /dev/reader targets: - - refVar: CONF_DISCOVERY_BASE_PATH + - refVar: CONF_DISCOVERY_FULL_PATH services: - connector userInput: diff --git a/smart_meter/discovery.py b/smart_meter/discovery.py index 103d1dc..33bff92 100644 --- a/smart_meter/discovery.py +++ b/smart_meter/discovery.py @@ -107,13 +107,13 @@ def run(self) -> None: if self.__refresh_flag: self.__refresh_devices() try: - ports = get_ports() - logger.debug("available ports: {}".format(ports)) - active_ports = [device.adapter.source for device in self.__device_pool.values() if device.adapter and type(device.adapter) is SerialAdapter] - logger.debug("active ports {}".format(active_ports)) - inactive_ports = list(set(ports) - set(active_ports)) - logger.debug("inactive ports {}".format(inactive_ports)) - self.__add_devices(probe_ports(inactive_ports)) + #ports = get_ports() + #logger.debug("available ports: {}".format(ports)) + #active_ports = [device.adapter.source for device in self.__device_pool.values() if device.adapter and type(device.adapter) is SerialAdapter] + #logger.debug("active ports {}".format(active_ports)) + #inactive_ports = list(set(ports) - set(active_ports)) + #logger.debug("inactive ports {}".format(inactive_ports)) + self.__add_devices(probe_ports(conf.Discovery.full_path)) self.__clean_devices() except Exception as ex: logger.error("discovery failed - {}".format(ex)) diff --git a/util/config.py b/util/config.py index f095de8..fa30deb 100644 --- a/util/config.py +++ b/util/config.py @@ -44,6 +44,7 @@ class Discovery: device_id_prefix = None base_path = "/dev" port_filter = None + full_path = None delay = 15 @simple_env_var.section