GreyMatter first steps
I’ve always wanted to automate my house to some degree, even going as far to overpay quite a bit for some Hue bulbs.
Since moving to London, I decided I wanted to revisit this project with gusto and really utilise my investments in soldering irons and breadboards.
Picking my prototype hardware
I went out and got a few Raspberry Pi Zero W boards. These boards offer the standard pins of a Raspberry Pi 3 B+ and wireless connectivity in a small form factor at a reasonable price of approximately 12GBP incl. shipping. While they’re still more expensive than microcontrollers and smaller Arudio boards, the RTOS offers a convenient development environment. They come with enough processor power and an undersized camera port for using as security cameras, or presence recognition devices. It’s worth noting Zeros require a special cable to connect a standard Pi camera.
With that out of the way, I started writing code. I decided that since I had enough Zeros, I could afford to work with a garbage collected language like Golang and a convenient protocol language like gRPC. The Zeros would act as nodes that could collect any data from nearby sensors using whatever data transmission protocol was cheapest, and then report them back over Wifi+gRPC to a central node. Since I have a Raspberry Pi 3 B+ in the lounge, it has slightly more CPU to run tasks and is thus the primary.
I then needed to focus on creating some gRPC services.
A service just to accept registrations from nodes.
- Once registered, the node is given a key. This key must be used in the context for all method calls.
- If this key is missing or does not have a matching node, a gRPC interceptor will respond with an authentication failure and the method will not be called.
- Expose a configuration endpoint, allowing nodes to retrieve their config from the central node
- Version change reporting and automated rebuilding
A service to accept presence data from nodes.
- Looks up the node based on their auth key and records an event in the room the node is in.
- Reports room presence changes to a house system
A service to accept new rules about how the house should interact with itself.
- User configurable light overrides
- Filters can be based on time, presence or globally.
- Apply rules to Home actions
- Currently the rules service is only implemented at the service layer, I’ve not gotten around to actually implementing a client to CRUD the rules.
A really barebones service that provides a map of person identifiers to people, and stores people data when retrieved from somewhere else.