""" Bosh Sensortec sensors on MCU bridge modules - messages are 7-20b long """ from dataclasses import dataclass, field from typing import Tuple, Dict import struct from pms import WrongMessageFormat, WrongMessageChecksum, SensorWarmingUp from pms.sensor import base commands = base.Commands( passive_read=base.Cmd(b"\xA5\x56\x01\xFC", b"\x5A\x5A\x3F\x0F", 20), passive_mode=base.Cmd(b"\xA5\x56\x01\xFC", b"\x5A\x5A\x3F\x0F", 20), active_mode=base.Cmd(b"\xA5\x56\x02\xFD", b"\x5A\x5A\x3F\x0F", 20), sleep=base.Cmd(b"", b"", 0), wake=base.Cmd(b"", b"", 0), ) class Message(base.Message): """Messages from mcu680 modules with a BME680 sensor""" data_records = slice(7) @property def header(self) -> bytes: return self.message[:4] @property
""" Plantower PMS3003 sensors - do not support commands - messages are 24b long """ from dataclasses import dataclass, field from typing import Tuple import struct from pms import WrongMessageFormat, WrongMessageChecksum, SensorWarmingUp from pms.sensor import base commands = base.Commands( passive_read=base.Cmd(b"", b"\x42\x4D\x00\x14", 24), passive_mode=base.Cmd(b"", b"\x42\x4D\x00\x14", 24), active_mode=base.Cmd(b"", b"\x42\x4D\x00\x14", 24), sleep=base.Cmd(b"", b"\x42\x4D\x00\x14", 24), wake=base.Cmd(b"", b"\x42\x4D\x00\x14", 24), ) class Message(base.Message): """Messages from Plantower PMS3003 sensors""" data_records = slice(6) @property def header(self) -> bytes: return self.message[:4]
""" NovaFitness SDS198 sensors - messages are 10b long - only PM100 measurements """ from dataclasses import dataclass, field from pms.sensor import base from . import sds01x commands = sds01x.commands._replace(passive_read=base.Cmd( b"\xAA\xB4\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF\x02\xAB", b"\xAA\xCF", 10, )) class Message(sds01x.Message): """Messages from NovaFitness SDS011, SDS018 and SDS021 sensors""" data_records = slice(1, 2) @dataclass(frozen=False) class ObsData(base.ObsData): """SDS198 observations time measurement time [seconds since epoch] pm100 PM100 [ug/m3] """
""" Plantower PMS5003ST sensors - messages are 40b long - 6 size bins (as PMS5003). HCHO concentration, temperature and relative humidity """ from dataclasses import dataclass, field from typing import Tuple import struct from pms.sensor import base from . import pms3003, pmsx003, pms5003s commands = base.Commands( passive_read=base.Cmd(pmsx003.commands.passive_read.command, b"\x42\x4D\x00\x24", 40), passive_mode=pmsx003.commands.passive_mode, active_mode=base.Cmd(pmsx003.commands.active_mode.command, b"\x42\x4D\x00\x24", 40), sleep=pmsx003.commands.sleep, wake=base.Cmd(pmsx003.commands.wake.command, b"\x42\x4D\x00\x24", 40), ) class Message(pms3003.Message): """Messages from Plantower PMS5003ST sensors""" data_records = slice(15) @staticmethod def _unpack(message: bytes) -> Tuple[int, ...]: if len(message) == 34:
""" Plantower PMS1003, PMS5003, PMS7003 and PMSA003 sensors - messages are 32b long """ from dataclasses import dataclass from pms import InconsistentObservation from pms.sensor import base from . import pms3003 commands = base.Commands( passive_read=base.Cmd(b"\x42\x4D\xE2\x00\x00\x01\x71", b"\x42\x4D\x00\x1c", 32), passive_mode=base.Cmd(b"\x42\x4D\xE1\x00\x00\x01\x70", b"\x42\x4D\x00\x04", 8), active_mode=base.Cmd(b"\x42\x4D\xE1\x00\x01\x01\x71", b"\x42\x4D\x00\x1c", 32), sleep=base.Cmd(b"\x42\x4D\xE4\x00\x00\x01\x73", b"\x42\x4D\x00\x04", 8), wake=base.Cmd(b"\x42\x4D\xE4\x00\x01\x01\x74", b"\x42\x4D\x00\x1c", 32), ) class Message(pms3003.Message): """Messages from Plantower PMS1003, PMS5003, PMS7003 and PMSA003 sensors""" data_records = slice(12) @dataclass(frozen=False) class ObsData(pms3003.ObsData):
- message protocol implements byte-stuffing - there is no active mode read - passive read messages are 47b long - empty read messages are 7b long """ from dataclasses import dataclass, field from typing import Tuple import struct from pms import WrongMessageFormat, WrongMessageChecksum, SensorWarmingUp from pms.sensor import base commands = base.Commands( # Read Measured Values passive_read=base.Cmd(b"\x7E\x00\x03\x00\xFC\x7E", b"\x7E\x00\x03\x00\x28", 47), passive_mode=base.Cmd(b"", b"", 0), active_mode=base.Cmd(b"", b"", 0), # Stop Measurement sleep=base.Cmd(b"\x7E\x00\x01\x00\xFE\x7E", b"\x7E\x00\x01\x00\x00", 7), # Start Measurement wake=base.Cmd(b"\x7E\x00\x00\x02\x01\x03\xF9\x7E", b"\x7E\x00\x00", 7), ) class Message(base.Message): """Messages from Senserion SPS30 sensors""" data_records = slice(10) @property
""" NovaFitness SDS011, SDS018 and SDS021 sensors - messages are 10b long """ from dataclasses import dataclass, field from typing import Tuple import struct from pms import WrongMessageFormat, WrongMessageChecksum, SensorWarmingUp from pms.sensor import base commands = base.Commands( passive_read=base.Cmd( b"\xAA\xB4\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF\x02\xAB", b"\xAA\xC0", 10, ), passive_mode=base.Cmd( b"\xAA\xB4\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF\x02\xAB", b"\xAA\xC5", 10, ), active_mode=base.Cmd( b"\xAA\xB4\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF\x01\xAB", b"\xAA\xC5", 10, ), sleep=base.Cmd( b"\xAA\xB4\x06\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF\x05\xAB", b"\xAA\xC5",
""" Honeywell HPMA115C0 sensors - passive mode messages are 16b long - active mode messages are 32b long """ from dataclasses import dataclass, field from pms.sensor import base from . import hpma115s0 commands = hpma115s0.commands._replace( passive_read=base.Cmd( # Read Particle Measuring Results b"\x68\x01\x04\x93", b"\x40\x05\x04", 16)) class Message(hpma115s0.Message): """Messages from Honeywell HPMA115C0 sensors""" data_records = slice(4) @dataclass(frozen=False) class ObsData(base.ObsData): """Observations from Honeywell HPMA115C0 sensors time measurement time [seconds since epoch] pm01, pm25, pm04, pm10 PM1.0, PM2.5, PM4.0 PM10 [ug/m3] """ pm01: int = field(metadata=base.metadata("PM1", "ug/m3", "concentration"))
""" Honeywell HPMA115S0 sensors - passive mode messages are 8b long - active mode messages are 32b long """ from dataclasses import dataclass, field from typing import Tuple import struct from pms import WrongMessageFormat, WrongMessageChecksum, SensorWarmingUp from pms.sensor import base commands = base.Commands( passive_read=base.Cmd( # Read Particle Measuring Results b"\x68\x01\x04\x93", b"\x40\x05\x04", 8 ), passive_mode=base.Cmd(b"\x68\x01\x20\x77", b"\xA5\xA5", 2), # Stop Auto Send active_mode=base.Cmd(b"\x68\x01\x40\x57", b"\xA5\xA5", 2), # Enable Auto Send sleep=base.Cmd(b"\x68\x01\x02\x95", b"\xA5\xA5", 2), # Stop Particle Measurement wake=base.Cmd(b"\x68\x01\x01\x96", b"\xA5\xA5", 2), # Start Particle Measurement ) class Message(base.Message): """Messages from Honeywell HPMA115S0 sensors""" data_records = slice(2) @property def header(self) -> bytes: