Most ridiculous way to do something with Home Assistant events and learning something new at the same time.
  • PHP 41.5%
  • Java 33.8%
  • Go 14.9%
  • Dockerfile 4.4%
  • Python 3.5%
  • Other 1.9%
2025-05-31 16:55:52 +02:00
doc Initial commit 2025-04-21 15:00:35 +02:00
ha_config Initial commit 2025-04-21 15:00:35 +02:00
havent-infra Add Quarkus Kafka checkpoints and deduplication using Valkey (Redis) 2025-05-01 12:05:07 +02:00
havent-json-receiver Add Syft sboms 2025-05-31 16:55:52 +02:00
havent-processor Add Syft sboms 2025-05-31 16:55:52 +02:00
havent-proto Add Quarkus Kafka checkpoints and deduplication using Valkey (Redis) 2025-05-01 12:05:07 +02:00
havent-viewer Add Syft sboms 2025-05-31 16:55:52 +02:00
.gitattributes Initial commit 2025-04-21 15:00:35 +02:00
.gitignore Initial commit 2025-04-21 15:00:35 +02:00
docker-compose.yml Add Quarkus Kafka checkpoints and deduplication using Valkey (Redis) 2025-05-01 12:05:07 +02:00
LICENSE Initial commit 2025-04-21 15:00:35 +02:00
README.md Add Quarkus Kafka checkpoints and deduplication using Valkey (Redis) 2025-05-01 12:05:07 +02:00
shell.nix Add Quarkus Kafka checkpoints and deduplication using Valkey (Redis) 2025-05-01 12:05:07 +02:00

havent

Havent allows you to visualize all the events that are fired in Home Assistant.

Havent screenshot

The goal of this project was for me to learn new things, it is not meant to be production ready or to be used for longer periods of time.

Modules

The project consists of multiple modules (micro-services if you want to use corporate-speech):

  • ha_config/custom_components/http_event_forwarder: Home Assistant custom component which sends events as JSON to an endpoint
  • havent-json-receiver: Go REST server which receivers the JSON events from Home Assistants and converts them to protobuf before putting them on a Kafka topic
  • havent-processor/store-raw-events: Java 21 Quarkus native application which stores the raw events into the database
  • havent-processor/store-event: Java 21 Quarkus native application which stores the events in a more usable format for the front-end
  • havent-viewer: PHP application to visualize the events

Building

Protobuf image

The first thing that needs to be done is building the protobuf image which contains the spec file. This is necessary because the spec file lives outside the projects and is normally symlinked into the projects for development purposes, but the actual file is not accessible outside of the docker build context.

cd havent-proto
podman build . -t havent-proto:latest

Build time on an i7-8650U: 2s

JSON receiver

A simple docker build should be sufficient.

cd havent-json-receiver
podman build . -t havent-json-receiver

Build time (including pull) on an i7-8650U: 2m10s

Processor

There are 2 processors built in Java which need to be compiled into native images. They can be built using the following commands:

cd havent-processor
podman build . --build-arg PROJECT=store-event -t havent-store-event
podman build . --build-arg PROJECT=store-raw-events -t havent-store-raw-events

Build time (including pull) on an i7-8650U: 14m

Viewer

A simple docker build should be sufficient.

cd havent-viewer
podman build . -t havent-viewer

Build time (including pull) on an i7-8650U: 45s

Running

JSON exporter

The JSON exporter will be responsible for capturing each event in Home Assistant and forward it to the havent-json-receiver.

To install the custom component in Home Assistant, create a folder custom_components inside your configuration directory (if it does not exist yet). Copy the folder ha_config/custom_components/http_event_forwarder in this folder so you end up with CONFIG_FOLDER/custom_components/http_event_forwarder/__init__.py.

Add the forwarder in your Home Assistant configuration.yaml using the below snippet:

http_event_forwarder:
  endpoint: "http://receiver:8080/event"

Make sure to update the endpoint to where you will be running the JSON receiver. A restart of Home Assistant is required.

Simple docker compose

Included in the root of the project is a docker compose file which should get everything up and running, including a basic Home Assistant instance. The credentials for the HA test instance are test/test.

Important: The example docker-compose.yaml in the root of this project does not persist anything. Once you run podman compose down or reboot, all data will be lost.

The following ports are mapped:

  • 8080: havent-json-receiver
  • 8123: the Home Assistant instance
  • 8081: havent-viewer
  • 9080: adminer (previously known as phpMyAdmin)
  • 9081: kafka-ui

FAQ

Nobody ever asked me anything so I'll let my imagination ask myself some questions.

Why ?

I've been a Java developer for 10 years who somehow rolled into a CloudOps engineer role. While I do like my job, I sometimes miss developing software. So I came up with this project and decided to use stuff I've never used before. So for me this was a first time (in a long time) that I used:

  • Go
  • Quarkus
  • GraalVM
  • Gradle
  • Protobuf
  • MariaDB
  • Lighttpd
  • PHP
  • MetroUI
  • ChartJS
  • Podman
  • Valkey

Does it run on ARM ?

I've never tested the project on ARM devices. While it may run, compiling everything on a Rasperry Pi might take an incredibly long time. The whole configuration is write heavy so under no circumstances should it run on an SD-card or eMMC storage.

Why OpenSuse docker images ?

Because I can. No really, pretty much every docker image I've used previously is either Debian, Red Hat or Alpine based. Using something new is everything this project is about.

Did you vibe code this ?

No I did not. I coded most things myself, though I did ask a lot of questions to Mistral to help me figure things out. The Home Assistant custom component is pretty much 100% AI written tough, I didn't feel like learning the Home Assistant API's for this project.

Why didn't you use npm for the viewer ?

There's a limit to how much suffering I want to endure for a learning experience.