@bjk8kds ok, had a look in github and while no one directly reported this issue with your model, there were a couple of similar issues with presence and move sensitivity.
This issue created the original converter and the person who submitted it admitted that the distance sensor values aren’t right. Maybe post there and ask if he’s seeing the same thing and if the below change could fix it? (see edit)
I suspect the issue is coming from the tuya.valueConverter.divideBy10
mapping in Z2M code itself for datapoint 9 (distance):
multiEndpoint: true,
tuyaDatapoints: [
[104, 'presence', tuya.valueConverter.trueFalse1],
[2, 'radar_sensitivity', tuya.valueConverter.raw],
[102, 'presence_sensitivity', tuya.valueConverter.raw],
[3, 'detection_distance_min', tuya.valueConverter.divideBy100],
[4, 'detection_distance_max', tuya.valueConverter.divideBy100],
[9, 'distance', tuya.valueConverter.divideBy10],
[105, 'keep_time', tuya.valueConverter.raw],
[103, 'illuminance_lux', tuya.valueConverter.raw],
[1, 'state', tuya.valueConverterBasic.lookup({
'none': 0,
'presence': 1,
'move': 2
})],
],
},
If this is changed to tuya.valueConverter.raw
, then the distance values should be reported correctly. (see edit)
Before you raise an issue though, can you confirm that inside Z2M itself the distance is also being reported as 0.12 instead of 1.2?
EDIT: had a look at what is actually being used in Z2M currently and I believe I found the issue. It’s using tuya.valueConverter.divideBy100
instead of tuya.valueConverter.divideBy10
. That would explain the decimal being off by 1 place and is probably a typo from when the device was first integrated.
Raise a bug against this - should be a pretty easy fix.