Coder Social home page Coder Social logo

airpi's Introduction

AirPi

Python support for the AirPi, a Raspberry Pi weather station and air quality monitor add-on board. The AirPi hardware was conceived and produced by Alyssa Dayan and Tom Hartley.

Installation

Be sure to read the documentation in the docs folder first, and for more detailed instructions.

New Install

The quickest way to install on a new Raspberry Pi is:

curl -s https://raw.githubusercontent.com/haydnw/airpi/master/install.sh | sudo sh

If you're scared about executing code straight from the internet (and you should be!) then you can view it first by doing this:

curl -s https://raw.githubusercontent.com/haydnw/airpi/master/install.sh | more

Upgrade Existing Install

Upgrading will overwrite your existing settings files; save them first to preserve settings. To upgrade an existing install to the latest version: git pull

Usage

airpictl.sh normal

See the docs folder for instructions on using other run modes.

Bug Reports

Bug reports should be submitted on GitHub.

  • Ensure you are running the latest verison of the software, as a fix for your problem may already have been implemented.
  • Try running the development branch of the repository, as a fix for your problem may be under development at the moment.
  • If you still need to report a bug, please include the current software version (run airpictl.sh ver). You should also run the software with debug = yes in the settings file (cfg\settings.cfg), and then include the last few lines of output in the bug report.

Support

There is no formal support mechanism for the AirPi hardware, nor is there any implied or explicit support offered or in any way guaranteed for this fork of the software. You may, however, find the AirPi discussion board a useful source of information.

This Fork - Haydn Williams

Development on this fork has been carried out by Haydn Williams, with attribution for extra assistance in the code where appropriate.

2015-12-17:

  • [NEW] Install Git if not already present (for Raspbian Jessie Lite).
  • [NEW] Install GPS packages as part of installation script, if requested by user.

2015-11-11:

  • [NEW] Add line to instructions to get GPS working in Raspbian Jessie (thanks Sven!).

2015-11-09:

  • [NEW] Add MySQL support to outputs.

2015-11-06:

  • [FIX] Improvements to installation script and accompanying docs.

2015-10-16:

  • [FIX] Various bug fixes and minor improvements to GPS support.

2015-05-12:

  • [NEW] Improve code by making Support plugins sub-classes of Plugin object.

2015-05-11:

  • [FIX] No more error message when LDR is in complete darkness.
  • [FIX] Calibration now fully working.
  • [FIX] Ignore default (dummy) Ubidots sensor IDs.
  • [FIX] Correctly parse cfg/outputs.cfg when [Notes] is included.

2015-05-02:

  • [NEW] 'Limits' feature to alert you when a measure goes above a particular value.
  • [NEW] Dashboard output plugin to easily show whether limits have been breached.
  • [NEW] Added support for 'limits' to Print, CSV and JSON output plugins.
  • [FIX] Major refactor of output plugin parameter architecture: + Checking validity is now done in the output plugin object instead of by airpi.py + Output plugins now inherit a number of methods from Output object, and have a number of abstract and static classes to aid inheritance.
  • [FIX] CSV output plugin now writes time at which the sample was taken, instead of time at which the file was written to.
  • [FIX] Lots of pylint improvements.

2015-02-25:

  • [NEW] Output to Ubidots (www.ubidots.com).
  • [FIX] More informative output regarding Dweet errors.

2015-02-20:

  • [NEW] Print the name of sensors which fail to obtain data (instead of generic "something failed").
  • [FIX] Time on HTTP graph x-axes now correct for most timezones (thanks to tvoverbeek).

2015-02-09:

  • [NEW] Automated install script - just run: curl -s https://raw.githubusercontent.com/haydnw/AirPi/development2/install.sh | sudo sh If you're worried about security, replace sudo sh with more to view the entire script in all its glory first.

2014-12-31:

  • [FIX] HTTP output plugin now works correctly with bootstart. N.B. Full path for wwwPath must be set explicitly in cfg/outputs.cfg in such cases. If not, AirPi assumes /home/pi/AirPi/www.
  • Updates to settings.cfg for case of parameter names, and LED explanations.

2014-12-30:

  • [NEW] Show warning if cannot sample quickly enough (i.e. sampling frequency is too short / fast).
  • [NEW] Output plugins now include milliseconds in time.
  • [FIX] Samples now counted correctly (increment per actual sample, not per check).
  • [FIX] Output the time a few milliseconds closer to the actual sample time.

