mendevi.measures.adecwatts.ADECWattmeter

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

>>> import time
>>> from mendevi.measures.adec import ADECWattmeter
>>> with ADECWattmeter() as usage:
...     time.sleep(1)
...
>>>

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=True

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

static guess_port() str[source]

Automaticaly find the port in the list of reachable ports.

run() None[source]

Perform the measures.