mendevi.measures.adecwatts

Get the power consumption of as usb plugded ADEC WATTS wattmeters.

Classes

ADECWattmeter([port, no_fail])

Extract the activity of a ADEC-WATTS wattmeter connected to serial usb port.

Details

class mendevi.measures.adecwatts.ADECWattmeter(port: str | None = None, *, no_fail: bool = False)[source]

Extract the activity of a ADEC-WATTS wattmeter connected to serial usb port.

Examples

>>> from mendevi.measures.adecwatts import ADECWattmeter
>>> with ADECWattmeter(no_fail=True) as usage:
...     pass
...
>>>

Initialize the usage context.

Parameters

portstr, default=autodetect

The port to listen on. In gerenal it is “/dev/ttyUSB0”. By default, it is autodetected using :py:meth`guess_port`.

no_failbool, default=False

If False, raise RuntimeError if it fails to get the ADEC measure. Otherwise (if True), return None instead of failing.