Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Aqara TVOC Air Quality Monitor (VOCKQJK11LM) #5213

Merged
merged 2 commits into from
Nov 10, 2021

Conversation

SwoopX
Copy link
Collaborator

@SwoopX SwoopX commented Aug 16, 2021

See #4704.

@SwoopX SwoopX linked an issue Aug 16, 2021 that may be closed by this pull request
@sieren
Copy link

sieren commented Sep 6, 2021

been testing this for a while... today the VOC sensor seemed to have dropped out and is no longer receiving updates:


    "37": {
        "config": {
            "battery": 100,
            "offset": 0,
            "on": true,
            "reachable": true
        },
        "ep": 1,
        "etag": "e87790a3e14c9b9ece7f71b2e79f5521",
        "lastannounced": "2021-09-05T17:30:10Z",
        "lastseen": "2021-09-06T21:32Z",
        "manufacturername": "LUMI",
        "modelid": "lumi.airmonitor.acn01",
        "name": "Temperature 37",
        "state": {
            "lastupdated": "2021-09-06T21:32:25.306",
            "temperature": 2170
        },
        "swversion": "2020",
        "type": "ZHATemperature",
        "uniqueid": "54:ef:44:10:00:10:5a:55-01-0402"
    },
    "38": {
        "config": {
            "battery": 100,
            "offset": 0,
            "on": true,
            "reachable": true,
            "temperature": 2170
        },
        "ep": 1,
        "etag": "3d03412702181826b8676acd52a41933",
        "lastannounced": "2021-09-05T17:30:10Z",
        "lastseen": "2021-09-06T21:32Z",
        "manufacturername": "LUMI",
        "modelid": "lumi.airmonitor.acn01",
        "name": "Humidity 38",
        "state": {
            "humidity": 6187,
            "lastupdated": "2021-09-06T21:32:25.307"
        },
        "swversion": "2020",
        "type": "ZHAHumidity",
        "uniqueid": "54:ef:44:10:00:10:5a:55-01-0405"
    },
    "39": {
        "config": {
            "battery": 100,
            "on": true,
            "reachable": true,
            "temperature": 2170
        },
        "ep": 1,
        "etag": "879f191925b4d86db19f06ddb2b6ec22",
        "lastannounced": "2021-09-05T17:30:10Z",
        "lastseen": "2021-09-06T21:32Z",
        "manufacturername": "LUMI",
        "modelid": "lumi.airmonitor.acn01",
        "name": "AirQuality 39",
        "state": {
            "airquality": "good",
            "airqualityppb": 107,
            "lastupdated": "2021-09-06T11:31:33.724"
        },
        "swversion": "2020",
        "type": "ZHAAirQuality",
        "uniqueid": "54:ef:44:10:00:10:5a:55-01-000c"
    }

@sieren
Copy link

sieren commented Sep 7, 2021

