Day 1: Neutron

So now we’re really cooking. It’s been a very productive day, where I built a management API in Flask to manage all the Neutrinos, create them in the Neutron CouchDB, create a dedicated InfluxDB token for them in the default organization, and a few other goodies.

I also created routes to help me manage customers and the Neutrinos assigned to them.

The CouchDB neutrinos table will be expanded to store information about the Neutrinos including: location_name, customer, token, sensors, creation_date, assigned_date, etc. The creation_date will be important because there are a few sensors that need to be replaced as they age, so I will have some scripts that run and alert me of any Neutrinos that need attention.

Tomorrow (or maybe later tonight) I need to build the logic to manage creating buckets for customers as they are added, then managing the token based access to the buckets as Neutrinos are assigned to the customer. I will need to be able to assign a bucket to a token as well as revoke access to a bucket when a Neutrino is re-assigned.

The Neutrinos should check in every 5 minutes or so to ensure that they are writing data to the proper bucket. Also, InfluxDB has the ability to batch consume “points”, so maybe instead of sending data to the InfluxDB server at each reading, I batch them and send every 30 seconds or so. If I do that, then I can check for bucket assignment before pushing a batch. Unsure….

Also, I’m considering moving away from UUIDs for the _id of the Neutrinos and coming up with a more friendly way to refer to them. I really like docker container naming schemes, maybe I’ll use that.

There’s definitely some more work to do, but we’re getting there! The best thing is, the project is starting to take shape and I should be able to get a few Neutrinos built in the next couple of weeks.