2014-12-27:

  • [NEW] Added Python templates to docs folder.
  • Updated docs.
  • Revised readme.

2014-12-25:

  • [NEW] Added datasheets to repository.
  • Clarified names for BMP085 and DHT-22 sensors.
  • Added first draft of instructions on how to use the software.

2014-12-16:

  • [FIX] airpibootstart script now working again. N.B. Assumes installation is in /home/pi/AirPi - see boot/README.md for details.

2014-12-07:

  • [NEW] Added ver argument to airpictl.sh, to display version and upgrade information.
  • [FIX] Fixed error in lambda function for CO calibration (not used at present).

2014-11-30:

  • Improved 'help' feature for list of sensors, and for Xively, Dweet and HTTP output plugins.
  • [FIX] Resolved an issue with Relative_Humidity not working (DHT22).

2014-11-23:

  • Added first basic 'help' to give required Xively channel names.
    • Controlled by help parameter in cfg/settings.cfg.

2014-11-16:

2014-10-17:

  • Added JSON output.

2014-10-06:

  • Added ability to do 'dummy runs' for a predefined period before a run starts properly, to ensure all sensors are up and running, and won't just report back zeroes.
    • Controlled by dummyduration parameter in cfg/settings.cfg - set to 0 for no dummy runs. Recommended is 15.

2014-10-03:

  • Added ability to stop a run after X samples.
    • Controlled by stopafter parameter in cfg/settings.cfg - set to 0 to run indefinitely.
  • Added warning if GPS socket not detected when GPS sensor enabled.

2014-09-26:

  • Added dweet output.

2014-08-26:

  • Added ability to output average data (e.g. read every 1 min for 10 mins, then output the average for the 10 mins).
    • Controlled by averageFreq parameter in cfg/settings.cfg - set to at least twice sampleFreq to enable averaging.

2014-08-21:

  • Code tidying:
    • Moved the check whether calibration is required into a super function called from each output subclass now.
    • Made multiple changes to all .py files in line with Pylint recommendations as per PEP 8 style guide.
    • Renamed 'data' to 'params' in output subclasses, to reflect their true nature and reduce confusion with data produced by sensors.
    • Massive refactoring of airpi.py by extracting methods to facilitate code reuse and simplificaiton.

2014-08-12:

  • Added airpictl.sh script to control sampling in different modes.
    • Run ./airpictl.sh to see options and usage.
    • Includes 'background' and 'unattended', so you can SSH into your Pi, start it, then quit.
  • Moved all config files to cfg directory.
  • Moved all log files (and redirected output from airpictl.sh) to log directory.

2014-07-26:

  • Added ability to record metadata such as Raspberry Pi serial no. and operator name at start of run.
    • Controlled by metadatareqd parameters in cfg/outputs.cfg - set to True to output metadata.

2014-07-21:

  • Added ability to start automatically at boot for headless operation (does not require any user interaction).
    • Controlled by bootstart parameter in cfg/settings.cfg.
    • See the boot directory for more info.

2014-07-18:

  • Abort and inform user if no output modules are enabled.
  • Added 'Notifications' module which allow messages to be sent when errors occur. Includes email, SMS and tweet.
    • Controlled by cfgs/notifications.cfg.
  • Renamed 'data' array to 'parameters' to better reflect its content, and avoid confusion with actual data.

2014-07-15:

  • Added the following new options to cfg/settings.cfg:
    • Greater control of LED behaviour.
    • Can disable error messages printed to screen.
    • Can print to screen in CSV format.
  • Standard print-to-screen format tidied up and made more digestable.
  • Output modules requiring internet access will not be loaded if there is no connection available.

2014-07-14:

  • Added ThingSpeak output.
  • Rounded Xively output to 2dp.
  • Can kill the process a bit more nicely using Ctrl+C.
  • Can automatically name CSV files and HTTP titles using date and hostname.
    • Controlled by use of <date> and <hostname> in cfg/outputs.cfg
  • outputDir parameter is now required for csvoutput, to avoid writing to /root when loading at boot.
    • Needs to be in [CSVOutput] section of cfg/outputs.cfg.

Changes - Fred Sonnenwald