Same thing happened again, after restarting the unit. Roughly ~3 hours after reset:

        "config": {
            "battery": 100,
            "on": true,
            "reachable": true,
            "temperature": 2194
        },
        "ep": 1,
        "etag": "3180a285b0272d93351b873118254286",
        "lastannounced": "2021-09-05T17:30:10Z",
        "lastseen": "2021-09-07T07:30Z",
        "manufacturername": "LUMI",
        "modelid": "lumi.airmonitor.acn01",
        "name": "AirQuality 39",
        "state": {
            "airquality": "good",
            "airqualityppb": 67,
            "lastupdated": "2021-09-07T01:09:29.878"
        },
        "swversion": "2020",
        "type": "ZHAAirQuality",
        "uniqueid": "54:ef:44:10:00:10:5a:55-01-000c"
    }
}
                    
                ```

@sieren
Copy link

sieren commented Sep 9, 2021

Nevermind, it's actually working. Seems like the device does not push update out to Zigbee for a long long time unless values change significantly.

@Mimiix
Copy link
Collaborator

Mimiix commented Sep 9, 2021

@sieren Nice to see that they continue to implement that behavior. The multi sensors do the same.

@sieren
Copy link

sieren commented Sep 9, 2021

I've taken the liberty of making HomeKit support available for this unit including emulating it as an Eve Room 2 device, which was non-trivial:

@sieren
Copy link

sieren commented Sep 10, 2021

@Mimiix im still wondering if the voc sensor needs additional polling though,compared to the temperature and humidity sensor in this unit it seems extremely slow to update. Notice especially the peaks.

1A334355-62A6-4296-AFD6-F74388A08CE6
6CBD0586-E180-42A6-AF96-3BB0F0725A1C

Compared against aqara hub output:
A47C2B80-38E7-462E-9720-50B8044BA5D4

@alegri1
Copy link

alegri1 commented Sep 21, 2021

Hi guys!
Really looking forward to this one as I have recently got two of these sensors in hope to finally build a proper home air monitoring system based on homekit.
Great committment, is there anything I could contribute with given I have those sensors? @SwoopX

@Notsosmarthome
Copy link

+1 looking forward for this. I try pairing them with Deconz (COnbee 2, latest version), but it won't work. I try pairing by holding down the button for a few seconds until a logo appears, then releasing and the small icon on the screen is supposedly looking fo ra network.

@sieren
Copy link

sieren commented Sep 30, 2021

@SwoopX I did some research about the lack of updates and according to Koenkk/zigbee2mqtt#6872 (comment) (I'm not a Zigbee2mqtt user) we also need to configure reporting for the VOC values for this device.

Now sadly I'm not super familiar with the deCONZ codebase, but looking at what's happening for the DEVLCO Air Quality sensor (L2381 in bindings.cpp):

    else if (bt.binding.clusterId == DEVELCO_AIR_QUALITY_CLUSTER_ID)
    {
        if (modelId == QLatin1String("AQSZB-110")) // Develco air quality sensor
        {
            rq.dataType = deCONZ::Zcl16BitUint;
            rq.attributeId = 0x0000;       // Measured value
            rq.minInterval = 60;
            rq.maxInterval = 600;
            rq.reportableChange16bit = 10; // According to technical manual

            return sendConfigureReportingRequest(bt, {rq});
        }
    }

I assume we need something similar for the LUMI device?
Presumably something along the lines of

    else if (bt.binding.clusterId == ANALOG_INPUT_CLUSTER_ID)
    {
      if (modelId == QLatin1String("lumi.airmonitor.acn01"))
      {
          rq.dataType = deCONZ::Zcl16BitUint;
          rq.attributeId = 0x0055;       // Present Value
          rq.minInterval = 60;
          rq.maxInterval = 3600;
          rq.reportableChange16bit = 5;

          return sendConfigureReportingRequest(bt, {rq});
      }
    }

which I've just added to my local build, pending verification. Not sure the attributeId is correct though, but maybe this helps?

@SwoopX
Copy link
Collaborator Author

SwoopX commented Oct 3, 2021

Regular attribute reporting, even with the newer Xiaomi devices, is still gambling I'm afraid. In the original device support issue, I already mentioned that it might be possible to influence the frequency of updates for the VOC values by changing/setting the attribute reporting values. For that, it's not really necessary to modify any code, it can be done in deconz GUI directly by double clicking on the attribute in question (given the cluster binding has been done previously, see here and below https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/How-to...#manually-bind-server-clusters).

In case that should indeed work, just let me know.

@sieren
Copy link

sieren commented Oct 3, 2021

Cool! Thanks for the input @SwoopX . I'll give this a shot, but I side with your findings. The code hasnt really changed the reqporting frequency at all (it only seems to report with more frequency if there are massive changes). Overall the sensor seems far less reactive than an Eve Room for example. I still wonder why the Aqara App seems to report a lot more details.
I'll run some experiments with the deCONZ GUI next. Thanks for the pointer! :)

@sieren
Copy link

sieren commented Oct 4, 2021

@SwoopX nice one, that did the trick!
I've been using 60/600 for intervals and a low reporting value and now it seems to update regularly.
IMG_3867

@sieren
Copy link

sieren commented Oct 4, 2021

Also starting to get obvious that its working on the graphs now (see red line as to where I added the attribute the way you suggested it)

IMG_08B257985465-1

@sieren
Copy link

sieren commented Oct 9, 2021

@SwoopX I tried it in a second home with another sensor, but had a hard time getting it up and running.
I did work eventually, but I can't tell if why it took me so long. The regular way of just repairing and then setting the attribute report did not work. However it ended up working with Min Interval 60 / Max Interval 3600 and Min Change 1 (after I took out the batteries and rebooted the whole device).
Unfortunately at that point I also recompiled the plugin with some changes I made on top of yours: sieren@505bc1a
(Specifically looking at the Devlco and Bosch sensor code).
Maybe you can take a look there to determine if this is relevant or not?

@manup manup added this to the v2.13.2-beta milestone Oct 11, 2021
@SwoopX
Copy link
Collaborator Author

SwoopX commented Oct 18, 2021

@sieren Are you sure the reporting configuration is working? I'm just asking because in the initial device request, the data type for present value of the analog input cluster is float, and your code it's using uint16.

Did the cherypicking already but haven't released the commit yet before confirmation.

@sieren
Copy link

sieren commented Oct 18, 2021

@SwoopX it is definitely not. Only after doing it through the UI. I couldn't find the key for float in any of the other exampel or the codebase, any pointers? happy to try it out.

@SwoopX
Copy link
Collaborator Author

SwoopX commented Oct 21, 2021

The corresponding data type would be deCONZ::ZclSingleFloat. However, I'd expect the reportable change not really fitting in as there's currently only 24 and 48 bit defined and a float is 32 bit. eventually, you'd need to define a 32bit reportable change and feed it a 10.0?

What actually happens in the GUi I cannot tell you since this is deconz core functionality we don't have access to.

@leonardpitzu
Copy link

Short question: on my side the sensor seems to be hanging. I mean the physical device - the values are stuck on screen and do not change (if i hold it in my hand the temperature does not increase). Do any of you experience this? The device becomes responsive again if i press the physical button for about 1-2 seconds. Is there anything i need to do "to keep it awake" or is it just a broken unit?

@sieren
Copy link

sieren commented Oct 27, 2021

I think what you're describing is what @SwoopX and I have been discussing.

@alegri1
Copy link

alegri1 commented Oct 27, 2021

@leonardpitzu Mines have exactly the same behavior.
I have Eve Room 2 and it is much more responsive and does not need any manual intervention.

@Mimiix
Copy link
Collaborator

Mimiix commented Oct 27, 2021

Can we please not turn this issue in a "me too" issue? There's some work on the device, so until the PR is fully merged and released keep it on-topic :)

@sieren
Copy link

sieren commented Oct 27, 2021

Thanks @Mimiix for intervening.
The values on the screen, especially PPM, will update periodically once the attribute reporting has been set. Otherwise they require manual intervention after a short while upon boot.

I haven't had time to look into the proposed changes by @SwoopX yet and try them out on my local builds yet.

@anciltech
Copy link

Hi @sieren
How were you able to get the values to report at all? Im running the latest from Swoops tvoc repository but it doesn't show the connection in the phoscon app, even though I see the sensors in the GUI and in HomeBridge/Homekit, just without values.

"config": {
"battery": null,
"on": true,
"reachable": true,
"temperature": 0
},
"ep": 1,
"etag": "60f0e0e0ffa34665db7d97d7fd7fb9be",
"lastannounced": "2021-10-20T15:45:03Z",
"lastseen": "2021-10-20T15:44Z",
"manufacturername": "LUMI",
"modelid": "lumi.airmonitor.acn01",
"name": "AirQuality 12",
"state": {
"airquality": null,
"airqualityppb": null,
"lastupdated": "none"
},
"swversion": "2020",
"type": "ZHAAirQuality",
"uniqueid": "54:ef:44:10:00:10:66:52-01-000c"
}
}

@manup
Copy link
Member

manup commented Nov 10, 2021

image

Seems to work, here is the sniffer log of the joining process:
Aqara_TVOC_join.pcapng.gz

Network key: cccccccccccccccccccccccccccccccc

Note the reporting starts even before bindings are created, later in DDF we might not even to have to specify them.

@manup manup merged commit 2a0a914 into dresden-elektronik:master Nov 10, 2021
@f04ly
Copy link

f04ly commented Nov 11, 2021

thanks for all your work. i can see the devices now in conbee app. but it is not showing up in openhab for an import.
is that part of openhabs job?

@Mimiix
Copy link
Collaborator

Mimiix commented Nov 11, 2021

@f04ly you need to re-pair them probably

@f04ly
Copy link

f04ly commented Nov 11, 2021

i did @Mimiix
i re-paired one of my 5 sensors. now i can see the one in phoscon, the others are still just in the api info
but openhab cannot discover them so far.

i think the openhab deconz binding also needs an update, but i dont know whether this is deconz job or openhab job. dont know

@Mimiix
Copy link
Collaborator

Mimiix commented Nov 11, 2021

If the RestAPI Shows them correctly, than this PR is correctly implemented.

@apper13
Copy link

apper13 commented Nov 12, 2021

I saw this sensor in May and waited until deconz is adding it. So I now got my Aqara TVOC and installed 2.13.2 today. Pairing worked perfect, but I only get Temperature and Humidty:
image
I neither get the air quality nor the battery status. What could be the reason?

@apper13
Copy link

apper13 commented Nov 13, 2021

I am able to read out all data (except the correct battery percentage, but I get the battery voltage) manually. I have problems with getting the data regularly. As mentioned in this thread I tried to change the report interval/change, but I only get the temperature regularly. I only get Humidity and Air Quality when requesting it manually. I put in 60 (min interval) and 600 (max interval) for humidity and air quality. The reportable change is 1 for humidity. For air quality I am not able to set the change (after reading it out the field is always empty). Any suggestions?

@anciltech
Copy link

anciltech commented Nov 13, 2021

Im having the same issue as apper13 on 2.13.2. Ive reset the TVOC sensor and gone through the process a few times, Humidity is always reported, sometimes Temp comes through, other times not, but the AQ is always null. Mimiix link works to get all of sensor outputs listed in deCONZ, but doesn't seem to solve the reporting of the values.

@Mimiix
Copy link
Collaborator

Mimiix commented Nov 13, 2021

This is what we see with xiaomi sensors: they report every hour (somewhere around that I think?) or on large changes (0.5degree for the multisensor).

I think this sensor is no different on that.

@apper13
Copy link

apper13 commented Nov 13, 2021

If the sensor would report every hour this would be great. The problem is that it basically never reports humidity and air quality - only when requesting it via Deconz IDE manually. For Temperature frequent updates can be seen.

@sieren
Copy link

sieren commented Nov 13, 2021

You can change the reporting interval by going to the "Analog Input Cluster" in deconz GUI, then chose "Presented Value", write the following reporting values:
Minimum Interval: 60
Maximum Interval: 3600
Reportable Change: 1

Press "Write Config" and press down on the button of the TVOC device once. You should get "Writing done" as a message in deCON GUI. if not, wait a few seconds until the write failed and try again, first clicking on "Write" and then pressing the button on the device.

@SwoopX
Copy link
Collaborator Author

SwoopX commented Nov 13, 2021

You guys having issues might want to make sure the latest firmware is installed (26720700). Eventually, the missing TVOC reports are the result of an older firmware running. After upgrade, make sure to reset and re-pair the sensor.

@anciltech
Copy link

@SwoopX im guessing an Aqara hub is required to update the firmware? I didn't see any fw sources with a quick google search

Updating the intervals as sieren posted above has helped send all of the sensor values through, although I'm seeing two issues...

  1. battery % does not get passed through to phoscon app or any other devices

image

  1. Temp does not show in phoscon app, although it is passed through to Homebridge and my end devices.

Screen Shot 2021-11-14 at 12 52 30

@sieren
Copy link

sieren commented Nov 14, 2021

@anciltech I believe @SwoopX meant the Conbee Firmware.

@anciltech
Copy link

Gotcha, just updated and battery is now showing, but is shown incorrectly as 1%.

image

Issue 2 above has remained the same

@apper13
Copy link

apper13 commented Nov 14, 2021

Updating firmware was a good hint. I have a ConBee I (are there reasons to go to ConBee II?) and updated from 26390500 to 26400500. For now I got everything (including battery which is already at 73% after 1 day ?!?!). I will test until tomorrow if I now get the data regularly. Thank you!

@apper13
Copy link

apper13 commented Nov 20, 2021

Updating firmware was a good hint. I have a ConBee I (are there reasons to go to ConBee II?) and updated from 26390500 to 26400500. For now I got everything (including battery which is already at 73% after 1 day ?!?!). I will test until tomorrow if I now get the data regularly. Thank you!

The battery status was 100% the next day, so the 73% were wrong. Also the Humidity and Temperature are sent regularly. Still not regular updates of air quality. After three days by chance one update happened... As written I have the latest firmware and set the update interval to 60/3600/1.

@Smanar
Copy link
Collaborator

Smanar commented Nov 20, 2021

Not a big difference between conbee 1 and 2.
You don't use the GUI ? to compare with values gived by the device ? for exemple the battery one.

@Rocologo
Copy link

I know how to update the firmware on the conbee, but where can I find the 2.13.02-beta GCF firmware file?

@anciltech
Copy link

Follow the link in my post above

@Notsosmarthome
Copy link

Thank you so much for your great work guys! Really looking forward to get these sensors set up. I'm running the latest FW on Conbee 2, but I can't seem to figure out how to update the version to 2.13.02-beta GCF. I'm running Hassos on RPi 3b+, latest core-2021.11.5, latest supervisor-2021.10.8.

I tried through remote terminal, with the instructions @anciltech posted, but no luck. And not through the HA addon either, I think the FW updater in the GUI never worked as good, so I guess the beta version won't work there either.

Grateful for any help!

@SwoopX SwoopX deleted the xiaomitvoc branch February 6, 2022 23:58
@roquecarlos
Copy link

Hi guys, i have add my aqara tvoc sensor to the z2m but the homebridge give alweays this error,

`28/07/2022, 23:49:54] [homebridge-z2m] Loaded homebridge-z2m v1.9.0 child bridge successfully [28/07/2022, 23:49:55] Loaded 0 cached accessories from cachedAccessories.0E79B1B83CF4. [28/07/2022, 23:49:55] [homebridge-z2m] Incorrect configuration: Entry for device is not correct: {"exclude":false,"converters":{"switch":{"type":"switch"},"occupancy":{"type":"occupancy"}}} [28/07/2022, 23:49:55] [homebridge-z2m] INVALID CONFIGURATION FOR PLUGIN: homebridge-z2m This plugin will NOT WORK until this problem is resolved. [28/07/2022, 23:49:55] Homebridge v1.5.0 (HAP v0.10.2) (homebridge-z2m) is running on port 53093

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Aqara TVOC Air Quality Monitor (VOCKQJK11LM)