I recently wondered why all the devices in Z2M always show at least 1 lx illuminance and never 0, even if they are in pitch black surroundings.
Because of that I did some research and found out, that the Zigbee standard defines the following formular for calculating the lux value from the raw illuminance value, that the Zigbee devices report:
lx = 10^(value/10000)-1
This has also been mentioned in this old issue: Koenkk/zigbee2mqtt#2837 (comment)
Back then the formular got corrected in the fromZigbee converter.
Now I found, that the formular used in the modernExtend.ts is wrong again:
|
result = 10 ** ((result - 1) / 10000); |
The -1 is located in the wrong position, which would mathematically result in the lx value never being 0.
Is it possible to fix that globally in Z2M?
Thanks for great work!
I recently wondered why all the devices in Z2M always show at least 1 lx illuminance and never 0, even if they are in pitch black surroundings.
Because of that I did some research and found out, that the Zigbee standard defines the following formular for calculating the lux value from the raw illuminance value, that the Zigbee devices report:
lx = 10^(value/10000)-1This has also been mentioned in this old issue: Koenkk/zigbee2mqtt#2837 (comment)
Back then the formular got corrected in the fromZigbee converter.
Now I found, that the formular used in the modernExtend.ts is wrong again:
zigbee-herdsman-converters/src/lib/modernExtend.ts
Line 811 in 5f2f223
The -1 is located in the wrong position, which would mathematically result in the lx value never being 0.
Is it possible to fix that globally in Z2M?
Thanks for great work!