[PROJECT] Tuya ZigBee Air Sensor Driver

Tuya Air Sensor.groovy

Feature(s):

  • Receives data from the Tuya ZigBee Air Sensor for temperature, humidity, Carbon Dioxide, VOC, and, Formaldehyde
  • Temperature, Humidity, and Carbon Dioxide report using the standard Hubitat capabilities. VOC and Formaldehyde required custom attributes to be created
  • Has no user commands that can be triggered, including refresh (since it did not respond to it and pushes data so often anyways)
  • Checks my website daily for an updated version of the driver (if any)

Caveat(s):

  • VOC and Formaldehyde are reported but it is unknown which one is which. Both are (and should be) extremely low values and Tuya uses a manufacturer-specific cluster (not standard ones, even for temperature, humidity, etc...) so I am not sure yet nor do I know a way to "trigger" one like I can the other values

Setup:

  1. Using driver link above download the driver to past as a user driver or import it into the window
  2. Save driver
  3. Add Tuya Air Sensor device using standard ZigBee methods
  4. Driver should automatically be selected, but if not you can select it from the "Type" dropdown on the device's information page

Note(s):

  • This is a VERY chatty device, it sends many data pushes to the Hubitat and I have not yet found any way to alter the rate (it does not appear to react to standard commands to do so), as such I do not recommend leaving Trace logging on for very long
1 Like

Hi Dr. Snell. I just got in this Tuya Smart Air Box yesterday and was pleasantly surprised to find your driver. It works nicely. Just to throw the data points onto a graph (last 12 hours):


Just to note, temp is reading approx 4 degrees (F) high and the humidity is reading 10% low. I am very pleased with your driver and I'm excited for future updates.

1 Like

Maybe what I can do is build a couple preferences to adjust the temperature and humidity readings.

Mine has seemed fairly accurate to my room but I do not have any really sophisticated measurement in there to compare it with at the moment. I bet there is quite some variability with them.

Not sure why I did not think to do this before but I just opened the case and took a look:

  • ZigBee chip is Tuya's ZS3L (Link)
  • The temperature & humidity chip is a very generic DHT11 with a +- 2°C rating. That explains the 4°F difference but there may be some consistency in it so a preference might still be useful.
  • The other sensor chip (sticking off the side) has no usable markings on it. It appears there might have been some but they were sanded off (leaving bare copper even).
  • You can see they have different connections for a WiFi module also, so they must just reuse this model for both types.

Here is a picture of the top side:
Tuya Air Sensor Medium

Updated Version(s):

  • Tuya Air Sensor.groovy = 0.1.1

Change(s):

  • Corrected the Formaldehyde & VOC reporting. These were swapped in the previous version as I did not have a way to know which was which (there is no documentation of course). However, I ordered a bottle of Formaldehyde and set the sensor over it. What HAD been listed as VOC went up dramatically (and what had been listed as Formaldehyde went up only slightly). Therefore I had them reversed. This is what I corrected.

Known Issue(s):

  • Still no known way to set the reporting interval. Despite being "ZigBee 3.0" they use their private cluster for all reporting and that reporting is not using attribute IDs so I cannot use normal commands to request X cluster with Y attribute report at such and such time or amount of change. I read over the Tuya "Zigbee Connection Standard" but it does not list any way to set a report interval (it does have ways to request a report, but this thing already reports a LOT).
1 Like

Thanks for the driver, it does seem to be working pretty well and, while chatty, it certainly makes it respond pretty quickly.

I am wondering about the CO2 levels, and calibration in general really. I was getting high 600 ppm inside so took the sensor outside, where it still reads this high. I would expect in the rural fringe area where I am that the levels should be lower. The sensor definitely works since breathing on it pushes the reading above 1000 ppm very fast.

I have another, more industrial strength sensor suite on the way which I will likely use to calibrate the output. As I understand, these devices don't actually read CO2 at all but rather do some fancy calculations against the VOC sensor, but I would still expect something a little bit closer.

Anyone else experienced likely incorrect readings and validated them?

I have been meaning to add some preferences to "calibrate" the responses (really just offset them). Will try to get that posted tonight.

UPDATE: New driver posted.

Updated Version(s):

  • Tuya Air Sensor.groovy = 0.1.2

Change(s):

  • Preferences section now has offsets for each of the 5 reported fields. Each one can be individually set and will accept negative numbers and decimals (ex: you can have a -2.5 offset to reduce the displayed value by 2.5). There are no bounds specifically set so you can put absurd numbers in there.
  • Preferences section now has a "Show All Preferences" boolean to show or hide them all, because of the offsets. Just to make it a little "simpler" looking once you have it all set up.
  • All the reported values have been changed to specifically be type "float" and are rounded to the nearest tenth (0.1). Any further than that and they are completely lost in the noise. As it stands there is already a high degree of variability with this device so whole numbers might be better in the long run.

Sweet! Now all I need is something to calibrate against. I wonder whether the device can actually have calibration factors written into it? I guess without proper documentation it is impossible to know.

Weirdest thing, after extended operation, the CO2 levels have started to settle down a little. I suspect that the sensors are not the most accurate things ever made.

Yeah, I doubt the chip for VOC and such is high grade, considering the DHT11. There is PROBABLY a way to calibrate it... But like you said that is unlikely to get implemented without documentation. Just send write commands to the Tuya cluster does not seem like a good idea.

Download the Hubitat app