zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

Tuya RB-SRAIN01 reports lux, should be mV

Open dgibbs64 opened this issue 1 year ago β€’ 14 comments

What happened?

I am re-reporting this Issue https://github.com/Koenkk/zigbee2mqtt/issues/25670 as the OP of that issue is correct as per the manual for the device.

The device RB-SRAIN01 is measuring mV not lx as per its own manual linked below.

https://www.the-colliers.net/docs/public/guides%20&%20manuals/Zigbee%20Solar%20Rain%20Sensor%20User%20Manual.pdf

What did you expect to happen?

RB-SRAIN01 is measuring mV and not lx. So it should be updated as such to represent the actual correct measurements.

How to reproduce it (minimal and precise)

No response

Zigbee2MQTT version

2.6.3

Adapter firmware version

Revision: 8.0.2 [GA]

Adapter

EmberZNet Revision: 8.0.2 [GA]

Setup

NUC

Device database.db entry

No response

Debug log

No response

Notes

No response

dgibbs64 avatar Nov 30 '25 13:11 dgibbs64

Fixed!

Changes will be available in the dev branch in a few hours from now and in the next release which is every 1st of the month.

Koenkk avatar Dec 01 '25 20:12 Koenkk

How can illuminance be messured in "mV"? - this is bs even If the "manual" says something else. So it was expected that z2mqtt throws an error now...

Logger: homeassistant.components.mqtt.entity Quelle: components/mqtt/entity.py:159 Integration: MQTT (Dokumentation, Probleme) Erstmals aufgetreten: 00:23:16 (1 Vorkommnis) Zuletzt protokolliert: 00:23:16

Error 'The unit of measurement mVis not valid together with device classilluminance' when processing MQTT discovery message topic: 'homeassistant/sensor/0xa4c1380a3c17d253/illuminance/config', message: '{'availability': [{'topic': 'zigbee2mqtt0/bridge/state', 'value_template': '{{ value_json.state }}'}, {'topic': 'zigbee2mqtt0/Regensensor/availability', 'value_template': '{{ value_json.state }}'}], 'availability_mode': 'all', 'default_entity_id': 'sensor.regensensor_illuminance', 'device': {'hw_version': 1, 'identifiers': ['zigbee2mqtt_0xa4c1380a3c17d253'], 'manufacturer': 'Tuya', 'model': 'Solar rain sensor', 'model_id': 'RB-SRAIN01', 'via_device': 'zigbee2mqtt_bridge_0x84b4dbfffebc5ee1', 'name': 'Regensensor'}, 'device_class': 'illuminance', 'enabled_by_default': True, 'object_id': 'regensensor_illuminance', 'origin': {'support_url': 'https://www.zigbee2mqtt.io', 'sw_version': '2.7.1', 'name': 'Zigbee2MQTT'}, 'state_class': 'measurement', 'state_topic': 'zigbee2mqtt0/Regensensor', 'unique_id': '0xa4c1380a3c17d253_illuminance_zigbee2mqtt0', 'unit_of_measurement': 'mV', 'value_template': '{{ value_json.illuminance }}'}'

Pls revert changes. Or change device class or whatever.

hipp0o avatar Dec 07 '25 09:12 hipp0o

I believe there’s a larger issue here: the device is measuring millivolts (mV), not illuminance (lx). It appears to do this via its solar panel - stronger light produces more voltage. In other words, this inexpensive device isn’t truly measuring lux, but rather reporting a proxy value.

From my usage, the sensor tops out around 6000 mV in summer conditions. In reality, outdoor illuminance on a sunny day should be closer to 100,000 lx. A practical compromise would be to expose the raw mV entity and then provide a calculated lx value based on a simple conversion. For example, if 6000 mV corresponds to 100,000 lx, we can scale accordingly.

While presenting mV as lx is misleading, the sensor is still useful as a basic light detector. My suggestion is to keep the mV reading available and add a derived lx sensor using a calculation. A clear warning in the description should note that this lx value is estimated, not a true measurement.

@Koenkk Your thoughts on this will be most welcome as its an example of a cheap device being a pain.

edit: Also sorry as I think I have inadvertently caused issues with existing setups.

dgibbs64 avatar Dec 07 '25 11:12 dgibbs64

This has also caused issues for me as the illuminance value is now longer present in Home Assistant:

2025-12-07 11:53:13.805 ERROR (MainThread) [homeassistant.components.mqtt.entity] Error 'The unit of measurement `mV` is not valid together with device class `illuminance`' when processing MQTT discovery message topic: 'homeassistant/sensor/0xa4c138de79edb711/illuminance/config', message: '{'availability': [{'topic': 'zigbee2mqtt/bridge/state', 'value_template': '{{ value_json.state }}'}], 'default_entity_id': 'sensor.rain_sensor_illuminance', 'device': {'hw_version': 1, 'identifiers': ['zigbee2mqtt_0xa4c138de79edb711'], 'manufacturer': 'Tuya', 'model': 'Solar rain sensor', 'model_id': 'RB-SRAIN01', 'via_device': 'zigbee2mqtt_bridge_0x00124b0031dea3a5', 'name': 'Rain Sensor'}, 'device_class': 'illuminance', 'enabled_by_default': True, 'object_id': 'rain_sensor_illuminance', 'origin': {'support_url': 'https://www.zigbee2mqtt.io/', 'sw_version': '2.7.1', 'name': 'Zigbee2MQTT'}, 'state_class': 'measurement', 'state_topic': 'zigbee2mqtt/Rain Sensor', 'unique_id': '0xa4c138de79edb711_illuminance_zigbee2mqtt', 'unit_of_measurement': 'mV', 'value_template': '{{ value_json.illuminance }}'}'

