lloyd,
does your code actually work? does it properly read current values from the station? how often do the values change?
the docs say we should expect this for the reply to a READ_RECORD:
nbytes value
1 READ_RECORD
1 size
x data
1 checksum
the code you posted that reads current conditions seems a bit odd.
in the function ReadRecord(), there is a hid_write of 4 bytes with the READ_RECORD command.
then you do a PerformRead (which is a hid_read), followed by a loop that does PerformRead (additional hid_read) until you get enough bytes.
the thing that looks odd is the byte accounting from the raw reads.
in the first read, you check for a 0x01 in byte 0, payload_size in byte 1, 0x04 (READ_RECORD) in byte 2, and packet_length in byte 3.
in subsequent reads you skip bytes 0 and 1, but append the rest of the bytes to the buffer.
on the last read, you skip bytes 0 and 1, and also skip the last byte (the checksum).
is this a correct description of what ReadRecord is doing?
it seems odd that there is a 0x01 identifier followed by payload size in each packet (payload size ignored in all but the first packet), plus a READ_RECORD identifier and packet_size in the first packet, plus a checksum in the last byte of the last packet.
could you post a few raw sequences with associated decoded values so i can verify the decoding?
for example, something like this:
[
{'sequence': "01 3b 04 4a ...",
'decoded': {{"label":"in_temp", "value":"25.1 C"}, {"label":"out_humidity", "value":"55"}, ...}
},
{'sequence': "01 45 04 39 ...",
'decoded': {{"label":"in_temp", "value":"22.4 C"}, {"label":"out_humidity", "value":"54"}, ...}
]
when i try to run with an equivalent python implementation on linux using python-usb, i get garbage from the hardware (or my decoder is not correct). but at least the hardware is responding now :)
also, i have had no luck reading the eeprom for station parameters and historical records. i get the same garbage values no matter what address i request. but that is a different topic...
m