staromeste / homebridge-http-advanced-accessory

Supports all devices on HomeBridge Platform / Bridges devices to http
Apache License 2.0
65 stars 22 forks source link

Unable to see optional characteristic PM2_5Density #34

Open problemss opened 2 years ago

problemss commented 2 years ago

I setup my sensor as follows.

{ "accessory": "HttpAdvancedAccessory", "service": "AirQualitySensor", "name": "Air Quality", "debug": true, "forceRefreshDelay": 1800, "optionCharacteristic": [ "NitrogenDioxideDensity", "OzoneDensity", "PM10Density", "PM2_5Density", "SulphurDioxideDensity" ], "urls": { "getAirQuality": {...

All the optional characteristics are being used, but PM2_5Density is never mentioned in the logs and it is not generating any errors. I am assuming it has something to do with the underscore. I have the proper getPM2_5Density parameter, but it is never called.

The log looks like this on startup

[9/7/2021, 6:36:05 PM] [Air Quality] creating new emitter for getAirQuality [9/7/2021, 6:36:05 PM] [Air Quality] creating new emitter for getNitrogenDioxideDensity [9/7/2021, 6:36:05 PM] [Air Quality] creating new emitter for getOzoneDensity [9/7/2021, 6:36:05 PM] [Air Quality] creating new emitter for getPM10Density [9/7/2021, 6:36:05 PM] [Air Quality] creating new emitter for getSulphurDioxideDensity [9/7/2021, 6:36:05 PM] [Air Quality] requested update for action getAirQuality

reididetnobal commented 2 years ago

I'm a bit late to the party but, I had the same issue. After looking at the code, i tried "PM2.5Density" / "getPM2.5Density" and it worked for me

Here an example of my config:

{ "accessory": "HttpAdvancedAccessory", "service": "AirQualitySensor", "name": "31 - St-Dominique", "forceRefreshDelay": 1800, "debug": true, "optionCharacteristic": [ "PM2.5Density", "OzoneDensity", "NitrogenDioxideDensity", "SulphurDioxideDensity" ], "urls": { "getAirQuality": { "url": "http://ville.montreal.qc.ca/rsqa/servlet/makeXmlActuel", "mappers": [ { "type": "xpath", "parameters": { "xpath": "string(/iqa/journee/station[@id='31']/echantillon[last()]/qualite/@value)" } }, { "type": "eval", "parameters": { "expression": "value = parseInt(value); if(value >= 1 && value <= 15){value = 1} else if (value > 15 && value <= 25) {value = 2} else if (value > 25 && value <= 35) {value = 3} else if (value > 35 && value <= 50) {value = 4} else if (value > 50 ) {value = 5} else {value = 0}" } } ] }, "getPM2.5Density": { "url": "http://ville.montreal.qc.ca/rsqa/servlet/makeXmlActuel", "mappers": [ { "type": "xpath", "parameters": { "xpath": "string(/iqa/journee/station[@id='31']/echantillon[last()]/polluant[@nom=\"PM\"]/@value)" } } ] }, "getOzoneDensity": { "url": "http://ville.montreal.qc.ca/rsqa/servlet/makeXmlActuel", "mappers": [ { "type": "xpath", "parameters": { "xpath": "string(/iqa/journee/station[@id='31']/echantillon[last()]/polluant[@nom=\"O3\"]/@value)" } } ] }, "getNitrogenDioxideDensity": { "url": "http://ville.montreal.qc.ca/rsqa/servlet/makeXmlActuel", "mappers": [ { "type": "xpath", "parameters": { "xpath": "string(/iqa/journee/station[@id='31']/echantillon[last()]/polluant[@nom=\"NO2\"]/@value)" } } ] }, "getSulphurDioxideDensity": { "url": "http://ville.montreal.qc.ca/rsqa/servlet/makeXmlActuel", "mappers": [ { "type": "xpath", "parameters": { "xpath": "string(/iqa/journee/station[@id='31']/echantillon[last()]/polluant[@nom=\"SO2\"]/@value)" } } ] } } },

problemss commented 2 years ago

Thank you! I will try that out!