Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop to Master #93

Merged
merged 62 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
a220079
fix: firmware model name `FW_MODE_I_1PSL` -> `FW_MODE_I_9PSL`
pnt325 Mar 29, 2024
378688d
add `GET/ PUT from local server on monitor`
pnt325 Mar 30, 2024
dc875dd
Ignore call to LED Bar in OpenAir
pnt325 Mar 31, 2024
adce439
Ignore update `locallyControlled` if configuration from server
pnt325 Mar 31, 2024
5e20b9e
Changed defaults
Mar 31, 2024
9055bbb
add comment
pnt325 Mar 31, 2024
260e904
Merge branch 'develop' of https://github.com/airgradienthq/arduino in…
pnt325 Mar 31, 2024
3788aa2
change `locallyControlled` to `configurationControl` and update relat…
pnt325 Apr 1, 2024
7d68b02
Remove example `ONE.ino` and `OpenAir.ino`
pnt325 Apr 1, 2024
954a775
fix issue: multiple define `UseLedBar`
pnt325 Apr 1, 2024
f52eab8
[temporary commit]
pnt325 Apr 3, 2024
8e03292
[temporary commit]
pnt325 Apr 3, 2024
c1ab99b
[temporary commit]
pnt325 Apr 3, 2024
027ffea
[temporary commit]
pnt325 Apr 3, 2024
dba385f
[temporary commit]
pnt325 Apr 4, 2024
f681d4b
add `WiFiManager` and 'U8g2` to `Libraries`
pnt325 Apr 4, 2024
dfba4fa
[temporary commit]
pnt325 Apr 4, 2024
9a03fb2
added comments to code
Apr 5, 2024
4577082
clarifying method/variable/class names
pnt325 Apr 7, 2024
5b271f4
Remove `WiFiManager` from `Build Instructions`
pnt325 Apr 7, 2024
51ff8f8
fix: WiFi reconnect on ESP8266
pnt325 Apr 7, 2024
cb7a6a2
fix: Local Configuration
pnt325 Apr 8, 2024
b219521
Update: SHT read failed
pnt325 Apr 8, 2024
c28a937
Add postDataToAirGradient checkbox to WiFi Manager
pnt325 Apr 10, 2024
bd11979
Remove text before checkbox `Post to AirGradient`
pnt325 Apr 10, 2024
1d6a0a0
Move `Arduino_JSON` to `AirGradient` libries
pnt325 Apr 11, 2024
86c6095
update: WiFiConnector `Post To AirGradient` default checked and add e…
pnt325 Apr 11, 2024
9a1e0f4
Merge branch 'develop' of https://github.com/airgradienthq/arduino in…
pnt325 Apr 11, 2024
2ccddf0
Update: Post to Airgradient on WiFiConnector content
pnt325 Apr 12, 2024
25ef1ce
Remove correction Temperature and Humidity for PMS5003T
pnt325 Apr 12, 2024
e111565
add `atmp_compensated` and `rhum_compensated` to sync data
pnt325 Apr 13, 2024
09cbbed
fix typo
pnt325 Apr 13, 2024
ccee987
add firmware mode `O-1P`
pnt325 Apr 13, 2024
6e1ac26
update handle `noxLearningOffset` and `tvocLearningOffset` configuration
pnt325 Apr 14, 2024
5f15e29
fix configuration `pmStandard` value
pnt325 Apr 14, 2024
8adca3a
Update `pmStandard` JSON stringtify value
pnt325 Apr 14, 2024
cb4ae82
Update properties JSON `Snake Case` to `Camel Case`
pnt325 Apr 14, 2024
5534a2c
Added documentation
Apr 19, 2024
563fc06
add platformio configuration
pnt325 Apr 20, 2024
4063536
Merge branch 'develop' of https://github.com/airgradienthq/arduino in…
pnt325 Apr 20, 2024
a2b30a5
ignore `compensated` value send to AG server. And udpate JSON properties
pnt325 Apr 20, 2024
71b45fc
[platformio] update configuration
pnt325 Apr 20, 2024
e61cd9b
Update OpenMetrics with compensated values
pnt325 Apr 20, 2024
302bec9
Added documentation
Apr 21, 2024
556a6fb
update mqtt publish data is locally
pnt325 Apr 21, 2024
8980255
update `CO2CalibrationAbcDays`
pnt325 Apr 21, 2024
a91f6c1
Added documentation for Open Metrics
Apr 21, 2024
d5fc35d
Add _compensated to log output
pnt325 Apr 21, 2024
2b891c0
Merge branch 'develop' of https://github.com/airgradienthq/arduino in…
pnt325 Apr 21, 2024
7561017
update log message and fix `ledBarTestRequested`, `co2CalibrationRequ…
pnt325 Apr 21, 2024
2d96fc2
fix `postDataToAirGradient` set `false` after device power up and con…
pnt325 Apr 22, 2024
b91a305
Move common function to separate file
pnt325 Apr 22, 2024
21d984c
add get nox/tvoc learning offset
pnt325 Apr 22, 2024
9feac03
update message log and fix some bug
pnt325 Apr 22, 2024
442f0fd
[update message log and fix some bug] add miss
pnt325 Apr 22, 2024
5275f5a
compile git version into firmware
nick-4711 Apr 22, 2024
12f03af
ota handler added, wip
nick-4711 Apr 22, 2024
e12a154
ota handling code added, wip
nick-4711 Apr 22, 2024
1c8d7b0
ota handling implemented
nick-4711 Apr 24, 2024
6d7750d
Merge branch 'develop' of https://github.com/airgradienthq/arduino in…
nick-4711 Apr 24, 2024
a3cbca6
Merge branch 'master' into develop
nick-4711 Apr 24, 2024
5078b35
moved fallback GIT_VERSION to AirGradient.h
nick-4711 Apr 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ jobs:
matrix:
example:
- "BASIC"
- "ONE"
- "Open_Air"
- "TestCO2"
- "TestPM"
- "TestSht"
Expand All @@ -25,10 +23,6 @@ jobs:
exclude:
- example: "BASIC"
fqbn: "esp32:esp32:esp32c3"
- example: "ONE"
fqbn: "esp8266:esp8266:d1_mini"
- example: "Open_Air"
fqbn: "esp8266:esp8266:d1_mini"
- example: "OneOpenAir"
fqbn: "esp8266:esp8266:d1_mini"
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.DS_Store
build
.vscode
/.idea/
.pio
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ If you have an older version of the AirGradient PCB not mentioned in the example

If you have any questions or problems, check out [our forum](https://forum.airgradient.com/).

## Documentation

Local server API documentation is available in [/docs/local-server.md](/docs/local-server.md) and AirGradient server API on [https://api.airgradient.com/public/docs/api/v1/](https://api.airgradient.com/public/docs/api/v1/).

## The following libraries have been integrated into this library for ease of use

- [Adafruit BusIO](https://github.com/adafruit/Adafruit_BusIO)
Expand All @@ -35,6 +39,8 @@ If you have any questions or problems, check out [our forum](https://forum.airgr
- [Sensirion Core](https://github.com/Sensirion/arduino-core/)
- [Sensirion I2C SGP41](https://github.com/Sensirion/arduino-i2c-sgp41)
- [Sensirion I2C SHT](https://github.com/Sensirion/arduino-sht)
- [WiFiManager](https://github.com/tzapu/WiFiManager)
- [Arduino_JSON](https://github.com/arduino-libraries/Arduino_JSON)

## License
CC BY-SA 4.0 Attribution-ShareAlike 4.0 International License
105 changes: 105 additions & 0 deletions docs/local-server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
## Local Server API

From [firmware version 3.0.10](firmwares) onwards, the AirGradient ONE and Open Air monitors have below API available.

#### Discovery

The monitors run a mDNS discovery. So within the same network, the monitor can be accessed through:

http://airgradient_{{serialnumber}}.local


The following requests are possible:

#### Get Current Air Quality (GET)

With the path "/measures/current" you can get the current air quality data.

http://airgradient_ecda3b1eaaaf.local/measures/current

“ecda3b1eaaaf” being the serial number of your monitor

You get the following response:
~~~
{"wifi":-46,
"serialno":"ecda3b1eaaaf",
"rco2":447,
"pm01":3,
"pm02":7,
"pm10":8,
"pm003Count":442,
"atmp":25.87,
"rhum":43,
"tvocIndex":100,
"tvoc_raw":33051,
"noxIndex":1,
"nox_raw":16307,
"boot":6,
"ledMode":"pm",
"firmwareVersion":"3.0.10beta",
"fwMode":"I-9PSL"}
~~~

|Properties|Type|Explanation|
|-|-|-|
|serialno|String| Serial Number of the monitor|
|wifi|Number| WiFi signal strength|
|pm01, pm02, pm10|Number| PM1, PM2.5 and PM10 in ug/m3|
|rco2|Number| CO2 in ppm|
|pm003Count|Number| Particle count per dL|
|atmp|Number| Temperature in Degrees Celcius|
|rhum|Number| Relative Humidity|
|tvocIndex|Number| Senisiron VOC Index|
|tvoc_raw|Number| VOC raw value|
|noxIndex|Number| Senisirion NOx Index|
|nox_raw|Number| NOx raw value|
|boot|Number| Counts every measurement cycle. Low boot counts indicate restarts.|
|ledMode|String| Current configuration of the LED mode|
|firmwareVersion|String| Current firmware version|
|fwMode|String| Current model name|

#### Get Configuration Parameters (GET)
With the path "/config" you can get the current configuration.
~~~
{"country":"US",
"pmStandard":"ugm3",
"ledBarMode":"pm",
"displayMode":"on",
"abcDays":30,
"tvocLearningOffset":12,
"noxLearningOffset":12,
"mqttBrokerUrl":"",
"temperatureUnit":"f",
"configurationControl":"both",
"postDataToAirGradient":true}
~~~

#### Set Configuration Parameters (PUT)

Configuration parameters can be changed with a put request to the monitor, e.g.

Example to force CO2 calibration

```curl -X PUT -H "Content-Type: application/json" -d '{"co2CalibrationRequested":true}' http://airgradient_84fce612eff4.local/config ```

