I’ve done a few rounds of 100 Days of Code in the past, but never really made it past 2 weeks. Part of the reason for that failure is the weekend portion - I don’t like to computer on the weekend since I computer very hard during the week.
I decided it would be a really good use of my time to work on my Indoor Air Quality platform as a part of my attempt at 100 Days of Code. It’s the next step for me in my career, so I need a way to force my effort.
There are two parts to making my IAQ platform successful, the sensors themselves, and the backend system.
- Day 1 - Getting the infrastructure setup for development
- Day 2 - Getting basic data out of Temp/Hum sensor, figuring out scope for others
- Day 3 - Publish data to InfluxDB
- Day 4 - Handled some errors in the publisher, got CouchDB up adn running
- Day 5 - Slack bot alerts!
- Day 6 - Health Checks babay!
- Day 7 - Ansible and other things for a friend’s project
- Vacation - I’m on vacation so haven’t been coding much
- Day 8 -
Makefileto test, build, push multiple docker containers to Github registry
- Day 9 - Large refactor to use Flask API instead of reading results from files.
Yesterday was a big change to the code, but introduced a bug where only
temperature_c would be written to InfluxDB. As you can see in the image above, neither graph was updating because they weren’t receiving new data. If I would have had a Celsius chart, I probably would have found the error sooner.
To solve the issue, first I got logging properly sorted for Flask, including allow you to set the level in a variable. In the future, I’d like to set this as an environment varible in
Once I did that, I was able to find that the
for loop that parsed and published each point of data from the
return at the end of the
for statement, causing the whole loop to end. It was pretty simple from there to move the return statement outside of the
for loop, causing it to return only when each point in the
payload has been processed.
Overall, I’d label today’s coding session as a success.