Thispluginisnowdeprecated/archived/read-only.
ItisrecommendedthatyouswitchtothesecondgenerationHomebridgeDynamicPlatformplugin:homebridge-awair2
homebridge-awairAwairpluginforhomebridge:https://github.com/nfarina/homebridge
Basedonthegreatworkof@henrypoydar.
ThisisaverybasicpluginforNfarina'samazingHomebridgeproject.ItwillfetchcurrentsensorconditionsfromanAwairdevice(e.g.Awair,AwairGlow,AwairMint,AwairOmni,Awair2ndEditionorAwairElement)andprovideavailablesensorreadings(e.g.temperature,humidity,carbondioxide,TVOC,anddust/PM2.5/PM10)informationforHomeKit.
YoucanlookatthecurrentAwairinformationviaHomeKitenabledAppsonyouriOSdeviceorevenaskSiriforthem.
Itwillgetnewdataonceevery15minutes(default),butitcanbecustomizedinconfig.json.
InstallationInstallhomebridgeusing:[sudo]npminstall-ghomebridgeInstallthispluginusing:[sudo]npminstall-ghomebridge-awairUpdateyourconfigurationfile.Seethesamplebelow.You'llneedtorunanHTTPrequesttoobtaineachAwair'sdeviceID(devId)anddevicetype(devType).
curl-XGET\https://developer-apis.awair.is/v1/users/self/devices\-H'Authorization:Bearer{developer-token}'You'llalsoneedtorequestaccesstotheAwairDeveloperConsoletoobtainyourDeveloperToken(token).
TheAwairDeveloperAPIDocumentationexplainstheinnerworkingsoftheAwairDeveloperAPI,butforthemostpartisnotnecessarytousethisplugin.
ConfigurationConfigurationsample:
Addthefollowinginformationtoyourconfigfile(note:shownwith(6)exampledevices:Awair,AwairGlow,AwairMint,AwairOmni,Awair2ndEditionandAwairElement).
Seeconfig-sample.json
"accessories":[{"accessory":"Awair","name":"ExampleRoom1Awair","token":"AAA.AAA.AAA","manufacturer":"Awair","devType":"awair","devId":"123","serial":"example-serial_123","model":"Awair","carbonDioxideThreshold":1200,"carbonDioxideThresholdOff":1200,"voc_mixture_mw":72.66578273019740,"air_quality_method":"awair-score","userType":"users/self","endpoint":"15-min-avg","polling_interval":900,"limit":12},{"accessory":"Awair","name":"ExampleRoom2AwairGlow","token":"AAA.AAA.AAA","manufacturer":"Awair","devType":"awair-glow","devId":"124","serial":"example-serial_124","model":"AwairGlow","carbonDioxideThreshold":1200,"carbonDioxideThresholdOff":900,"voc_mixture_mw":72.66578273019740,"air_quality_method":"awair-score","userType":"users/self","endpoint":"15-min-avg","polling_interval":900,"limit":12},{"accessory":"Awair","name":"ExampleRoom3AwairMint","token":"AAA.AAA.AAA","manufacturer":"Awair","devType":"awair-mint","devId":"125","serial":"example-serial_125","model":"AwairMint","carbonDioxideThreshold":0,"carbonDioxideThresholdOff":0,"voc_mixture_mw":72.66578273019740,"air_quality_method":"awair-score","userType":"users/self","endpoint":"15-min-avg","polling_interval":900,"limit":12},{"accessory":"Awair","name":"ExampleRoom4AwairOmni","token":"AAA.AAA.AAA","manufacturer":"Awair","devType":"awair-omni","devId":"126","serial":"example-serial_126","model":"AwairOmni","carbonDioxideThreshold":1200,"carbonDioxideThresholdOff":800,"voc_mixture_mw":72.66578273019740,"air_quality_method":"awair-score","userType":"users/self","endpoint":"15-min-avg","polling_interval":900,"limit":12},{"accessory":"Awair","name":"ExampleRoom5Awair2ndEdition","token":"AAA.AAA.AAA","manufacturer":"Awair","devType":"awair-r2","devId":"127","serial":"example-serial_127","model":"Awair2ndEdition","carbonDioxideThreshold":1200,"carbonDioxideThresholdOff":1000,"voc_mixture_mw":72.66578273019740,"air_quality_method":"awair-score","userType":"users/self","endpoint":"15-min-avg","polling_interval":900,"limit":12},{"accessory":"Awair","name":"ExampleRoom6AwairElement","token":"AAA.AAA.AAA","manufacturer":"Awair","devType":"awair-element","devId":"127","serial":"example-serial_127","model":"AwairElement","carbonDioxideThreshold":1200,"carbonDioxideThresholdOff":1000,"voc_mixture_mw":72.66578273019740,"air_quality_method":"awair-score","userType":"users/self","endpoint":"15-min-avg","polling_interval":900,"limit":12}]Descriptions`accessory`=>TheHomebridgeAccessory(REQUIRED,mustbeexactly:`Awair`)`name`=>TheaccessorynamethatappearsbydefaultinHomeKit(REQUIRED,canbeanything)`token`=>DeveloperToken(REQUIRED,see[Installation](#installation))`manufacturer`=>Manufacturer(OPTIONAL,default=`Awair`)`devType`=>DeviceType(REQUIRED,options:`awair`,`awair-glow`,`awair-mint`,`awair-omni`,`awair-r2`or'awair-element')`devId`=>DeviceID(REQUIRED,see[Installation](#installation))`serial`=>SerialNumber(OPTIONAL,default=`devType_devId`,options:`mac-address`or`devType_devId`)`model`=>DeviceModel(OPTIONAL,default=`devType`,options:`Awair`,`AwairGlow`,`AwairMint`,`AwairOmni`,`Awair2ndEdition`,'AwairElement')`carbonDioxideThreshold`=>(OPTIONAL,default=`0`[i.e.OFF],thelevelatwhichHomeKitwilltriggeranalertfortheCO2inppm)`carbonDioxideThresholdOff`=>(OPTIONAL,default=`0`[i.e.`carbonDioxideThreshold`],thelevelatwhichHomeKitwillturnoffthetriggeralertfortheCO2inppm,toensurethatitdoesn'ttriggeron/offtoofrequentlychooseanumberlowerthan`carbonDioxideThreshold`)`voc_mixture_mw`=>TheMolecularWeight(g/mol)ofareferencegasormixturethatyouusetoconvertfromppbtoug/m^3(OPTIONAL,default=`72.66578273019740`)`air_quality_method`=>AirqualitycalculationmethodusedtodefinetheAirQualityChracteristic(OPTIONAL,default=`awair-score`,options:`awair-score`,`aqi`,`nowcast-aqi`)`endpoint`=>The`/air-data`endpointtouse(OPTIONAL,default=`15-min-avg`,options:`15-min-avg`,`5-min-avg`,`raw`,or`latest`)`polling_interval`=>Thefrequency(OPTIONAL,default=`900`(15minutes),units:seconds,thatyouwouldliketoupdatethedatainHomeKit)`userType`=>Thetypeofuseraccount(OPTIONAL,default=`users/self`,options:`users/self`or`orgs/###`,where###istheAwairOrganization`orgId`)`limit`=>Numberofconsecutive10seconddatapointsreturnedperrequest,usedforcustomaveragingofsensorvaluesfrom`/raw`endpoint(OPTIONAL,default=`12`i.e.2minuteaverage)`url`=>TheAwairurltopoll(OPTIONAL,default=`https://developer-apis.awair.is/v1/users/self/devices/:device_type/:device_id/air-data/:endpoint?limit=:limit&desc=true`,EDITINGNOTRECOMMENDED)`logging`=>WhethertooutputlogstotheHomebridgelogs(OPTIONAL,default=`false`)`logging_level`=>Howverboselytolog(OPTIONAL,default=`0`,options:`0`,`1`,`2`,`3`)APIResponseSeeresponse.sample.json
ResourcesAwairAPI:https://docs.developer.getawair.com/Homebridge:https://github.com/nfarina/homebridgeHomebridgeplugindevelopment:https://blog.theodo.fr/2017/08/make-siri-perfect-home-companion-devices-not-supported-apple-homekit/ListofServicesandconventions:https://github.com/KhaosT/HAP-NodeJS/blob/master/lib/gen/HomeKitTypes.jsAnotherAwairplugin:https://github.com/henrypoydar/homebridge-awair-glowReferenceAQplugin:https://github.com/toto/homebridge-airrohrRefenercetemperatureplugin:https://github.com/metbosch/homebridge-http-temperatureAQICalculationNPMpackage:https://www.npmjs.com/package/aqi-bot
评论