Tuya illuminance sensor driver for hubitat

Thanks, I will check again some hours later.

Can you update the driver with the new code and test again?
I think I found and corrected the problem (this model is reporting the illuminance values in Lux directly, while other sensors report the so-called 'raw value').

Also, if you remove the device and pair it again, HE should now find the driver automatically.

Hi Kkossev,

I have done what you have said. when i cover the device with my hand the lux reads 0 when i expose the sensor to a room light it reads a large value. the range of this sensor is between 0.1 to 8300
the device id is 987

Hi Kkossev,

I also find something interesting.

when you cover the device you get the value 0
when it is exposed to the room light it will read large value as previously shown.
if i move my hand over it the value drops a different value than toe 100000000000

so my conclusion is the sensor is very sensitive as what they say about it .

also the value i am getting is always multiple of 10 . like 1000000 10000 1000000000 and so on. there is no other numbers

It's a bug.. :frowning: Hold on, I am sending an update.

The code is updated, can you try again with the new version?

(the error code in red will disappear when you 'Remove Device' from the web UI and pair it again. This is a remaining from other previous driver).

Hi kkossev,

here is my update.

now i reading different values here is what i have done.
when i cover the sensor it will read 0
when i remove my hand and i am sitting in a well lighted room the value is 17 as shown in the list
i took my phone and i put the flash light over it directly it went up to 1000.

I do not think this room is only 17
and the flashof my phone is extremely bright. why it does not go over 1000.

now i took my phone and i move it up and down over the sensor and the values are changing as listed below.
do you think that these values must be multiplied by 10?

1 Like


You can read about the same 0 ... 1000 issue with this type of sensor here :

Unfortunately, Tuya is sending the actual Lux value already 'converted' to something using their own formula...

What can be done in the driver is to add a correction coefficient - a number that the returned value will be multiplied by.

Do you have any other illuminance sensors that you can trust and you can compare the values with?

Other than this suspicious Lux value, the sensor seems to react very fast!

@user3 The measurement unit must be 'lx' (illuminance), not "lux'' !


So what I must change in the driver is the illuminance unit, which was wrong...
See also here: ( the table "Indoor Light Levels" )

Hi KKossev,

I am surprised that they did not say that in their specs.

But, thank you very much for all the effort you had put in to solve this issue.

I have to think twice on what to do. I was planning to use this sensor as a back up sensor of the illuminance value that i get from weathermap reading if my internet went down.
i might spend some time comparing the reading at different times of the day and corollate the reading from weatehrmap to the sensor and do some calculation.

I am new to hubitat but i will see if i can do mathematical formulas in the rules.

if not, then this sensor will go to history drawer. :slight_smile:

thank you again for all your help.

You so fast in replies. :slight_smile: so are you going to change the driver again?

if you are up to for another challenge on one of your drivers for tuya siren. i have used your driver but siren does not respond to anything.

so i found one driver and i am using it but it does not do that much like strobe or siren selection. it is either on of off for a specified time.
here is the tuya siren i have this siren

Looks like this sensor is not suitable for outdoor measurements.. :frowning:
This sensor however seems to work OK :

When I put it close to a LED bulb it shows 40000 Lux

Not today :slight_smile: Whether the measurement unit is 'lux' or 'lx' is not of a critical importance,

I will look on the Zigbee siren in the next days.


thank you.

do not worry too much about this light sensor. i can live without it.

have a good day.

1 Like

Hi Kkessev,

Hope my message finds you well. I received the new temperature and humidity sensor and i installed it using your driver. i get every 5 minutes the temperature from the sensor and this is what they say.
but i am not getting the humidity reading
can you help me again?

thank you

Hi again,

This sensor seems to use standard Zigbee clusters reporting, so probably there is no need to use the Tuya custom driver....

Please try the inbuilt HE driver "Generic Zigbee Motion/Humidity Sensor" and let me know if it works.

Hi KKossev,

Good News...
Your driver worked like a charm.

I have noticed that when there is a big change like more than 2 deg in the reading the sensor provides the data every 5 minutes.
so i left it overnight and i have noticed that if the temperature is constant the sensor will provide the reading every 30 minutes.

I was wondering are the above conditions in your code or it is the sensor. i will keep using your driver.

Sorry I was not patient enough.

Hi KKossev,

I was wondering if there is a possibility to add the battery reading to the code?

Hi KKossev,

the generic driver gives back the values but i am getting other messages with it. it is device ID is 988

Hi @user3 ,
I am glad that the driver worked for you. From what I have found on the Web, these sensors behave exactly as you describe - they send temperature updates every 30 minutes, and only if the temperature change is greater than 0.5 degrees - then the update is sent sooner. These are device settings, can not be controlled or configured from the driver. Typically, almost all Tuya sensors have hardcoded reporting parameters into their firmware and can not be configured from the hub.

If the battery reading does not show up, leave the Debug option turned on for one day and then go to device 988 log page and search for any text that contains 'battery'. The driver already supports the known ways to decode battery levels, but with Tuya devices you never know..

Hi KKossev,

Hope you are doing great.

I have turned on the debug option but i do no think it will provide the battery ststus. i will run it for one day. by the way the debug option will be disabled after 24 hours as what i am getting after i enable it.

on the other hand, i mentioned about the siren that i discussed with you earlier. i am using the generic zigbee siren but i am getting the following error

and the worst part, the siren will turn on on the same time the error happens every day.

so what do you suggest?

thank you.

BTW: i like your drivers you make. it is solid. i wish you can modify the siren driver to use it with my tuya siren.

thank you and have a nice day

Hi @user3 ,
In the past days I was working on other already started projects, I need to finish these before I can start new one. For the Tuya Siren new device support, please write in this thread, as the topic and the thread subject here is different.