SANdood / Ecobee-Suite

Ecobee Suite is for integrating Ecobee thermostats & sensors with the Hubitat home automation platform
109 stars 154 forks source link

Add AQI, CO2, and VOC attributes to device #72

Open dseravalli opened 10 months ago

dseravalli commented 10 months ago

It appears this data is exposed by the ecobee API - I see it as actualVOC, actualCO2, actualAQScore, actualAQAccuracy in the runtime data. Can this be added to the hubitat thermostat device state? Are you open to a PR? Thanks!

API call I'm using for reference: https://api.ecobee.com/1/thermostat?format=json&body=%7B%22selection%22%3A%7B%22selectionType%22%3A%22registered%22%2C%22selectionMatch%22%3A%22%22%2C%22includeRuntime%22%3A%20true%7D%7D

and response:

{
    "page": {
        "page": 1,
        "totalPages": 1,
        "pageSize": 1,
        "total": 1
    },
    "thermostatList": [
        {
            "identifier": "<redacted>",
            "name": "Thermostat",
            "thermostatRev": "230912165559",
            "isRegistered": true,
            "modelNumber": "aresSmart",
            "brand": "ecobee",
            "features": "Home,HomeKit",
            "lastModified": "2023-09-12 16:55:59",
            "thermostatTime": "2023-09-12 16:24:05",
            "utcTime": "2023-09-12 20:24:05",
            "runtime": {
                "runtimeRev": "230912202227",
                "connected": true,
                "firstConnected": "2023-08-05 01:26:48",
                "connectDateTime": "2023-09-07 23:37:29",
                "disconnectDateTime": "2023-08-12 22:13:18",
                "lastModified": "2023-09-12 20:22:27",
                "lastStatusModified": "2023-09-12 20:22:27",
                "runtimeDate": "2023-09-12",
                "runtimeInterval": 243,
                "actualTemperature": 745,
                "actualHumidity": 65,
                "rawTemperature": 745,
                "showIconMode": 0,
                "desiredHeat": 650,
                "desiredCool": 740,
                "desiredHumidity": 36,
                "desiredDehumidity": 60,
                "desiredFanMode": "auto",
                "actualVOC": 777,
                "actualCO2": 616,
                "actualAQAccuracy": 4,
                "actualAQScore": 54,
                "desiredHeatRange": [
                    450,
                    790
                ],
                "desiredCoolRange": [
                    608,
                    920
                ]
            }
        }
    ],
    "status": {
        "code": 0,
        "message": ""
    }
}
jonozzz commented 4 months ago

Can you try my changes https://github.com/jonozzz/Ecobee-Suite

SANdood commented 4 months ago

I will be adding your changes, modified somewhat for consistency & efficiency for those that don't have the Premium version. Also adding the displayAirQuality setting, which allows you to turn on/off the Air Quality automations on the thermostat.

I'll let you know when I have a test version for you to try...

SANdood commented 4 months ago

Changing the names for consistency (this is what you get on a non-Premium ecobee):

airCO2 : null airQAccuracy : 0 airQScore : null airVOC : null