Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge πŸŒ‰, get rid of your proprietary Zigbee bridges πŸ”¨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
12.36k stars 1.69k forks source link

Tuya ZG-204ZL illuminance reported in lux while it's raw #18950

Open dinde opened 1 year ago

dinde commented 1 year ago

What happened?

Just installed a ZG-204ZL motion sensor with luminance sensor. Values reported for illuminance as lux is in fact raw (number can't be that high) image

What did you expect to happen?

illuminance is raw not in lux. As a feature it could be nice to have both values (with a converter directly in z2m but it's manageable thru home assistant as well).

How to reproduce it (minimal and precise)

Just install it

Zigbee2MQTT version

1.32.2

Adapter firmware version

20230507

Adapter

Sonoff ZBDongle-P

Debug log

Will upload if needed/requested

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

dinde commented 1 year ago

bump

Crumar commented 11 months ago

What is the actual calculation?

muktheo commented 10 months ago

any update? ive face the same issue

dtalens commented 9 months ago

Same here. The lux values is much more high than other iluminace sensor in same place.

jusicgn commented 7 months ago

Same here. Compared to Eve Motion sensors the Lux values of ZG-204ZL are way too high.

KaelWD commented 5 months ago

Looks like this one is using illuminance(): https://github.com/Koenkk/zigbee-herdsman-converters/blob/3ec951e4c16310be29cec0473030827fb9a5bc23/src/devices/tuya.ts#L6301 Others use illuminance_lux() https://github.com/Koenkk/zigbee-herdsman-converters/blob/3ec951e4c16310be29cec0473030827fb9a5bc23/src/devices/tuya.ts#L6391 which should go through this conversion: https://github.com/Koenkk/zigbee-herdsman-converters/blob/3ec951e4c16310be29cec0473030827fb9a5bc23/src/converters/fromZigbee.ts#L466


I just tried illuminance_lux in an external converter and it didn't seem to make a difference, still 2500 lux for fairly dim indoor lighting.


Hmm:

[2024-06-08 23:41:32] debug:    z2m: Received Zigbee message from 'motion1', type 'attributeReport', cluster 'msIlluminanceMeasurement', data '{"measuredValue":34059}' from endpoint 1 with groupID 0
[2024-06-08 23:41:32] debug:    z2m: No converter available for 'ZG-204ZL' with cluster 'msIlluminanceMeasurement' and type 'attributeReport' and data '{"measuredValue":34059}'

Math.pow(10, (34059 - 1) / 10000) is 2546 which is what I'm seeing in the UI so it's definitely going through the converter. I have a different sensor that reports 56 lux so it seems like this one needs something like / 20000 instead?


Yeah idk how this works actually, it has the raw value here https://github.com/Koenkk/zigbee2mqtt/blob/0e6da85d195f8696379cc55a1c34e5f495121063/lib/extension/receive.ts#L108 then in herdsman-converters it's an array again, this function https://github.com/Koenkk/zigbee-herdsman-converters/blob/3ec951e4c16310be29cec0473030827fb9a5bc23/src/lib/tuya.ts#L1383 gets [0, 0, 8, 187] and turns it into 2235 with https://github.com/Koenkk/zigbee-herdsman-converters/blob/3ec951e4c16310be29cec0473030827fb9a5bc23/src/lib/tuya.ts#L27

knuti1960 commented 2 months ago

I'm not sure if it's really the RAW value that the ZG-204ZL device delivers. I compared it with my HUE sensor (Philips 9290012607), which displays both the RAW value and the LUX value. I placed both devices right next to each other in the same room for the test. The result was:

Philips

Tuya

rodrigojds commented 1 month ago

Hi, anything we can do to show the correct value? it’s currently night time over here and the lux values are incorrect.

I have 2 of these devices..try and guess which ones from the screenshot? :D

IMG_1566

kpapastamatis commented 1 week ago

bump