lnlyssg avatar Dec 07 '25 11:12 lnlyssg

facing same issue here on Home Assistant

Logger: homeassistant.components.mqtt.entity Source: components/mqtt/entity.py:159 integration: MQTT (documentation, issues) First occurred: 8:13:19 PM (1 occurrence) Last logged: 8:13:19 PM

Error 'The unit of measurement mV is not valid together with device class illuminance' when processing MQTT discovery message topic: 'homeassistant/sensor/0xa4c138f5df179c25/illuminance/config', message: '{'availability': [{'topic': 'zigbee2mqtt/bridge/state', 'value_template': '{{ value_json.state }}'}, {'topic': 'zigbee2mqtt/0xa4c138f5df179c25/availability', 'value_template': '{{ value_json.state }}'}], 'availability_mode': 'all', 'default_entity_id': 'sensor.0xa4c138f5df179c25_illuminance', 'device': {'hw_version': 1, 'identifiers': ['zigbee2mqtt_0xa4c138f5df179c25'], 'manufacturer': 'Tuya', 'model': 'Solar rain sensor', 'model_id': 'RB-SRAIN01', 'via_device': 'zigbee2mqtt_bridge_0x8c8b48fffe4fdddd', 'name': '0xa4c138f5df179c25'}, 'device_class': 'illuminance', 'enabled_by_default': True, 'object_id': '0xa4c138f5df179c25_illuminance', 'origin': {'sw_version': '2.7.1', 'support_url': 'https://www.zigbee2mqtt.io', 'name': 'Zigbee2MQTT'}, 'state_class': 'measurement', 'state_topic': 'zigbee2mqtt/0xa4c138f5df179c25', 'unique_id': '0xa4c138f5df179c25_illuminance_zigbee2mqtt', 'unit_of_measurement': 'mV', 'value_template': '{{ value_json.illuminance }}'}'

tl-zigbee avatar Dec 07 '25 12:12 tl-zigbee

If the reported value is a voltage, then device_class can't be "illuminance".

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

For info this is what I see now. Illuminance has completely gone now. Interestingly, "rain intensity" is also measured in mV πŸ˜„

Image

edit: side note. I have just ordered a couple of different models of rain/lux sensors to see if they actually measure lux or mV.

dgibbs64 avatar Dec 07 '25 17:12 dgibbs64

I noticed that the recent changes were implemented without prior communication, and I’m concerned about their impact. The MV display does not seem to provide any practical benefit, and additionally, the current illumination level information is now missing, which is essential for our work. Could you please clarify the reasoning behind these changes and whether the missing data will be restored? Thank you for your support.

tobiasg021 avatar Dec 07 '25 20:12 tobiasg021

Ah, the current illumination level is now unavailable :(

cherowley avatar Dec 08 '25 16:12 cherowley

Pls. can someone with a appropriate rights reopen the issue?

hipp0o avatar Dec 08 '25 16:12 hipp0o

now illuminance is not available anymore in HA but I see in mqtt explorer

{
  "battery": 93,
  "cleaning_reminder": true,
  "device": {
    "applicationVersion": 67,
    "dateCode": "",
    "friendlyName": "solar rain sensor",
    "hardwareVersion": 1,
    "ieeeAddr": "0xa4c138bd4e99fb77",
    "manufacturerID": 4417,
    "manufacturerName": "_TZ3210_tgvtvdoc",
    "model": "RB-SRAIN01",
    "networkAddress": 34437,
    "powerSource": "Battery",
    "stackVersion": 1,
    "type": "EndDevice",
    "zclVersion": 3
  },
  "illuminance": 352,
  "illuminance_average_20min": 390,
  "illuminance_maximum_today": 5975,
  "last_seen": "2025-12-08T22:18:12+01:00",
  "linkquality": 167,
  "linkquality": 172,
  "rain": false,
  "rain_intensity": 6
}

HA only has these ones:

sensor.solar_rain_sensor_battery
binary_sensor.solar_rain_sensor_cleaning_reminder
sensor.solar_rain_sensor_illuminance_average_20min
sensor.solar_rain_sensor_illuminance_maximum_today
sensor.solar_rain_sensor_last_seen
sensor.solar_rain_sensor_linkquality
binary_sensor.solar_rain_sensor_rain
sensor.solar_rain_sensor_rain_intensity

lluisd avatar Dec 08 '25 21:12 lluisd

Before this update (running version 2.7.0-1) the Illuminance value had already been reported in lx. Now it appears a unavailable, Please revert this change.

vlovmx avatar Dec 09 '25 03:12 vlovmx

This is a change that seems unnecessarily pedantic. I now have a bunch of automations which have stopped working because the data is no longer available.

I'm not sure what the problem being fixed here is - mV are a nonsense measurement for illuminance and home assistant doesn't like it. Whether the device reports the solar panel voltage or whatever doesn't really matter since it's mainly going to be used relatively anyway. High number = bright. Low number = dark. It's been working fine for the past year or so with 'incorrect' units, and now it doesn't.

Yes in an ideal world the device would give a sensible output but I don't think the point of this device is high quality data gathering.

caiusseverus avatar Dec 09 '25 15:12 caiusseverus

Let's continue in https://github.com/Koenkk/zigbee2mqtt/issues/30063

Koenkk avatar Dec 09 '25 19:12 Koenkk