From 3c04b164213a8136079908cd9b689cd5e3f84737 Mon Sep 17 00:00:00 2001 From: Wilfred Tyler Gee Date: Thu, 2 May 2024 10:04:01 -1000 Subject: [PATCH] Fix port inconsistency for weatherstation * `port` to `serial_port` consistently. --- src/panoptes/pocs/sensor/weather.py | 10 +++++----- src/panoptes/pocs/utils/service/weather.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/panoptes/pocs/sensor/weather.py b/src/panoptes/pocs/sensor/weather.py index d3216fc53..79e66f2d1 100644 --- a/src/panoptes/pocs/sensor/weather.py +++ b/src/panoptes/pocs/sensor/weather.py @@ -10,14 +10,14 @@ class WeatherStation(PanBase): """ def __init__(self, - port: str = None, + serial_port: str = None, name: str = 'Weather Station', db_collection: str = 'weather', *args, **kwargs): """Initialize the weather station. Args: - port (str, optional): The dev port for the mount, usually the usb-serial converter. + serial_port (str, optional): The dev port for the mount, usually the usb-serial converter. name (str): The user-friendly name for the weather station. db_collection (str): Which collection (i.e. table) to store the values in, default 'weather'. """ @@ -29,12 +29,12 @@ def __init__(self, conf.update(kwargs) conf.pop('auto_detect', None) - self.port = port or conf.get('port', '/dev/ttyUSB0') + self.serial_port = serial_port or conf.get('serial_port', '/dev/ttyUSB0') self.name = name self.collection_name = db_collection - self.logger.debug(f'Setting up weather station connection for {name=} on {self.port}') - self.weather_station = CloudSensor(serial_port=self.port, **conf) + self.logger.debug(f'Setting up weather station connection for {name=} on {self.serial_port}') + self.weather_station = CloudSensor(serial_port=self.serial_port, **conf) self.logger.debug(f'Weather station config: {self.weather_station.config}') self.logger.info(f'{self.weather_station} initialized') diff --git a/src/panoptes/pocs/utils/service/weather.py b/src/panoptes/pocs/utils/service/weather.py index fe7e54ed3..ab9b60b9c 100644 --- a/src/panoptes/pocs/utils/service/weather.py +++ b/src/panoptes/pocs/utils/service/weather.py @@ -21,14 +21,14 @@ async def startup(): if conf.get('auto_detect', False) is True: ports = [p.device for p in get_comports()] else: - ports = [conf['port']] + ports = [conf['serial_port']] # Try to connect to the weather station. for port in ports: if 'ioptron' in port: continue - conf['port'] = port + conf['serial_port'] = port try: weather_station = WeatherStation(**conf) break