Sensors

Sensor Base Class

Plugin and ABC for external sensors, such as weather sensors.

class dronemanager.plugins.sensor.SensorPlugin(dm, logger, name)

Bases: Plugin

PREFIX = 'sensor'
sensors: dict[str, Sensor]
async close()

Stop all missions.

Returns:

sensor_options()
async load(mission_module: str, name: str | None = None)

Load a new sensor, which work like plugins with the name taking the role of the prefix.

Returns:

async status()

Status of running missions and missions that could be loaded.

class dronemanager.plugins.sensor.Sensor(dm, logger, name='YOUDIDSOMETHINGWRONG')

Bases: Plugin, ABC

PREFIX = 'YOUDIDSOMETHINGWRONG'
async start()

This function is called when the sensor plugin is loaded to automatically start any background functions.

async close()

This function must end all running asyncio tasks. By default, all tasks in self._running_tasks are cancelled.

abstractmethod async connect(*args, **kwargs)

Connect to a sensor.

abstractmethod async get_data()

Should return whatever information the sensor provides,

async log_data()
abstractmethod async status()

Should write information about the current status of the sensor to the logger under INFO.

abstractmethod async disconnect()

Disconnect from a sensor. Should handle any socket clearing etc.

async reconnect()

Sensors list

Ecowitt

Sensor package for an ecowitt gw1100

class dronemanager.sensors.ecowitt.WeatherDataEntry(name: str, value: float = math.nan, unit: str = '')

Bases: object

class dronemanager.sensors.ecowitt.WeatherData(timestamp=None)

Bases: object

classmethod from_dict(input_dict, timestamp=None)
parse_xml_entry(entry)
to_json_dict()

Create a json serializable dictionary

classmethod from_json_dict(json_dict)

Recreate the object from a json serialized dictionary

class dronemanager.sensors.ecowitt.EcoWittSensor(dm, logger, name='ecowitt')

Bases: Sensor

Class for EcoWitt Weather stations that support their HTTP API.

async connect(ip: str)

No connection procedure

async get_data() WeatherData | None

Should return whatever information the sensor provides,

async status()

No status as such to report.

async disconnect()

No disconnect procedure.