This development branch of the AirPi code adds several features and bugfixes that I've developed as part of my AirPi project.

It additionally incorporates changes by Jon Hogg (jncl), which include code cleanups, error logging, and GPS sensor support.

New features:

  • Support for UVI-01 sensor
  • Can disable LEDs
  • Raingauge support
  • Support for TGS-2600 Air Quality sensor
  • CSV logging
  • Built in HTTP server to display results nicely
    • Looks pretty using Twitter Bootstrap
    • RSS feed
    • Nice graphs using Flot
    • Can load in CSV history for long period graphs
    • HTTP/1.0 or HTTP/1.1
  • Sensor calibration, not just raw values
  • GPS sensor support (untested by me, so may not be compatible with the HTTP or CSV code)

Bugfixes:

  • Pressure sensor calibration (jaceydowell)
  • Could not change mslp setting in pressure sensor
  • Don't just ignore failed readings (record 0 instead)
  • High CPU usage
  • Hopefully fixed an issue with readings hanging on DHT22

Original Project - Alyssa Dayan and Tom Hartley.


This is the original code for the project located at http://airpi.es

Currently it is split into airpi.py, as well as multiple sensor and multiple output plugins. airpi.py collects data from each of the input plugins specified in sensors.cfg, and then passes the data provided by them to each output defined in outputs.cfg. The code for each sensor plugin is contained in the sensors folder and the code for each output plugin in the outputs folder.

Some of the files are based off code for the Raspberry Pi written by Adafruit: https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code

For original installation instructions, see http://airpi.es/kit.php

For ease of use when working with scripts, you may want to add the AirPi folder to your $PATH.

airpi's People

Contributors

chrisf4lc0n avatar guruthree avatar haydnw avatar jaycedowell avatar nocturnal42 avatar rjlanc 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

Watchers

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

airpi's Issues

Failed to import plugin Xively: global name 'http' is not defined

Running on the latest release I´m having trouble with the xively plugin:

Outputs.cfg:
[HTTP]
filename = http
enabled = no
calibration = off
wwwPath = /home/pi/AirPi/WWW/ ; Must be full path if used with AirPi bootstart $
port = 8099
history = on
historyFile = history.dat
historySize = 2880
historyInterval = 30
historyCalibrated = false
title = AirPi -
about = This is an AirPi pollution / air quality monitoring device.
target = internet

[Xively]
filename = xively
enabled = yes
apikey = {myKey}
feedid = {myFeedId}
calibration = off
target = internet

Run log on raspberry:
==========================================================
Loading: OUTPUTS
ERROR: Failed to import plugin Xively: global name 'http' is not defined
==========================================================

Rain Gauge convert the Bucket Tips to mm per hour

I was trying to implement it myself into the support.cfg but I have to admit I have failed...
Since 1 tip equals to 0.2794mm the equation should be something like:
Total of the tips times 0.2794mm in 3600 seconds and reset, but since I am an absolute Python I have no idea whatsoever on how to implement it...

Error csvoutput

Loading: OUTPUTS
Success: Loaded output plugin Print
ERROR: Could not import output module csvoutput
ERROR: Did not import output plugin CSVOutput: No module named calibration
Traceback (most recent call last):
File "/home/pi/AirPi/airpi.py", line 1356, in
PLUGINSOUTPUTS = set_up_outputs()
File "/home/pi/AirPi/airpi.py", line 604, in set_up_outputs
raise excep
ImportError: No module named calibration

GPS and xively

If GPS is enabled, it´s not possible to upload to Xively ?

I get (coordinates anonymized):

