deanlyoung/homebridge-awair

Co2 trigger detected

jwhits opened this issue · 2 comments

I can't seem to get the Co2 detected to trigger.

I have the Co2 threshold set to 500 in the config file just to see if I can get it to trigger for some testing.

I put some extra logging in to see it falls into the if statement to set Co2 detected. Which it is, see below. I am wondering if no value is being passed to Characteristic.CarbonDioxideDetected?

that.carbonDioxideService.setCharacteristic(Characteristic.CarbonDioxideDetected);

[2018-9-4 12:15:08] [Awair Bedroom] http://developer-apis.awair.is/v1/users/self/devices/awair/9339/air-data/15-min-avg?limit=1&desc=true
[2018-9-4 12:15:09] [Awair Bedroom] {"temp":18.31,"humid":64.95,"co2":555,"voc":630,"dust":31.5}
[2018-9-4 12:15:09] [Awair Bedroom] that.carbonDioxideThreshold: 500
[2018-9-4 12:15:09] [Awair Bedroom] co2: 555
[2018-9-4 12:15:09] [Awair Bedroom] co2 Threshhold detected: 500 Actual: 555
[2018-9-4 12:15:09] [Awair Bedroom] equation: (630 * 72.66578273019740 * 1 * 101.32) / ((273.15 + 18.31) * 8.3144)
[2018-9-4 12:15:09] [Awair Bedroom] tvoc: 1914.0611645549182 ug/m^3

Attached screen shot of what it looks like home home app.

fullsizeoutput_16a2

@jwhits good find! I hadn’t tested this one yet.

Luckily a simple little fix 😊
Was missing , 0 for not detected or , 1 for detected 🤦🏻‍♂️

Also found a typo involving the polling_interval where the code used that, but the example configs used polling 😬😱