Skip to content

Commit

Permalink
60 local logging (#64)
Browse files Browse the repository at this point in the history
* Ground Work

- Laying the foundation for local network sensor logging.

* Data

- renamed sample json responses folders. One for internal and one for external networks
- using the new 1.1.1a0 version of the purpleair api
-

* Docs and Working version

- added documentation updates. Added some diagrams
- working csv data_logger version :) The beauty is that when one works odds are all loggers work.

* Diagrams

- updated docs in diagrams to make sure they can be generated

* Environmental fields

- adding in Environmental fields to the local sensor logger. Making some assumption which will have to be tested in the field. Basing those assumption off of what the external API provides.

- updated some example external json files

- bumped the version of purpleair_api being used.

* Update PurpleAirDataLogger.py

- copied mapping from PAA.constants
- starting to figure out pm_1..0 stuff.

* Update PurpleAirDataLogger.py

- switch to float math
- added cf and pm1.0

* Formatting, Values

- adding more values
- ran black 23.11

* Update PurpleAirDataLogger.py

- wrapped up as much of the mapping as I could. So far no official post from PurpleAir about web api to local api mapping.

* Update PurpleAirDataLogger.py

black

* Fixes

- starting to run manual testing for the local logger. So far so good.
  • Loading branch information
carlkidcrypto authored Nov 11, 2023
1 parent 63d4c91 commit 9f40675
Show file tree
Hide file tree
Showing 24 changed files with 818 additions and 172 deletions.
9 changes: 9 additions & 0 deletions diagrams/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Diagrams

This directory contains design diagrams.

## Auto Generate UML

