PatchworkBoy / homebridge-edomoticz

Domoticz Homebridge-Plugin
Other
118 stars 43 forks source link

CO2 sensor, values not going to HMCharacteristicTypeCarbonDioxideLevel #249

Open JustKarma123 opened 2 years ago

JustKarma123 commented 2 years ago

Really love the eDomoticz plugin for Homebridge it's amazing thank you for all the hard work.

I have been using this for a while and got a issue with how Carbon Dioxide levels are presented from Domoticz to Homebridge.

I am using MCO Home MH9 Carbon Dioxide sensors and in Domoticz this is correctly logged as Carbon Dioxide with values from 0-5000ppm and with an air quality value of 0-5 (0=not used, 1=excellent, 2=good, 3=fair, 4=inferior and 5=poor). In Domoticz the device is TYPE "Air quality" and SUBTYPE is "Voltcraft CO-20". This SUBTYPE is Carbon Dioxide with values 0-5000ppm.

When the MCO Home MH9 Carbon Dioxide sensor is exposed to Homebridge via eDomoticz the device is correctly recognised as type "Air Quality Sensor" and "Air Quality" (HMCharacteristicValueAirQuality) values 0-5 are correct. However the Co2 values in ppm (0-5000) are seem to be going to "Air Particulate Density" (HMCharacteristicTypeAirParticulateDensity).

This is the in correct HMCharacteristicType. Carbon Dioxide, Co2 PPM, values should be going to HMCharacteristicTypeCarbonDioxideLevel. Is there anyway this can be updated? If you need any further information please let me know.

https://developer.apple.com/documentation/homekit/hmcharacteristictypecarbondioxidelevel

PatchworkBoy commented 1 year ago

No mention of support for HMCharacteristicTypeCarbonDioxideLevel as an optional characteristic in https://github.com/homebridge/HAP-NodeJS/blob/master/src/lib/definitions/ServiceDefinitions.ts for AirQuality service (see https://github.com/homebridge/HAP-NodeJS/blob/0655c18fc3ccc0637166ccfd915bf7aef0d2b14f/src/lib/definitions/ServiceDefinitions.ts#L143)

Nothing I can do til HAP-NodeJS / Homebridge includes it in it's service definitions.

PatchworkBoy commented 1 year ago

Would need rewriting to support the CarbonDioxide Sensor service type instead of AirQuality service type as that's the only service type allowed to have Characteristic.CarbonDioxideLevel... https://github.com/homebridge/HAP-NodeJS/blob/0655c18fc3ccc0637166ccfd915bf7aef0d2b14f/src/lib/definitions/ServiceDefinitions.ts#L401

Doesn't look like Homebridge has a spec that would match an AirQuality device with Co2 level, which makes implementation tricky.