_DEBUG:main: ERROR: Exception during output: 'Disposition'
DEBUG:main: GPS output (55.71072, 12.57942, -6.6, 'fixed', 'indoor')
INFO:main: Success: Data successfully obtained from all sensors.
DEBUG:main: Dataset to output to <outputs.csvoutput.CSVOutput object at 0xa646b150>:
DEBUG:main: [{'description': 'BOSCH combined temperature and pressure sensor.', 'symbol': 'C', 'value': 30.8, 'breach': False, 'readingtype': 'sample', 'sensor': 'BMP085-temp', 'unit': 'Celsius', 'name': 'Temperature-BMP'}, {'description': 'BOSCH combined temperature and pressure sensor.', 'symbol': 'hPa', 'value': 998.676351863236, 'breach': False, 'readingtype': 'sample', 'sensor': 'BMP085-pres', 'unit': 'Hectopascal', 'name': 'Pressure'}, {'description': 'A combined temperature and humidity sensor.', 'symbol': '%', 'value': 23.5, 'breach': False, 'readingtype': 'sample', 'sensor': 'DHT22-hum', 'unit': '% Relative Humidity', 'name': 'Relative_Humidity'}, {'description': 'A combined temperature and humidity sensor.', 'symbol': 'C', 'value': 31.0, 'breach': False, 'readingtype': 'sample', 'sensor': 'DHT22-temp', 'unit': 'Celsius', 'name': 'Temperature-DHT'}, {'description': 'A light dependent resistor', 'symbol': 'Ohms', 'value': 535.5303810504636, 'breach': False, 'readingtype': 'sample', 'sensor': 'LDR', 'unit': 'Ohms', 'name': 'Light_Level'}, {'description': 'A nitrogen dioxide sensor', 'symbol': 'Ohms', 'value': 32625.0, 'breach': False, 'readingtype': 'sample', 'sensor': 'MiCS-2710', 'unit': 'Ohms', 'name': 'Nitrogen_Dioxide'}, {'description': 'A carbon monoxide sensor', 'symbol': 'Ohms', 'value': 37500.0, 'breach': False, 'readingtype': 'sample', 'sensor': 'MiCS-5525', 'unit': 'Ohms', 'name': 'Carbon_Monoxide'}, {'description': 'A microphone to measure ambient noise', 'symbol': 'mV', 'value': 203.2258064516129, 'breach': False, 'readingtype': 'sample', 'sensor': 'Microphone', 'unit': 'millvolts', 'name': 'Volume'}, {'name': 'Location', 'altitude': -6.6, 'longitude': 12.xxxxx, 'disposition': 'fixed', 'latitude': 55.xxxxx, 'sensor': 'MTK3339', 'exposure': 'indoor'}]

DEBUG:main: Dataset to output to <outputs.xively.Xively object at 0xb591cc10>:
DEBUG:main: [{'description': 'BOSCH combined temperature and pressure sensor.', 'symbol': 'C', 'value': 30.8, 'breach': False, 'readingtype': 'sample', 'sensor': 'BMP085-temp', 'unit': 'Celsius', 'name': 'Temperature-BMP'}, {'description': 'BOSCH combined temperature and pressure sensor.', 'symbol': 'hPa', 'value': 998.676351863236, 'breach': False, 'readingtype': 'sample', 'sensor': 'BMP085-pres', 'unit': 'Hectopascal', 'name': 'Pressure'}, {'description': 'A combined temperature and humidity sensor.', 'symbol': '%', 'value': 23.5, 'breach': False, 'readingtype': 'sample', 'sensor': 'DHT22-hum', 'unit': '% Relative Humidity', 'name': 'Relative_Humidity'}, {'description': 'A combined temperature and humidity sensor.', 'symbol': 'C', 'value': 31.0, 'breach': False, 'readingtype': 'sample', 'sensor': 'DHT22-temp', 'unit': 'Celsius', 'name': 'Temperature-DHT'}, {'description': 'A light dependent resistor', 'symbol': 'Ohms', 'value': 535.5303810504636, 'breach': False, 'readingtype': 'sample', 'sensor': 'LDR', 'unit': 'Ohms', 'name': 'Light_Level'}, {'description': 'A nitrogen dioxide sensor', 'symbol': 'Ohms', 'value': 32625.0, 'breach': False, 'readingtype': 'sample', 'sensor': 'MiCS-2710', 'unit': 'Ohms', 'name': 'Nitrogen_Dioxide'}, {'description': 'A carbon monoxide sensor', 'symbol': 'Ohms', 'value': 37500.0, 'breach': False, 'readingtype': 'sample', 'sensor': 'MiCS-5525', 'unit': 'Ohms', 'name': 'Carbon_Monoxide'}, {'description': 'A microphone to measure ambient noise', 'symbol': 'mV', 'value': 203.2258064516129, 'breach': False, 'readingtype': 'sample', 'sensor': 'Microphone', 'unit': 'millvolts', 'name': 'Volume'}, {'name': 'Location', 'altitude': -6.6, 'longitude': 12.xxxxx, 'disposition': 'fixed', 'latitude': 55.xxxxx, 'sensor': 'MTK3339', 'exposure': 'indoor'}]
_

