Provides a base class for temperature monitor devices or mock devices.
Attributes
Classes
TemperatureMonitorBase(name=None)
Bases: Device
The base class for temperature monitor devices or mock devices.
Source code in frog/hardware/device.py
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363 | def __init__(self, name: str | None = None) -> None:
"""Create a new Device.
Args:
name: A name to distinguish devices of the same type.
"""
self.topic = f"device.{self._device_base_type_info.name}"
"""The name of the root pubsub topic on which this device will broadcast."""
self.name = name
"""The (optional) name of this device to use in pubsub messages."""
self._subscriptions: list[tuple[Callable, str]] = []
"""Store of wrapped functions which are subscribed to pubsub messages."""
self._is_open = False
"""Whether the device has finished opening."""
if not self._device_base_type_info.names_short:
if name:
raise RuntimeError(
"Name provided for device which cannot accept names."
)
return
if name not in self._device_base_type_info.names_short:
raise RuntimeError("Invalid name given for device")
self.topic += f".{name}"
|
Functions
get_temperatures()
abstractmethod
Get the current temperatures.
Source code in frog/hardware/plugins/temperature/temperature_monitor_base.py
| @abstractmethod
def get_temperatures(self) -> Sequence:
"""Get the current temperatures."""
|