```bash
pyreverse -d . -o png ../purpleair_data_logger
```
Binary file added diagrams/classes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added diagrams/packages.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"api_version": "V1.0.11-0.0.49",
"time_stamp": 1695569096,
"data_time_stamp": 1695569064,
"sensor": {
"sensor_index": 163965,
"last_modified": 1664215336,
"date_created": 1663784441,
"last_seen": 1695568955,
"private": 0,
"is_owner": 0,
"name": "carlkidcrypto-purpleair2",
"icon": 0,
"location_type": 1,
"model": "PA-I",
"hardware": "2.0+BME280+PMSX003-A",
"led_brightness": 100,
"firmware_version": "7.02",
"rssi": -75,
"uptime": 69901,
"pa_latency": 943,
"memory": 15944,
"position_rating": 5,
"latitude": 46.74709,
"longitude": -116.998924,
"altitude": 2647,
"channel_state": 1,
"channel_flags": 0,
"channel_flags_manual": 0,
"channel_flags_auto": 0,
"confidence": 30,
"humidity": 31,
"humidity_a": 31,
"temperature": 79,
"temperature_a": 79,
"pressure": 923.43,
"pressure_a": 923.43,
"analog_input": 0.0,
"pm1.0": 2.6,
"pm1.0_a": 2.6,
"pm2.5": 4.4,
"pm2.5_a": 4.4,
"pm2.5_alt": 3.4,
"pm2.5_alt_a": 3.4,
"pm10.0": 4.4,
"pm10.0_a": 4.4,
"scattering_coefficient": 10.4,
"scattering_coefficient_a": 10.4,
"deciviews": 8.1,
"deciviews_a": 8.1,
"visual_range": 173.8,
"visual_range_a": 173.8,
"0.3_um_count": 691,
"0.3_um_count_a": 691,
"0.5_um_count": 178,
"0.5_um_count_a": 178,
"1.0_um_count": 35,
"1.0_um_count_a": 35,
"2.5_um_count": 0,
"2.5_um_count_a": 0,
"5.0_um_count": 0,
"5.0_um_count_a": 0,
"10.0_um_count": 0,
"10.0_um_count_a": 0,
"pm1.0_cf_1": 2.6,
"pm1.0_cf_1_a": 2.61,
"pm1.0_atm": 2.6,
"pm1.0_atm_a": 2.61,
"pm2.5_atm": 4.4,
"pm2.5_atm_a": 4.35,
"pm2.5_cf_1": 4.4,
"pm2.5_cf_1_a": 4.35,
"pm10.0_atm": 4.4,
"pm10.0_atm_a": 4.35,
"pm10.0_cf_1": 4.4,
"pm10.0_cf_1_a": 4.35,
"primary_id_a": 1868567,
"primary_key_a": "3XJ73Z60EX66XSHH",
"primary_id_b": 1868571,
"primary_key_b": "4TZ413W55H4ZCXMB",
"secondary_id_a": 1868569,
"secondary_key_a": "H8X58IEXEOBAPMQY",
"secondary_id_b": 1868573,
"secondary_key_b": "TWNBKVZZDWFMWSPV",
"stats": {
"pm2.5": 4.4,
"pm2.5_10minute": 4.2,
"pm2.5_30minute": 4.2,
"pm2.5_60minute": 4.1,
"pm2.5_6hour": 4.2,
"pm2.5_24hour": 2.5,
"pm2.5_1week": 3.5,
"time_stamp": 1695568955
},
"stats_a": {
"pm2.5": 4.4,
"pm2.5_10minute": 4.2,
"pm2.5_30minute": 4.2,
"pm2.5_60minute": 4.1,
"pm2.5_6hour": 4.2,
"pm2.5_24hour": 2.5,
"pm2.5_1week": 3.5,
"time_stamp": 1695568955
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
{
"api_version": "V1.0.11-0.0.49",
"time_stamp": 1695569392,
"data_time_stamp": 1695569365,
"sensor": {
"sensor_index": 123456,
"last_modified": 1656033161,
"date_created": 1653666655,
"last_seen": 1695569319,
"private": 0,
"is_owner": 0,
"name": "A NAME GOES HERE",
"icon": 0,
"location_type": 0,
"model": "PA-II-FLEX",
"hardware": "3.0+OPENLOG+31037 MB+DS3231+BME280+BME68X+PMSX003-A+PMSX003-B",
"led_brightness": 100,
"firmware_version": "7.04",
"rssi": -62,
"uptime": 137,
"pa_latency": 732,
"memory": 5672,
"position_rating": 5,
"latitude": 123.123,
"longitude": -123.123,
"altitude": 123,
"channel_state": 3,
"channel_flags": 0,
"channel_flags_manual": 0,
"channel_flags_auto": 0,
"confidence": 100,
"confidence_auto": 100,
"confidence_manual": 100,
"humidity": 46,
"humidity_a": 44,
"humidity_b": 49,
"temperature": 63,
"temperature_a": 64,
"temperature_b": 62,
"pressure": 924.6,
"pressure_a": 925.33,
"pressure_b": 923.87,
"voc": 598.9,
"voc_b": 598.89,
"analog_input": 0.06,
"pm1.0": 23.7,
"pm1.0_a": 23.3,
"pm1.0_b": 24.0,
"pm2.5": 34.7,
"pm2.5_a": 35.0,
"pm2.5_b": 34.5,
"pm2.5_alt": 22.1,
"pm2.5_alt_a": 23.2,
"pm2.5_alt_b": 21.1,
"pm10.0": 44.4,
"pm10.0_a": 46.7,
"pm10.0_b": 42.0,
"scattering_coefficient": 70.1,
"scattering_coefficient_a": 70.1,
"scattering_coefficient_b": 70.1,
"deciviews": 22.4,
"deciviews_a": 22.4,
"deciviews_b": 22.4,
"visual_range": 41.5,
"visual_range_a": 41.5,
"visual_range_b": 41.4,
"0.3_um_count": 4671,
"0.3_um_count_a": 4671,
"0.3_um_count_b": 4672,
"0.5_um_count": 1330,
"0.5_um_count_a": 1330,
"0.5_um_count_b": 1330,
"1.0_um_count": 230,
"1.0_um_count_a": 253,
"1.0_um_count_b": 208,
"2.5_um_count": 21,
"2.5_um_count_a": 25,
"2.5_um_count_b": 18,
"5.0_um_count": 9,
"5.0_um_count_a": 11,
"5.0_um_count_b": 7,
"10.0_um_count": 4,
"10.0_um_count_a": 9,
"10.0_um_count_b": 0,
"pm1.0_cf_1": 27.0,
"pm1.0_cf_1_a": 26.48,
"pm1.0_cf_1_b": 27.53,
"pm1.0_atm": 23.7,
"pm1.0_atm_a": 23.34,
"pm1.0_atm_b": 23.98,
"pm2.5_atm": 34.7,
"pm2.5_atm_a": 34.95,
"pm2.5_atm_b": 34.46,
"pm2.5_cf_1": 38.1,
"pm2.5_cf_1_a": 38.61,
"pm2.5_cf_1_b": 37.56,
"pm10.0_atm": 44.4,
"pm10.0_atm_a": 46.68,
"pm10.0_atm_b": 42.05,
"pm10.0_cf_1": 45.2,
"pm10.0_cf_1_a": 48.2,
"pm10.0_cf_1_b": 42.2,
"primary_id_a": 1750199,
"primary_key_a": "M9M66UHOIS8YIAGH",
"primary_id_b": 1750201,
"primary_key_b": "D9M2N0ZO81PTA210",
"secondary_id_a": 1750200,
"secondary_key_a": "O4T8GWNDUROR5EP6",
"secondary_id_b": 1750202,
"secondary_key_b": "2YTJ6VA9HS3T8K07",
"stats": {
"pm2.5": 34.7,
"pm2.5_10minute": 31.6,
"pm2.5_30minute": 32.2,
"pm2.5_60minute": 32.5,
"pm2.5_6hour": 22.2,
"pm2.5_24hour": 13.6,
"pm2.5_1week": 9.9,
"time_stamp": 1695569319
},
"stats_a": {
"pm2.5": 35.0,
"pm2.5_10minute": 32.0,
"pm2.5_30minute": 32.5,
"pm2.5_60minute": 32.8,
"pm2.5_6hour": 22.3,
"pm2.5_24hour": 13.6,
"pm2.5_1week": 9.8,
"time_stamp": 1695569319
},
"stats_b": {
"pm2.5": 34.5,
"pm2.5_10minute": 31.3,
"pm2.5_30minute": 31.8,
"pm2.5_60minute": 32.2,
"pm2.5_6hour": 22.1,
"pm2.5_24hour": 13.5,
"pm2.5_1week": 9.9,
"time_stamp": 1695569319
}
}
}
4 changes: 4 additions & 0 deletions external_network_hardware_variant_json_samples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# External Network Hardware Variant Json Samples

This directory contains responses from different devices (hardware variants) that
are publical accessible via the Purpleair API.
Loading

0 comments on commit 9f40675

Please sign in to comment.