HTTP Server Errors (Similar to #19)

After tireless hours of running into compatibility issues, I've made it to somewhat of a point where I can take readings from my sensors. But when I try and view the via the built-in HTTP server I run into an error:

Exception happened during processing of request from ('192.168.1.237', 46793) Traceback (most recent call last): File "/usr/lib/python2.7/SocketServer.py", line 290, in _handle_request_nobloc k self.process_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 318, in process_request self.finish_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python2.7/SocketServer.py", line 652, in __init__ self.handle() File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle self.handle_one_request() File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request method() File "/home/pi/AirPi/outputs/http.py", line 323, in do_GET page = replace(page, "$time$", self.server.httpoutput.lastUpdate) AttributeError: 'HTTP' object has no attribute 'lastUpdate'

This occurs when I initially try to load the webpage (which I had previously enabled in~AirPi/cfg/settings.cfg). I haven't the slightest clue as to what I can do so any help would be much appreciated.

HTML output - not all graphs update correctly

Using HTML output - all working fine and showing correct readings/headings, but not all of the graphs seem to update correctly

i.e. AirPi been running 3 hours, top graph for Temperature-BMP is showing full 3 hours in the graph, but most of the others just showing an hour or less and not updating to show full period that AirPi has been sampling

problem with rrdoutput module

Thanks for the project, very very nice work.

Previously I used the csvout it works well. For the past few days I'm trying to use rrdoutput but without success.

There were some issue like problem with lack of calibration module and graph printing section (i throw out it from rrdoutput.py) and I assume it should help. But I got the following error in debug mode.

Loading: OUTPUTS
INFO:__main__:  Config file: /home/pi/AirPi/cfg/outputs.cfg
INFO:__main__:  Success: Successfully imported output module: print
INFO:__main__:  INFO:    Trying to get subclass for print
INFO:__main__:  Success: Successfully got subclasses for print
INFO:__main__:  Starting to set instclass for print
INFO:__main__:  Output plugin params are: {'calibration': True, 'metadata': True, 'target': 'screen', 'limits': False, 'format': 'friendly'}
INFO:__main__:  Success: Successfully set instclass for print
Success: Loaded output plugin Print
INFO:__main__:*******************
INFO:__main__:  Success: Successfully imported output module: rrdoutput
INFO:__main__:  INFO:    Trying to get subclass for rrdoutput
INFO:__main__:  Success: Successfully got subclasses for rrdoutput
INFO:__main__:  Starting to set instclass for rrdoutput
ERROR:   Failed to import plugin RRDOutput: SafeConfigParser instance has no attribute '__getitem__'
INFO:__main__:  ERROR:   Failed to import plugin RRDOutput: SafeConfigParser instance has no attribute '__getitem__'

The installation is clean, sensors are working, tested outputs http, cvs, print works like a charm. Rrdoutput no :/
Rrd file created manually, path is correct and present in config file. Have no idea were cloud be the problem.

version is:

commit fce8f757f9c6b549be7c8e46d69869584de3c69d
Author: Haydn Williams <[email protected]>
Date:   Wed Nov 11 20:53:45 2015 +0000
Change: Update release notes in README.md. Add line re: GPS setup.

Did you met that kind of issue?

Hangs on "INFO: Doing initialising runs for 15 seconds."

When I run airpictl.sh normal the process seems to freeze at "INFO: Doing initialising runs for 15 seconds."

Have left it for several minutes. No change. Won't respond to ctrl+c.

New Raspberry Pi 2. AirPi 1.4 (previously working on an old Pi).

Fresh install of Jessie Lite. Have updated and rebooted.

Full output is:

[AirPi] Starting normal AirPi sampling.
[AirPi] This run will end if you log out.
[AirPi] Press Ctrl + C to stop.
==========================================================
Loading: SETTINGS
Success: Loaded settings.
==========================================================
Loading: SUPPORTS
Success: Loaded support plugin Calibration
==========================================================
Loading: SENSORS
Success: Loaded sensor plugin BMP085-temp
Success: Loaded sensor plugin BMP085-pres
Success: Loaded sensor support plugin MCP3008
Success: Loaded sensor plugin DHT22-hum
Success: Loaded sensor plugin DHT22-temp
Success: Loaded sensor plugin LDR
Success: Loaded sensor plugin TGS2600
Success: Loaded sensor plugin MiCS-2710
Success: Loaded sensor plugin MiCS-5525
Success: Loaded sensor plugin Microphone
==========================================================
Loading: OUTPUTS
Success: Loaded output plugin Print
==========================================================
Loading: NOTIFICATIONS
INFO:    No Notifications enabled.
==========================================================
Loading: METADATA
Run started............10:36 on Monday 02 May 2016
Operator...............Dr. O. Perator
Raspberry Pi name......AirPi
Raspberry Pi ID........00000000xxxxxxxx
Sample frequency.......5 seconds
Initialising runs......15 seconds
==========================================================
Success: Setup complete.
==========================================================
INFO:    Sampling will start in 43 seconds.
INFO:    Sampling will start in 40 seconds.
INFO:    Sampling will start in 30 seconds.
INFO:    Sampling will start in 20 seconds.
INFO:    Sampling will start in 10 seconds.
INFO:    Doing initialising runs for 15 seconds.

Any way to tell what's causing the problem?

Thanks :-)

