avaldebe / PyPMS

Data acquisition and logging for Air Quality Sensors with UART interface
https://avaldebe.github.io/PyPMS/
MIT License
29 stars 8 forks source link

PMS5003T/PMS5003ST signed temperature #8

Closed avaldebe closed 4 years ago

avaldebe commented 4 years ago

Just found out a English datasheet for the PMS5003ST, which says that the temperature is a signed integer. This total sense as the temperature can be negative.

Alas, the _unpack unpack method inhereted from PMS3003 decodes the message as unsigned integers.

https://github.com/avaldebe/PyPMS/blob/5b7d05f9f1ac711537730513b1c368e8201f7132/pms/sensor/pm/PMS3003.py#L61-L63

Therefore, negative temperatures will show as huge values.