zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

Device support request - TuYa Smart Air Sensor _TZE200_mja3fuja

Open jmluxem opened this issue 3 years ago • 11 comments

Link

https://a.aliexpress.com/_ms7pX0y

Database entry

{"id":105,"type":"Router","ieeeAddr":"0xa4c138d4fe33f3b9","nwkAddr":27178,"manufId":4417,"manufName":"_TZE200_mja3fuja","powerSource":"Mains (single phase)","modelId":"TS0601","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[4,5,61184,0],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"65506":32,"65508":1,"modelId":"TS0601","manufacturerName":"_TZE200_mja3fuja","powerSource":1,"zclVersion":3,"appVersion":64,"stackVersion":0,"hwVersion":1,"dateCode":""}}},"binds":[],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":64,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1682015339812,"defaultSendRequestWhen":"immediate"}

Comments

Tried setting up this device and configuring an external converter but haven’t gotten anything working.

External converter

Nothing usable…

I was trying to setup a converter to make this report the same as another very similar device that I already have and that is supported: _TZE200_dwcarsat - the TuYa TS0601_smart_air_house_keeper

I've tried setting up something like below but it hasn't worked:

convert: (model, msg, publish, options, meta) => {
    const dpValue = tuya.firstDpValue(msg, meta, 'tuya_air_quality');
    const dp = dpValue.dp;
    const value = tuya.getDataValue(dpValue);
    switch (dp) {
    case tuya.dataPoints.tuyaSabTemp:
        return {temperature: calibrateAndPrecisionRoundOptions(value / 10, options, 'temperature')};
    case tuya.dataPoints.tuyaSabHumidity:
        return {humidity: calibrateAndPrecisionRoundOptions(value / 10, options, 'humidity')};
        // DP22: Smart Air Box: Formaldehyd, Smart Air Housekeeper: co2
    case tuya.dataPoints.tuyaSabFormaldehyd:
        if (['_TZE200_mja3fuja'].includes(meta.device.manufacturerName)) {
            return {co2: calibrateAndPrecisionRoundOptions(value, options, 'co2')};
        } else {
            return {formaldehyd: calibrateAndPrecisionRoundOptions(value, options, 'formaldehyd')};
        }
        // DP2: Smart Air Box: co2, Smart Air Housekeeper: MP25
    case tuya.dataPoints.tuyaSabCO2:
        if (meta.device.manufacturerName === '_TZE200_mja3fuja') {
            // Ignore: https://github.com/Koenkk/zigbee2mqtt/issues/11033#issuecomment-1109808552
            if (value === 0xaaac || value === 0xaaab) return;
            return {pm25: calibrateAndPrecisionRoundOptions(value, options, 'pm25')};

Supported color modes

No response

Color temperature range

No response

jmluxem avatar Apr 23 '23 18:04 jmluxem

This device seems to be identical to _TZE200_dwcarsat

I have still been unsuccessful trying to get _TZE200_mja3fuja to mimic function of _TZE200_dwcarsat

jmluxem avatar May 07 '23 05:05 jmluxem

Also having this issue. @jmluxem did you mange to fix this?

Charliedean avatar May 20 '23 16:05 Charliedean

Me too! First zigbee device joined but no expected entities :-)

oedo808 avatar May 31 '23 18:05 oedo808

I have not been able to fix this. Haven't had much free time to devote. Was hoping @Koenkk might be able to sprinkle some of his magic, since I don't believe any real datapoint-finding is required - I'd bet that a direct conversion from _TZE200_dwcarsat would allow this to function, but making that work properly escapes me. The unsupported device is _TZE200_mja3fuja, but I bought it thinking that it was identical to _TZE200_dwcarsat - they both have the same functions. I may be wrong but I don't exactly have the knowledge/time/hardware to test my belief.

jmluxem avatar Jun 02 '23 03:06 jmluxem

Could you check if the issue is fixed with the following external converter: https://gist.github.com/Koenkk/002a6a797922f736db47fd4bb2f5f19c

  • save this as file next to configuration.yaml as ext_converter.js
  • add it to configuration.yaml:
external_converters:
  - ext_converter.js
  • start z2m, check if issue is fixed

Koenkk avatar Jun 02 '23 07:06 Koenkk

Heck yeah, that's why you're the boss :) That converter got temperature and humidity reporting correctly - confirmed by breathing into the sensor. CO2, VOC, and Formaldehyde are reporting values, but tough for me to confirm validity/correctness since it seems the sensor updates those at a much slower rate, and it may not be very accurate to boot. PM25 not reporting any value currently. Regardless, this is leagues better than anything I had gotten working. Thank you!

State values: { "humidity": 43, "linkquality": 163, "temperature": 28.3, "co2": 13, "formaldehyd": 514, "pm25": null, "voc": 72 }

Please let me know if there are any other logs or items I can pull for your benefit.

jmluxem avatar Jun 03 '23 05:06 jmluxem

Can you try the following, in your data/database.db change the manufacturer name from _TZE200_mja3fuja to _TZE200_dwcarsat and see if everything works now? (no external converter needed)

Koenkk avatar Jun 03 '23 15:06 Koenkk

I run HAOS with z2m as an addon. I am not seeing a 'data' directory. In my file structure, I have config/zigbee2mqtt/database.db

Within that database.db file, I changed the name to _TZE200_dwcarsat and restarted z2m, but it doesn't appear to be keeping the change - when i go back to the database.db file, the old _TZE200_mja3fuja name is back where I had just changed it.

jmluxem avatar Jun 03 '23 16:06 jmluxem

You need to stop z2m, make the change and start z2m.

Koenkk avatar Jun 04 '23 11:06 Koenkk

Thank you for that tip/correction. I updated the database.db file and now the device is working without the converter. Everything appears to be working

jmluxem avatar Jun 05 '23 00:06 jmluxem

Great, integrated the changes!

Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)

Koenkk avatar Jun 05 '23 08:06 Koenkk