Example to set monitor to Celcius

```curl -X PUT -H "Content-Type: application/json" -d '{"temperatureUnit":"c"}' http://airgradient_84fce612eff4.local/config ```

#### Avoiding Conflicts with Configuration on AirGradient Server
If the monitor is setup on the AirGradient dashboard, it will also receive configurations from there. In case you do not want this, please set "configurationControl" to local. In case you set it to cloud and want to change it to local, you need to make a factory reset.

#### Configuration Parameters (GET/PUT)

|Properties|Type|Accepted Values|Example|
|-|-|-|-|
|country|String| Country code as [ALPHA-2 notation](https://www.iban.com/country-codes) | {"country": "TH"}|
|pmStandard|String|ugm3 : ug/m3 <br> usaqi: USAQI | {"pmStandard": "ugm3"}|
|ledBarMode|String|co2: LED bar displays CO2 <br> pm: LED bar displays PM <br> off: Turn off LED bar | {"ledBarMode": "off"}|
|abcDays|Number|Number of days for CO2 automatic baseline balibration. Maximum 200 days. Default 8 days. | {"abcDays": 8}|
|mqttBrokerUrl|String|MQTT broker URL. | {"mqttBrokerUrl":"mqtt://192.168.0.18:1883"} |
|temperatureUnit|String|c or C: Degree Celsius °C <br>f or F: Degree Fahrenheit °F | {"temperatureUnit": "c"}|
|configurationControl|String|both : Accept local and cloud configuration <br>local : Accept only local configuration <br>cloud : Accept only cloud configuration | {"configurationControl": "both"}|
|postDataToAirGradient|Boolean|Send data to AirGradient cloud: <br>true : Enabled <br>false: Disabled | {"postDataToAirGradient": true}|
|co2CalibrationRequested|Boolean|Trigger CO2 calibration (400ppm) on monitor:<br>true : Calibration will be triggered | {"co2CalibrationRequested": true}|
|ledBarTestRequested|Boolean|Test LED bar:<br> true : LEDs will run test sequence | {"ledBarTestRequested": true}|
Loading