100 days of code - day 9
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.
Previous Days
- 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 -
Makefile
to test, build, push multiple docker containers to Github registry
Day 9
Today I did a pretty large refactor of the communication method between the various docker containers. There was no reason why I should be writing to file each change, so I made the publisher
container run a flask endpoint, where I can send node updates. This required quite a bit more work than I expected, but in the end I ended up with a much simpler design. Things seemed to have stabilized a bit more. I’m going to run the sensor for a while and see how it does.
After getting that re-factor completed, I also started mocking up the HM3301 sensor code. It’s a little complicated because it requires creating a software GPIO based i2c interface, since the hardware interface needs to be clocked down to support the HM3301 - which would be bad for the rest of the sensors on the i2c bus. I need to re-build my test sensor to have the HM3301 wired up on different GPIO, since it’s currently on the main i2c bus.
I’ve been putting some thought into simplifying the individual containers, by making app.py
more or less copy/paste and then importing the right libraries to operate the sensors. For some things, it’ll require me to write an interim layer, but it should make things a bit cleaner. I will think on this a bit more.