Closed bullar closed 5 months ago
@bullar Could you please check the latest version where I've tried to resolve this issue?
Great, will test it when I am back home next weekend...
@ptvoinfo sensor DFRobot URM06, URM07: working well now ✅ (tested with serial emulator, don't have this sensor type available)
sensor JSN-sr04t, DYP-A01, A02YYUW:
The expected checksum is wrong ❌
The firmware (2024-04-29) expects [sum of all byte] instead of [sum of all bytes +1] or [sum of MSB+LSB].
The sensor specification is a bit misleading...
Example:
Sensor response: 0xFF 0x00 0xD5 0xD5 --> value 213
Firmware expectation: 0xFF 0x00 0xD5 0xD4
(tested with serial emulator and sensor AJ-S04M)
@bullar Are you sure about CRC for AJ-S04M? I've read the datasheet, and it contains examples of a simple sum of all bytes (+1 is not required).
@ptvoinfo At least all my 6 sensors of type AJ-S04M show the same response with checksum [MSB+LSB]: But you are right the specification defines [sum of all bytes]. In another sensor description I found [MSB+LSB] as checksum calculation (same as sum of all bytes+1). I am not sure if there are two different types in the market...
In PTVO FW version (1.9.0.21/2024-05-23) the type selection is extended with JSN-SR04T v2
. This type works fine with my version of sensors (AJ-S04M)! ✅
@ptvoinfo There is one minor issue left. The unit of the distance value given by sensor is millimetre. But it's reported in meter to Z2M and ZHA controller. For ZHA I just had to add the following lines in the corresponding quirk file (.py).
--- /Users/<me>/Desktop/dirb_waterlevel.py
+++ /Users/<me>/Desktop/dirb_waterlevel2.py
@@ -222,6 +222,8 @@
models={PTVO_MODEL_ID},
)
class PtvoAnalogInputSensorEp1Attr0(Sensor):
+ _divisor = 1000
+ _decimals = 3
_attr_name = "Distance 1"
_attribute_name = "value"
_attr_translation_key = "value"
@bullar Or just change the unit name for the sensor :)
In PTVO FW version (1.9.0.15/2024-04-06) the selection of the different sensor types (e.g. US100,..) doesn't work. Independant from the type selection the FW behavior is always the same:
Correct would be for sensor JSN-sr04t, DYP-A01, A02YYUW:
and sensor DFRobot URM06, URM07: