Giter VIP home page Giter VIP logo

homebridge-airnow's People

Contributors

toddgreenfield avatar whtsky avatar zladukas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

homebridge-airnow's Issues

ZIP CODE aqicn_city

hello, I am looking for the code for my region (@xxxx), but it is impossible to find it with the method of the example. Do you have another solution to find it? I am looking for the code for the region in France / champagne ardenne / Sainte-savine. Thank you in advance.

I don't see the Control in HomeKit

Hi, I install the plug-in and I can see the correct information in home bridge and Eve application, but I don't see any control in HomeKit.

How Can I do visible in Homekit the AirQuality Sensor?

Thanks!!

Option for EU criteria

Currently the labels assigned to the current air quality are based on US standards.

In the EU, the criteria AQI levels are based on values of NO2, PM10, O3 and optionally PM2.5 and a bit more strict that the US. The ug/m3 values are converted to a sub-index level, and (similar to the US) the sub index that represents the worst quality defines the current AQI.

This currently results in the air quality being rated too positive when EU values are indexed by the current US standards. (Aside from the fact that the AQI based on AQICN values is miscalculated anyway, as outlined in Issue #8).

See https://en.wikipedia.org/wiki/Air_quality_index#Europe

Polling appears to occur too often

[Homebridge] [4/13/2020, 1:03:55 PM] [AirNow] AirNow air quality AQI is: 54
[Homebridge] [4/13/2020, 1:03:56 PM] [AirNow] AirNow air quality AQI is: 54
[Homebridge] [4/13/2020, 1:03:58 PM] [AirNow] AirNow air quality AQI is: 54
[Homebridge] [4/13/2020, 1:04:01 PM] [AirNow] AirNow air quality AQI is: 54
[Homebridge] [4/13/2020, 1:04:03 PM] [AirNow] AirNow air quality AQI is: 54
[Homebridge] [4/13/2020, 1:04:05 PM] [AirNow] AirNow air quality AQI is: 54
[Homebridge] [4/13/2020, 1:04:07 PM] [AirNow] AirNow air quality AQI is: 54
[Homebridge] [4/13/2020, 1:04:08 PM] [AirNow] AirNow air quality Network or Unknown Error from airnow.
[Homebridge] [4/13/2020, 1:04:09 PM] [AirNow] AirNow air quality Network or Unknown Error from airnow.
[Homebridge] [4/13/2020, 1:04:10 PM] [AirNow] AirNow air quality Network or Unknown Error from airnow.

It's not quite clear what this portion is for

getAirQuality: function(callback){

it appears redundant to this portion

getObservation: function (callback) {

and only called here

.on('get', this.getAirQuality.bind(this));

It does not follow the setTimeout polling convention here

setTimeout(function() {

which I believe is resulting in the API getting called too often

Plugin crashes Homebridge during initialization

Config:

{
      "platform": "airnow",
      "name": "AQICN",
      "provider": "aqicn",
      "aqicn_api": "XXX",
      "aqicn_city": "@3392"
}

Error:

/usr/local/lib/node_modules/homebridge/lib/api.js:50
  if (name.indexOf('.') == -1) {
           ^

TypeError: Cannot read property 'indexOf' of undefined
    at API.accessory (/usr/local/lib/node_modules/homebridge/lib/api.js:50:12)
    at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:264:42)
    at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:86:38)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)

airnow/homebridge crash when no internet connection

looks like there is an issue with handling internet connection, once there is no network, airnow module kill homebridge service,

Feb  3 04:09:13 raspberrypi homebridge[502]: /usr/lib/node_modules/homebridge-airnow/index.js:147
Feb  3 04:09:13 raspberrypi homebridge[502]: #011#011#011#011} else if (observations.status == "error") {
Feb  3 04:09:13 raspberrypi homebridge[502]: #011#011#011#011                        ^
Feb  3 04:09:13 raspberrypi homebridge[502]: TypeError: Cannot read property 'status' of undefined
Feb  3 04:09:13 raspberrypi homebridge[502]:     at Request._callback (/usr/lib/node_modules/homebridge-airnow/index.js:147:29)
Feb  3 04:09:13 raspberrypi homebridge[502]:     at self.callback (/usr/lib/node_modules/homebridge-airnow/node_modules/request/request.js:186:22)
Feb  3 04:09:13 raspberrypi homebridge[502]:     at emitOne (events.js:116:13)
Feb  3 04:09:13 raspberrypi homebridge[502]:     at Request.emit (events.js:211:7)
Feb  3 04:09:13 raspberrypi homebridge[502]:     at Request.onRequestError (/usr/lib/node_modules/homebridge-airnow/node_modules/request/request.js:878:8)
Feb  3 04:09:13 raspberrypi homebridge[502]:     at emitOne (events.js:116:13)
Feb  3 04:09:13 raspberrypi homebridge[502]:     at ClientRequest.emit (events.js:211:7)
Feb  3 04:09:13 raspberrypi homebridge[502]:     at Socket.socketErrorListener (_http_client.js:387:9)
Feb  3 04:09:13 raspberrypi homebridge[502]:     at emitOne (events.js:116:13)
Feb  3 04:09:13 raspberrypi homebridge[502]:     at Socket.emit (events.js:211:7)
Feb  3 04:09:13 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
Feb  3 04:09:13 raspberrypi systemd[1]: homebridge.service: Unit entered failed state.
Feb  3 04:09:13 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'.
Feb  3 04:09:23 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Feb  3 04:09:23 raspberrypi systemd[1]: Stopped Node.js HomeKit Server.
Feb  3 04:09:23 raspberrypi systemd[1]: Started Node.js HomeKit Server.

Change Which AQI Used From AirNow

I see in the code that the AQI from Ozone is used from AirNow, which shows an Air Quality of 43/Excellent in my dashboard, however, the overall AQI on the AirNow site reflects 110. Is there a way to change which AQI is used?

AQI is always 21

No matter which city I choose (Beijing, Singapore, Sydney, Los Angeles) the AQI from AQICN is always 21. The below line never changes in the home bridge output.

[Air Quality] AirNow air quality AQI is: 21

Binary sensors for separate pollutants

Would it be possible to add binary sensors to this plug-in? In HomeKit, binary sensors for Air Quality show the current value of a single pollutant under its details and sensors change to a triggered state when a critical value is exceeded.

Binary sensors offer more options to set up notifications and can be used to trigger automations. Such notifications can be useful as a reminder to close the window.

For reference: The Netatmo plugin for weather stations offers something similar. The indoor module of this station adds an Air Quality sensor based on CO2 levels, as well as a binary CO2 sensor. (I can add a screenshot later if you'd like)

Since this Air Quality plug-in checks the API's for quite a few different pollutants, which can result in quite a few extra tiles for binary sensors, perhaps the best way to implement binary sensors would be by adding config options to enable or disable them per pollutant. For instance, a user would be able to set up the configuration in a way that binary sensors are only added for PM2.5 and PM10 pollutants, and then not get tiles for binary sensors for NO2, O3 and other measured pollutants.

AQI or

The data from aqicn calculate PM2.5, PM10 concentration as AQI individually, which has a big difference from actually concentration value. In iOS Home app, the accessory detail showed PM2.5, PM10 unit as µg/m3, but the data is actually air quality index. Is there a way to switch to concentration value or just change the unit? It really helps understanding the true air quality.

AQI to Concentration Calculator
https://airnow.gov/index.cfm?action=airnow.calculator

aqicq availability

I really like this plugin!

Apparently the aqicq api / api.aqicn.org is undergoing some issues. I often receive an unexpected response, e.g:

  • http 505 'Bad Gateway' status code or:
  • empty json response: {"status":"nug","data":null}

When api.aqicn.org returns an unexpected response the Air Quality is reported as: UNKNOWN in the Apple Home app. Would you consider updating the plugin to show the last known valid result instead, when the plugin receives invalid data?

GET /feed/@4572/?token=xxx HTTP/1.1
host: api.waqi.info
accept: application/json
Connection: close

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 12 Apr 2018 08:41:26 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 28
Connection: close
Vary: Accept-Encoding
Access-Control-Allow-Origin: *
X-Gen-Time: 1137
X-Powered-By: rxstreamer-waqi/1.2

{"status":"nug","data":null}

A correct response would be:

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 12 Apr 2018 08:46:11 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 522
Connection: close
Vary: Accept-Encoding
Access-Control-Allow-Origin: *
X-Gen-Time: 306603
X-Powered-By: rxstreamer-waqi/1.2

{
	"status": "ok",
	"data": {
		"aqi": 80,
		"idx": 4572,
		"attributions": [{
			"url": "http://www.luchtmeetnet.nl/",
			"name": "RIVM - Rijksinstituut voor Volksgezondheid en Milieum, Landelijk Meetnet Luchtkwaliteit"
		}],
		"city": {
			"geo": [51.914233, 4.479923],
			"name": "Schiedamsevest, Rotterdam",
			"url": "http://aqicn.org/city/netherland/rotterdam/schiedamsevest/"
		},
		"dominentpol": "pm25",
		"iaqi": {
			"no2": {
				"v": 14.4
			},
			"o3": {
				"v": 5.3
			},
			"pm10": {
				"v": 30
			},
			"pm25": {
				"v": 80
			},
			"w": {
				"v": 6.1
			},
			"wg": {
				"v": 11.3
			}
		},
		"time": {
			"s": "2018-04-12 09:00:00",
			"tz": "+01:00",
			"v": 1523523600
		}
	}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.