parsers

This Code is partially vendored from: https://github.com/decentlab/decentlab-decoders Which is licensed under the MIT License, which is included in this repo

class element.parsers.ATM41Measurement
Precipitation: ParamReading
class element.parsers.BLGMeasurement
Temperature: ParamReading
class element.parsers.ParamReading[source]
unit: str
value: float
class element.parsers.SHT35Measurement
class element.parsers.SensorContainer[source]
length: int
class element.parsers._Value[source]
convert: NotRequired[Callable[[list[float] | tuple[float, ...]], float]]
name: str
unit: NotRequired[str]
element.parsers._decode(msg, protocol_version, sensors, hex=False) dict[str, BLGMeasurement | ATM41Measurement][source]

msg: payload as one of hex string, list, or bytearray

Return type:

dict[str, BLGMeasurement | ATM41Measurement]

element.parsers.decode_ATM41(msg, hex=False, protocol_version=2) ATM41Measurement[source]

Decode the message returned from the Meter ATM41 weather station (ATM41) sensor.

Parameters:
  • msg (bytes) – byte-string returned e.g. b'02530400038283800080008000803488CD8076815C80CBA708816D817D80197FF680007FDB7FDB0AAE'

  • hex (bool) – whether or not the provided message is in hexadecimals (default: False)

  • protocol_version (int) – The expected version of the protocol. If the protocol_version in the msg does not match this version, an exception will be raised (default: 2)

Return type:

ATM41Measurement

element.parsers.decode_BLG(msg, hex=False, protocol_version=2) BLGMeasurement[source]

Decode the message returned from the blackglobe sensor (BLG).

Parameters:
  • msg (bytes) – byte-string returned e.g. b'0254970003498800830BF7'

  • hex (bool) – whether or not the provided message is in hexadecimals (default: False)

  • protocol_version (int) – The expected version of the protocol. If the protocol_version in the msg does not match this version, an exception will be raised (default: 2)

Return type:

BLGMeasurement

element.parsers.decode_STH35(msg, hex=False, protocol_version=2) SHT35Measurement[source]

Decode the message returned from the temperature and relative humidity sensor (SHT35).

Parameters:
  • msg (bytes) – byte-string returned e.g. b'0254A60003783F596E0C17'

  • hex (bool) – whether or not the provided message is in hexadecimals (default: False)

  • protocol_version (int) – The expected version of the protocol. If the protocol_version in the msg does not match this version, an exception will be raised (default: 2)

Return type:

SHT35Measurement