Code Monkey home page Code Monkey logo

weewx-purpleair's Introduction

Purple Air - collect Purple Air air quality data

Copyright 2018 - Kenneth Baker [email protected]

What is it?

purpleair is a weewx extension to collect data from the local interface of a Purple Air air sensor (https://www.purpleair.com/). It saves this data to its own database which can then be displayed in weewx reports and graphs. The data is saved at the archive interval of the station.

Prerequisites

  1. Purpleair requires the requests Python library. This library does not come with the default installation of Python. It must be installed separately. Perhaps the fastest way to do so is to run:

    pip install requests

    or on a debian/ubuntu system run:

    apt install python-requests

Installation

  1. run the installer (from the git directory):

    wee_extension --install .

  2. restart weewx:

    sudo /etc/init.d/weewx stop sudo /etc/init.d/weewx start

This will install the purpleair.py extension into the weewx/user/ directory. It will also add the necessary data bindings, hostname, port number, database, and service configuration to the weewx.conf configuration file.

Something like the following:

[PurpleAirMonitor]
    data_binding = purpleair_binding
    hostname = purple-air.example.com
    port = 80
[DataBindings]
    [[purpleair_binding]]
        database = purpleair_sqlite
        manager = weewx.manager.DaySummaryManager
        table_name = archive
        schema = user.purpleair.schema
[Databases]
    [[purpleair_sqlite]]
        database_name = purpleair.sdb
        driver = weedb.sqlite

Display the data

To make use of the plugin you will need to modify the templates in /etc/weewx/skins/*.tmpl to include references to the new data found in the purpleair.sdb file.

Examples:

  • The current value:

$latest('purpleair_binding').pm2_5_cf_1.formatted

  • The maximum value today:

$day('purpleair_binding').pm2_5_cf_1.max.formatted

  • The time today when the maximum value occurred:

$day('purpleair_binding').pm2_5_cf_1.maxtime

  • The units:

$unit.label.pm2_5_cf_1

You can also graph these values by adding the appropriate configuration to your skin.conf file:

[[[daypurpleair]]]
    data_binding = purpleair_binding
    [[[[pm2_5_cf_1]]]]

The values stored in the database are as follows:

purple_temperature
purple_humidity
purple_pressure
pm1_0_cf_1
pm1_0_atm
pm2_5_cf_1
pm2_5_atm
pm10_0_cf_1
pm10_0_atm

Notes

The pm*_* values stored in the database are averages from the two sensors contained in the sensor.

More details about these values can be found in the document referred to here https://groups.google.com/d/msg/weewx-user/hzN9K3QH7kU/v4ETARANBQAJ.

weewx-purpleair's People

Contributors

bakerkj avatar ke6jjj avatar jpbion avatar sjthespian avatar tsrgit avatar

Watchers

James Cloos avatar

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.