Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including pimatic-hongkongpollution with all npm packages installed. Try it out:

require("pimatic/package.json"); // pimatic is a peer dependency. var pimaticHongkongpollution = require("pimatic-hongkongpollution")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

pimatic-hongkongpollution v0.0.1

Pimatic plugin to get current pollution readings and forecasts from the Hong Kong Environmental Department.

pimatic-hongkongpollution

Hong Kong Pollution Readings and Forecasts for Pimatic. This plugin uses the node.js module hongkong-pollution to grab the information.

Data is taken from the Hong Kong Environmental Departments Website and RSS feed. In Hong Kong, pollution is a big consideration as it is for many large cities. The reason for developing this module is so that you can have reminders to wear a pollution mask, stay indoors or combine it with other modules in Pimatic so you can automatically turn on the indoor Air Filter.

Plugin Configuration

You can load the plugin by editing your config.json to include:

{
   "plugin": "hongkongpollution"
}

in the plugins Array.

Device Configuration

Devices can be added by adding them to the devices Array in the config file. Set the class property to PollutionForecastDevice or PollutionReadingsDevice

For device configuration options see the device-config-schema file.

Device examples

Pollution Forecast Device

This gives you a general forecast of the AQHI for the whole day, including a human friendly "Risk" as well as the aggregated AQHI reading.

{
  "id": "pollution-forecast",
  "name": "HK Pollution Forecast",
  "class": "PollutionForecastDevice",
}

The following optional settings are available. For more information see device-config-schema.

{
  "showRoadsideAQHI": true,
  "showGeneralAQHI": true,
  "showRoadsideRisk": true,
  "showGeneralRisk": true,
  "updateInterval": 3600,
  "language": "en"
}

Pollution Readings Device

This allows you to show all pollution readings for a specific area such as PM2.5,PM10,NO2,SO2,O3,CO.

The most important setting is which reporting station to use. Click here for more information about which reporting station to use for your district. The example below uses the "Sham Sha Po" monitoring station.

{
  "id": "pollution-readings",
  "name": "HK Pollution Readings",
  "class": "PollutionReadingsDevice",
  "reportingStation": "Sham Sha Po"
}

The following optional settings are available. For more information see device-config-schema.

{
  "updateInterval": 3600,
  "showNO2": true,
  "showCO": true,
  "showSO2": true,
  "showO3": true,
  "showPM2_5": true,
  "showPM10": true,
  "showAQHI": true
}

Air Quality information

TODO

  • Add Beach Water Quality
  • Add some pretty graphics to the front-end (how can I do this?)
  • Support rules so we can automate things using the readings from this module (need to do more research on how this works)
  • I would love to have some way to test using Mocha, right now this seems impossible.

Contributing

Feel free to submit any pull requests or add functionality, I'm usually pretty responsive.

If you like the module, please consider donating some bitcoin or litecoin.

Bitcoin

LNzdZksXcCF6qXbuiQpHPQ7LUeHuWa8dDW

LiteCoin

LNzdZksXcCF6qXbuiQpHPQ7LUeHuWa8dDW

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free