-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b1c2fb
commit 594d6cf
Showing
5 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
interval: | ||
- interval: 2.5min | ||
# Send data to AirGradient API server | ||
then: | ||
if: | ||
condition: | ||
switch.is_on: upload_airgradient | ||
then: | ||
- http_request.post: | ||
# http://api.airgradient.com/public/docs/api/v1/ | ||
# AirGradient URL with the last 6 of MAC address all lower case | ||
url: !lambda |- | ||
return "http://hw.airgradient.com/sensors/airgradient:" + get_mac_address().substr(6,11) + "/measures"; | ||
headers: | ||
Content-Type: application/json | ||
json: | ||
wifi: !lambda return to_string(id(wifi_dbm).state); | ||
rco2: !lambda return to_string(id(co2).state); | ||
pm01: !lambda return to_string(id(pm_1_0).state); | ||
pm02: !lambda return to_string(id(pm_2_5).state); | ||
pm10: !lambda return to_string(id(pm_10_0).state); | ||
pm003Count: !lambda return to_string(id(pm_0_3um).state); | ||
atmp: !lambda return to_string(id(temp_raw).state); | ||
atmpCompensated: !lambda return to_string(id(temp).state); | ||
rhum: !lambda return to_string(id(humidity_raw).state); | ||
rhumCompensated: !lambda return to_string(id(humidity).state); | ||
tvocIndex: !lambda return to_string(id(voc).state); | ||
noxIndex: !lambda return to_string(id(nox).state); | ||
# Uptime in minutes as the boot value | ||
boot: !lambda return to_string(round(id(device_uptime).state/60)); | ||
|
||
switch: | ||
- platform: template | ||
name: "Upload to AirGradient Dashboard" | ||
id: upload_airgradient | ||
restore_mode: RESTORE_DEFAULT_OFF | ||
optimistic: True | ||
|
||
esphome: | ||
on_boot: | ||
priority: 200 # Network connections setup | ||
then: | ||
if: | ||
condition: | ||
switch.is_on: upload_airgradient | ||
then: | ||
- http_request.post: | ||
# Return wifi signal -50 as soon as device boots to show activity on AirGradient Dashboard site | ||
# Using -50 instead of actual value as the wifi_signal sensor has not reported a value at this point in boot process | ||
url: !lambda |- | ||
return "http://hw.airgradient.com/sensors/airgradient:" + get_mac_address().substr(6,11) + "/measures"; | ||
headers: | ||
Content-Type: application/json | ||
json: | ||
wifi: !lambda return to_string(-50); | ||
|
||
http_request: | ||
timeout: 1s # Setting short to try to prevent watchdog reboots http://github.com/esphome/issues/issues/2853 | ||
# Used to support POST request to send data to AirGradient | ||
# http://esphome.io/components/http_request.html | ||
verify_ssl: false # Must be explicityly set to false when using Arduino framework |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
substitutions: | ||
config_version: 4.0.4 | ||
config_version: 4.0.5 | ||
|
||
esphome: | ||
name: "${name}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
substitutions: | ||
config_version: 4.0.3 | ||
config_version: 4.0.5 | ||
|
||
esphome: | ||
name: "${name}" | ||
|