zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

Wrong Unit for Iluminance and missing current iluminance in mqtt

Open seti1337 opened this issue 11 months ago β€’ 53 comments

What happened?

Since last Update no longer lx instead mv unit for Iluminance with this sensor and current iluminace is not longer published to mqtt https://www.zigbee2mqtt.io/devices/RB-SRAIN01.html#tuya-rb-srain01

What did you expect to happen?

No response

How to reproduce it (minimal and precise)

No response

Zigbee2MQTT version

2.7.1 (unknown)

Adapter firmware version

{"maintrel":120,"majorrel":2,"minorrel":6,"product":0,"revision":"0x26780700","transportrev":0}

Adapter

ConBee2/RaspBee2

Setup

os: #1 SMP PREEMPT Tue Nov 4 14:31:07 UTC 2025 - 6.12.51-haos - arm64 node: v22.16.0 ha: true

Device database.db entry

No response

Debug log

No response

Notes

No response

seti1337 avatar Dec 07 '25 09:12 seti1337

Same problem here

DIG200 avatar Dec 07 '25 09:12 DIG200

Also being discussed in https://github.com/Koenkk/zigbee2mqtt/issues/29901

lnlyssg avatar Dec 07 '25 11:12 lnlyssg

Same problem here

Image Image Image

reference

keidischoi avatar Dec 07 '25 14:12 keidischoi

I have the same issue

Mark-64 avatar Dec 07 '25 15:12 Mark-64

I have the same issue

igori81 avatar Dec 07 '25 16:12 igori81

Comparison between different devices, one with a problem, the other without. I hope this helps.

Image

wesleyRaposo avatar Dec 07 '25 18:12 wesleyRaposo

I have the same issue

snclab avatar Dec 07 '25 19:12 snclab

We have 2 options here:

  • Remove the illuminance device_class
  • Compute the illuminance lx value based on the voltage (@dgibbs64 not sure if this makes sense?)

Koenkk avatar Dec 07 '25 19:12 Koenkk

Rain.js I’ve put together a converter with the help of Copilot to restore the old functions.

tobiasg021 avatar Dec 07 '25 20:12 tobiasg021

Rain.js I’ve put together a converter with the help of Copilot to restore the old functions.

I added the original battery refresh button, not sure it works, and I confirmed two pingerprints.

_TZ3210_tgvtvdoc.js

_TZ3210_p68kms0l.js

keidischoi avatar Dec 07 '25 23:12 keidischoi

Rain.js I’ve put together a converter with the help of Copilot to restore the old functions.

Where should I put this rain.js file? Thanks

khaisilk1910 avatar Dec 08 '25 03:12 khaisilk1910

@Koenkk

I think it's probably worth reverting the original lx sensor to not break existing automations. However add a new mV entity that shows the real output in mV. Finally an entity that does a calculated Lx value based on the mV value. This way there is backwards compatibility plus the real sensor reading and a calculated Lx. This should achieve all goals I think giving users multiple ways to use the sensor. Hope that makes sense.

dgibbs64 avatar Dec 08 '25 08:12 dgibbs64

Problem is, current iluminance is not longer published to mqtt, so also a recalculate helper in hoa will not help

seti1337 avatar Dec 08 '25 09:12 seti1337

We have 2 options here:

  • Remove the illuminance device_class
  • Compute the illuminance lx value based on the voltage (@dgibbs64 not sure if this makes sense?)

It worked until a few days ago. Why did this change happen? Couldn't it just stay the same?

snclab avatar Dec 08 '25 09:12 snclab

I have the same problem on my TS0207 _TZ3210_tgvtvdoc (Solar rain sensor) device, downgrading to 2.7.0 solves the problem.

dengi76 avatar Dec 08 '25 10:12 dengi76

@snclab The problem is that the sensor the device is providing not actually a lux sensor is a mV sensor. So your lux readings are completely false (it's just the voltage from the solar panel). For example if the lux was saying 3000 that was not lux but mV. The Lx number would be much higher in reality. I have proposed a workaround above and recomendation that the z2m docs state that the device doesnt actually monitor lux.

dgibbs64 avatar Dec 08 '25 10:12 dgibbs64

I don't particularly care about the accuracy of illumination changes. All the automations that were configured for this sensor broke (I adjusted the values ​​to match real-world conditions).

dengi76 avatar Dec 08 '25 11:12 dengi76

Problem is, current iluminance is not longer published to mqtt

I'm wondering about that, because I've rolled back to 2.7.0-1 and the current illumination is published again.

And under 2.7.1-1 illumination 20min-average and max were published unfortunately in [mV], current illumination was shown too on ZigBee2MQTT-Addon in HA, but in HA-Dashboard as unavailable, as you could see in some postings above.

So for me it isn't a device problem, it is a problem with addon-code-(2.7.1-1)!

HaraldGithub avatar Dec 08 '25 11:12 HaraldGithub

Lux (lx) and millivolts (mV) are different physical quantities. There are devices that use different sensors for the same purpose. So it makes no sense to block the use of millivolts (mV) to measure illumination. Just re-enable the functionality as it was before and everyone will be happy.

wesleyRaposo avatar Dec 08 '25 12:12 wesleyRaposo

Problem is, current iluminance is not longer published to mqtt

I'm wondering about that, because I've rolled back to 2.7.0-1 and the current illumination is published again.

And under 2.7.1-1 illumination 20min-average and max were published unfortunately in [mV], current illumination was shown too on ZigBee2MQTT-Addon in HA, but in HA-Dashboard as unavailable, as you could see in some postings above.

So for me it isn't a device problem, it is a problem with addon-code-(2.7.1-1)!

How did you roll back to the older version?

seti1337 avatar Dec 08 '25 12:12 seti1337