Averaging function causes "Sample frequency too fast" to display.

Enabling the averaging function can cause the "Sample frequency too fast" warning message to display, even if the sample frequency is not too fast.

Note that the values output by the averaging function are correct; it is only the display of the warning message which is incorrect.

Probably related to issue #10.

Raingauge error

TypeError: buckettip() takes exactly 1 argument (2 given)

GPS Problem

Hey there!
My AirPi works fine but I have got problems with the Adafruit GPS.
I installed gpsd, gpsd-clients and python-gps. With cgps –s I get positive results.
But when I start the AirPi I get the following error:

INFO:    Doing initialising runs for 15 seconds.
DEBUG:__main__: GPS output (nan, nan, nan, 'fixed', 'indoor')
Traceback (most recent call last):
  File "/home/pi/AirPi/airpi.py", line 1388, in <module>
    dummy_runs(SETTINGS['DUMMYDURATION'])
  File "/home/pi/AirPi/airpi.py", line 1011, in dummy_runs
    read_gps(i)
  File "/home/pi/AirPi/airpi.py", line 1067, in read_gps
    reading["name"] = sensorplugin.valname
AttributeError: 'serial_gps' object has no attribute 'valname'

[AirPi] Current installed version and latest change:

commit 6a047b605f3263d4b791363b6df95740050f60a3
Author: Haydn Williams <[email protected]>
Date:   Tue Jul 14 22:22:19 2015 +0000
Change: Partial fix for issue #19, error with HTTP output.

gpsd, gpsd-clients and python-gps:

Version 3.6-4+deb7u1

Thanks for your great help.
Kind regards
Sven

Calibration functions for MICS 2710

Out of all the calibration functions the only one I get to work is:
func_Nitrogen_Dioxide = (0.0014*(x/142686.5672))+0.2857

Any other one and I get this error:
Exception during output: unsupported operand type(s) for ^: 'float' and 'int'

git not installed in install.sh

Hi,
Just use your install procedure on a fresh RPI and I noticed that git is not install by the install.sh while it is required further in the install script.
Maybe an apt-get install git can be inserted in that script ?
Regards.
Alexandre

Calibration and conversion of raw sensor values to real-world units

I was wondering if there were plans to update the calibration code to convert the readings to more human-readable units (ppm, dB, etc.) instead of the raw ohms or millivolts? Mainly for Nitrogen Dioxide, Carbon Monoxide, Volume, etc.?

I was happy to see some of the calibration formulas in /cfg/supports.cfg but they are all commented out and don't seem to convert units. Thanks!

GPS print.py output exception

When trying to print to console via print.py with GPS enabled, there is no GPS output, no '=' delimiter line between readings, and in the airpi.log file I see the following:

2016-09-25 17:01:05,689 - __main__ - DEBUG -  ERROR:   Exception during output: Unknown format code 'f' for object of type 'str'

The breakage seems to have happened In the commit by Haydn Williams on Oct 15, 2014 - Lots of pylint improvements.

