Hi,
There are some issues while trying to connect to this PM sensor:
commands = hpma115s0.commands._replace(
passive_read=base.Cmd( # Read Particle Measuring Results
b"\x68\x01\x04\x93", b"\x40\x0d\x04", 16
)
)
The length of the packet is 16 bytes, hence the second byte of the response should be 0x0D ... The datasheet seems to be wrong...
Also, when receiving the ack from passive mode command it fails (wrong header length - it receives 0xA5 0xA5) - it is validated as a message (in s0 _validate)...
diff --git a/src/pms/sensors/honeywell/hpma115c0.py b/src/pms/sensors/honeywell/hpma115c0.py
index b662658..4bcc6bb 100644
--- a/src/pms/sensors/honeywell/hpma115c0.py
+++ b/src/pms/sensors/honeywell/hpma115c0.py
@@ -11,7 +11,7 @@ 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
+ b"\x68\x01\x04\x93", b"\x40\x0d\x04", 16
)
)
@@ -21,6 +21,10 @@ class Message(hpma115s0.Message):
data_records = slice(4)
+ @classmethod
+ def _validate(cls, message: bytes, header: bytes, length: int) -> base.Message:
+ return cls(message)
+
@dataclass(frozen=False)
class ObsData(base.ObsData):
It is not a fix, but at least I was able to take a sample
$ pms -s /dev/ttyUSB0 -m HPMA115C0 -n 10 -i 15 serial -f hexdump
00000000: 40 0d 04 00 04 00 07 00 09 00 17 00 00 00 00 84 @...............
00000010: 40 0d 04 00 03 00 04 00 04 00 04 00 00 00 00 a0 @...............
00000020: 40 0d 04 00 04 00 06 00 06 00 07 00 00 00 00 98 @...............
00000030: 40 0d 04 00 05 00 06 00 06 00 07 00 00 00 00 97 @...............
00000040: 40 0d 04 00 04 00 05 00 05 00 05 00 00 00 00 9c @...............
00000050: 40 0d 04 00 05 00 06 00 06 00 08 00 00 00 00 96 @...............
00000060: 40 0d 04 00 05 00 07 00 07 00 08 00 00 00 00 94 @...............
00000070: 40 0d 04 00 05 00 07 00 07 00 08 00 00 00 00 94 @...............
00000080: 40 0d 04 00 04 00 06 00 06 00 07 00 00 00 00 98 @...............
00000090: 40 0d 04 00 04 00 06 00 07 00 08 00 00 00 00 96 @...............
Hi,
There are some issues while trying to connect to this PM sensor:
The length of the packet is 16 bytes, hence the second byte of the response should be 0x0D ... The datasheet seems to be wrong...
Also, when receiving the ack from passive mode command it fails (wrong header length - it receives 0xA5 0xA5) - it is validated as a message (in s0 _validate)...
It is not a fix, but at least I was able to take a sample