Skip to content

TWilkin/powerpi

Repository files navigation

PowerPi

Home automation microservice stack communicating via MQTT (using mosquitto) built with Typescript, Python, Go and NodeMCU C deployable with Kubernetes on a Raspberry Pi cluster.

This project was devised to utilise open, reverse engineered or free home automation hardware and software together without the need for third-party hubs, cloud services or subscriptions wherever possible.

Supported IoT Hardware

Supported Services

Getting Started

The project is split into the following services, each of which have their own README describing the configuration interface they support as well as how to modify and test them.

  • api - API
  • config-server - Retrieve configuration files from GitHub.
  • controllers:
  • energy-monitor - Retrieve electricity and gas consumption in 30-minute blocks from UK smart meter submissions via N3rgy.
  • event - Allows custom actions to be taken when events appear in the message queue.
  • freedns - Overcome changing public IP addresses of consumer ISPs by pointing a free hostname at the current public IP via FreeDNS
  • persistence - Service for writing all the messages that appear in the MQTT message queue to a database.
  • scheduler - Schedule based control of light devices, e.g. brightness, colour, temperature etc.
  • ui - NGINX hosting the UI.
  • voice-assistant - Integration with Amazon Alexa skill to receive voice commands.

The project includes a shutdown service which allows a computer to be remotely shutdown by message queue events generated by PowerPi.

The project also includes sensor NodeMCU code in the sensors directory which can be used to generate events when motion is detected, or temperature/humidity readings at an interval.

Building

The latest image for each service can be found on Docker Hub, if you've made local changes (or want to try out a service locally) you can build it from scratch with the following instructions.

The images can be built with Docker's buildx tool which supports cross-compilation of images, allowing us to build ARM images for deployment on a Raspberry Pi on an x86_64 architecture. Although, if you're not using Energenie and therefore don't need the Pi module you can build and run the stack on other architectures supported by the base images.

# From the root of your checkout of PowerPi
# Build an image with buildx, the image version tags can be found in the service's package.json or pyproject.toml file.
docker buildx build --platform linux/arm/v7 --push -t MY_DOCKER_REGISTRY/powerpi-config-server:1.0.0 -f services/config-server/Dockerfile .

# Or for 64-bit ARM
docker buildx build --platform linux/arm64 --push -t MY_DOCKER_REGISTRY/powerpi-config-server:1.0.0 -f services/config-server/Dockerfile .

# Or x86-64
docker buildx build --platform linux/amd64 --push -t MY_DOCKER_REGISTRY/powerpi-config-server:1.0.0 -f services/config-server/Dockerfile .

Deployment

Deploying the services is simply a matter of deploying the stack using Kubernetes, which will pull the latest images from Docker Hub.

The instructions for deploying the stack using Kubernetes can be found as follows:

Authors

  • Tom Wilkin - Most of what you see - TWilkin
  • Paul Sandwell - Testing, feedback and some excellent ideas - peasandwell
  • Camila Neyra - Some excellent ideas, specifically floorplans, and putting up with my incessant home automation talk.

See also the list of contributors who participated in this project.

License

This project is licensed under the GPL 3.0 License - see the LICENSE file for details