This part of the commit in format_output_gps() broke GPS output:

 100       -        return str(prop.ljust(17) + ": " + str("{0:.2f}".format(value)).rjust(10) + " " + unit) 
      147  +        value = str(prop.ljust(17)) + ": "
      148  +        value += str("{0:.2f}".format(value).rjust(10) + " " + unit) 

Note that value is passed in as an argument then immediately overwritten and assigned a value that is a string. When it is then appended to, the attempt to format what is now a string as a float causes the exception.

GPS output works by just changing back with an ljust(18) to match the other outputs:

return str(prop.ljust(18)) + ": " + str("{0:.2f}".format(value).rjust(10) + " " + unit)

No configuration instructions

When I first ran the software, it popped up with this error message:

Error: Check wiring for the TGS2600 measurement, no voltage detected on ADC input 1

Looks like it wasn't correctly configured for my sensors.

What to do about ever-increasing sample frequency?

Sample frequency increases by 0.01 seconds per sample, so at high frequency it will start to deviate after running for some time. Professional-grade scientific gear skips a sample or just resets the clock every 24-hours - do we just mimic that behaviour?

HTTP plots show time in UTC, not in local time

The plots in the HTTP output plugin show the time axis in UTC, not in local time.
Can easily be fixed by correcting for the local timezone offset:
Line 206 in http.py (in recordData function):
Change 't[0] = time.time()' to 't[0] = time.time() - time.timezone'

HTTP Plugin: Several Errors

Hey there! I'm currently setting up my own AirPi and I'm pretty happy about this fork for having done all the things I'd need to implement myself ;) Thank you!

However, trying to use the http plugin results in serveral errors. They appear in the dev and master branches, my current setup is using the dev branch:

[AirPi] Current installed version and latest change:

commit 4c0341dea64ad26e8a3e1acd6758361dd1a4de3d
Author: Haydn Williams <[email protected]>
Date:   Sun May 31 19:38:46 2015 +0000
Change: Add clarification to calibration function comments.

(snip)

My outputs.cfg (for http)

[HTTP]
filename = http
enabled = yes
calibration = on
wwwPath = www ; Must be full path if used with AirPi bootstart feature
port = 8080
history = on
historyFile = history.dat
historySize = 2880
historyInterval = 30
historyCalibrated = false
title = AirPi - <hostname>
about = This is an AirPi pollution / air quality monitoring device.
#target = internet
target = lan

Trying to simply use the http plugin throws the following error:

{'historyCalibrated': False, 'historyFile': 'history.dat', 'about': 'This is an AirPi pollution / air quality monitoring device.', 'historyInterval': '30', 'target': 'lan', 'limits': False, 'calibration': True, 'title': 'AirPi - <hostname>', 'history': True, 'historySize': '2880', 'httpVersion': False, 'wwwPath': 'www', 'port': '8080', 'metadata': False}
done first bit
done second bit
done third bit
starting hostname
starting title et al.
ERROR:   Failed to import plugin HTTP: global name 'calibration' is not defined

I solved that one myself by adding a simple import calibration at the start of the file. With that, the http plugin loads, but trying to access the site gives me the following error:

----------------------------------------
Exception happened during processing of request from ('192.168.2.112', 52948)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__
    self.handle()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
    method()
  File "/home/pi/AirPi/outputs/http.py", line 333, in do_GET
    page = replace(page, "$time$", self.server.httpoutput.lastUpdate)
AttributeError: 'HTTP' object has no attribute 'lastUpdate'
----------------------------------------

This happens no matter if the sampling has actually started or not. I fixed it by replacing self.server.httpoutput.lastUpdate with the current time, but this yields the following error:

----------------------------------------
Exception happened during processing of request from ('192.168.2.112', 52955)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__
    self.handle()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
    method()
  File "/home/pi/AirPi/outputs/http.py", line 336, in do_GET
    for i in self.server.httpoutput.data:
AttributeError: 'HTTP' object has no attribute 'data'
----------------------------------------

I'm assuming that the sample data isn't send to the http output module, but since my understanding of the projects code (and, well, python) is very shallow, I can't fix this on my own. Any ideas?

I'll maybe try an older commit until this is fixed.

Update: Reverting to commit/version 1.0 didn't fix this :/ (it did fix the import however)

error with ubidots plugin

get following error with it enabled:-

Missing config section for plugin Ubidot.
ERROR: Failed to import plugin Ubidots

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.