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

>>> 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.

static guess_port() str[source]

Automaticaly find the port in the list of reachable ports.

run() None[source]

Perform the measures.