ericklein / air_quality

displays and logs local indoor and outdoor weather and air quality information
MIT License
0 stars 0 forks source link

Added support for reporting device info via dweet.io #38

Closed disquisitioner closed 2 years ago

disquisitioner commented 2 years ago

Added optional support for posting info via dweet.io, as follows: ) added a configuration #define DWEET in config.h to enable/disable dweeting ) added a utility function, post_dweet(), to compose a JSON payload using sensor values passed in as arguments, and then submit the HTTP POST ) added necessary #defines to config.h to set the target dweet host (dweet.io) and a default device name (makerhour-airquality), but allow them to be easily customized ) modified actionSequence() to call post_dweet() if #DWEET is defined *) made sure to use debugMessage() for all Serial output so #DEBUG is properly respected

Devices post via dweet their sensor readings as well as IP address and RSSI of most recent WiFi communications (the later two are helpful in debugging)

Users can see the device's dweeted info at https://dweet.io/get/latest/dweet/for/makerhour-airquality (or replace makerhour-airquality with the name specified by #DWEET_DEVICE). Dweet.io is free, does not require an account, and does not use API keys for access (or data retrieval), thanks to the benevolent wizardry of folks at BugLabs.

I tested with my device over the course of a day to confirm proper operation.

While at it I moved the #include of "secrets.h" up to the top of the main sketch immediately after the #include of "config.h" to make sure that anything defined in secrets.h had maximum opportunity to be included in additional #defines or conditional compilation in the main sketch, and added debugMessage() calls to echo out key configuration values if operating in #DEBUG mode.

All changes are in branch 'dweet'.