Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
312 changes: 149 additions & 163 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,201 +2,187 @@

<img src="docs/images/favicon.png" alt="Energy Node icon" width="100" align="right">

**Energy monitoring and automation for a remote site. It runs on a
Raspberry Pi 1 and works with or without Home Assistant.**
**Solar, batteries and loads in any building, watched and automated by a small
box that keeps running on its own. Next door or at a remote site, connected to
Home Assistant or standing alone.**

[![Release](https://img.shields.io/github/v/release/Developer-Simon/energy-node?include_prereleases&label=release)](https://github.com/Developer-Simon/energy-node/releases)
[![CI](https://github.com/Developer-Simon/energy-node/actions/workflows/ci.yml/badge.svg)](https://github.com/Developer-Simon/energy-node/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

**[Documentation](https://developer-simon.github.io/energy-node/)** ·
**[Download](https://github.com/Developer-Simon/energy-node/releases)** ·
**[What's new](https://developer-simon.github.io/energy-node/whats-new.html)**

![Energy Node dashboard](docs/images/dashboard.png)

## What it is

Some solar arrays, batteries and switchable loads sit at a workshop, barn,
garage or second property. Those sites are often too far away, or sit behind
too flaky a link, for the Home Assistant at home to poll their devices
directly.

Energy Node puts one small Linux box at that site and makes it a
self-contained node. It polls the local devices without any cloud account, runs
its own automation rules and serves its own web dashboard. If the internet or
the VPN goes down, the node carries on as before.

If you use Home Assistant, a Mosquitto bridge over Tailscale mirrors the node's
devices to your main site. There they appear as ordinary MQTT Discovery
entities: PV production, battery state of charge, load power, grid
import/export. Without Home Assistant, the dashboard works on its own.

## Highlights

- **Live overview**: energy flow, self-sufficiency ring, balance and cards you
can arrange in a layout editor. You can pin favourite entities and give each
device its own icon.
- **History in the browser**: charts are recorded in IndexedDB, so the Pi
stores nothing. You can export them as CSV or JSON.
- **Automations**: a rule engine with conditions, hysteresis, hold times and
cooldowns, edited in the dashboard. It runs as its own process, separate from
the dashboard.
- **Configuration from the UI**: every device service is set up through a form
in the dashboard, including Tuya and Tailscale setup wizards.
- **Energy roles and device map**: you tell the node which measurement is PV,
battery, load or grid, and a map you arrange by hand records how the site is
wired.
- **Desktop installer**: sets up a fresh Pi, updates an existing node or
diagnoses and repairs one, from Windows, macOS or Linux.
- **Updates from the dashboard**: a notice appears when a new release is out.
The dashboard downloads the signed package and redeploys the node without SSH.
- **Home Assistant, two ways**: devices arrive through MQTT Discovery, and three
HACS integrations bring dashboard features into HA directly.
- **Built for weak hardware**: the dashboard is a Go program that needs no
runtime or database on the node, so it starts fast and leaves most of the
RAM to the services. Charts are drawn in your browser and nothing loads from
a CDN, so the node also works without internet. The Raspberry Pi 1 (ARMv6,
single core, 512 MB RAM) is the floor every design decision is measured
against.
## Why Energy Node

Energy Node is for any building with solar panels, a battery bank or loads
worth switching, whether that is a home, an office, a workshop, a farm or a
commercial site. A Raspberry Pi in the building reads your devices, shows them
in one dashboard and runs your automations on the spot.

Its main use case is the **remote site**: a workshop, barn or second property
whose energy you want in the Home Assistant at home, but which is too far away
or behind too shaky a connection to be run from there. The node does the work
on site and mirrors every device to your Home Assistant over a Tailscale
tunnel. If the link drops, the site keeps running. Energy Node runs just as
well standalone at your main site, with or without Home Assistant next to it.

- The node keeps measuring, switching and serving its dashboard when the
internet or the VPN is down.
- You need no cloud account. Every device is read on the local network.
- A Raspberry Pi 1 is enough, because that is what it is built for. Any newer
Pi or a small x86 box has room to spare.
- Your devices show up in Home Assistant automatically, from the same building
or from a remote site, and the dashboard can sit in the Home Assistant
sidebar.

## What you get

### Your energy at a glance

The overview shows live energy flow, self-sufficiency and battery state on
cards you arrange the way you like, on desktop and phone.
[Overview](https://developer-simon.github.io/energy-node/dashboard/overview.html) ·
[Statistics](https://developer-simon.github.io/energy-node/dashboard/statistics.html) ·
[History](https://developer-simon.github.io/energy-node/dashboard/history.html)

### How your site is wired

Draw how your devices are wired, follow the energy from panel to plug and see
where it gets lost along the way.
[Device map](https://developer-simon.github.io/energy-node/dashboard/device-map.html) ·
[Efficiency](https://developer-simon.github.io/energy-node/dashboard/efficiency.html) ·
[Energy roles](https://developer-simon.github.io/energy-node/dashboard/energy.html)

### Automations without code

Start from a template, build a scenario for a whole situation or write a single
rule, all in the dashboard. The node checks your rules, suggests new ones from
your habits and learns how your site behaves over the seasons.
[Automations](https://developer-simon.github.io/energy-node/dashboard/automations.html) ·
[What the node learns](https://developer-simon.github.io/energy-node/dashboard/automations-what-is-learned.html)

### Notices when something is off

Monitoring collects notices about the energy balance, broken measurements and
the surplus forecast in one place, each with recommended next steps.
[Monitoring](https://developer-simon.github.io/energy-node/dashboard/monitoring.html)

### Setup and upkeep without a terminal

A desktop installer for Windows, macOS and Linux prepares the SD card and sets
up the node. After that, a guided tour, settings forms, backups and updates all
live in the dashboard.
[Installer](https://developer-simon.github.io/energy-node/installer.html) ·
[Onboarding](https://developer-simon.github.io/energy-node/dashboard/onboarding.html) ·
[Settings](https://developer-simon.github.io/energy-node/dashboard/settings.html)

### Users and permissions

Other people get their own account with the rights they need. A view-only guest
access and sign-in through Home Assistant are built in.
[Users](https://developer-simon.github.io/energy-node/dashboard/settings-users.html)

<table>
<tr>
<td width="50%"><img src="docs/images/dashboard-history.png" alt="History view"><br><sub><b>History</b>: charted in the browser, exportable</sub></td>
<td width="50%"><img src="docs/images/dashboard-automation.png" alt="Automation editor"><br><sub><b>Automations</b>: rules edited in the dashboard</sub></td>
<td width="50%"><img src="docs/images/dashboard-automation-scenarios.png" alt="Automation scenarios"><br><sub><b>Automations</b>: scenarios, templates and rules</sub></td>
<td width="50%"><img src="docs/images/dashboard-monitoring.png" alt="Monitoring"><br><sub><b>Monitoring</b>: notices, forecast and learned values</sub></td>
</tr>
<tr>
<td width="50%"><img src="docs/images/dashboard-device-map.png" alt="Device map"><br><sub><b>Device map</b>: how the devices are connected</sub></td>
<td width="50%"><img src="docs/images/installer-configure.png" alt="Installer configuration screen"><br><sub><b>Installer</b>: pick the services for a new node</sub></td>
<td width="50%"><img src="docs/images/dashboard-device-map.png" alt="Device map"><br><sub><b>Device map</b>: how your site is wired</sub></td>
<td width="50%"><img src="docs/images/installer-configure.png" alt="Installer"><br><sub><b>Installer</b>: pick the services for a new node</sub></td>
</tr>
</table>

Every page of the dashboard, including all settings tabs and the four colour
schemes, has a screenshot in [**the dashboard, page by page**](https://developer-simon.github.io/energy-node/dashboard/).
The screenshots come from a local smoke test against a fixture broker, so you
can reproduce them without a Pi.
[The dashboard, page by page](https://developer-simon.github.io/energy-node/dashboard/)
has a screenshot of every screen.

## Supported devices

All devices are polled locally, and none of them needs a cloud account.

| Hardware | How | Direction |
|---|---|---|
| **Shelly** Gen1 and Gen2+ (switches, meters, 3-phase, H&T, ADC) | HTTP `/status` / `/rpc` | read + switch |
| **APsystems EZ1** microinverters | local REST API | read + power limit, on/off |
| **Lumentree** inverters with a **Trucki stick** (T2SG/T2MG/T2HG) | HTTP | read-only |
| **Tuya** devices | local protocol via `tinytuya` | read + switch |
| **LiFePO4 battery banks** | computed from other devices (coulomb counting) | state of charge |
| **The node itself** | CPU, RAM, disk, throttling, Mosquitto/Tailscale status, pending updates | read |

Each family is one small Python service. [Device services](https://developer-simon.github.io/energy-node/services/)
covers what each one publishes. A new device family is added as another
service; [CONTRIBUTING.md](CONTRIBUTING.md#new-device-services) explains how.

## How it fits together

```mermaid
flowchart LR
subgraph Remote["Remote site: Raspberry Pi 1 (ARMv6)"]
DEV["Shelly · Tuya · APsystems EZ1<br/>Trucki stick · LiFePO4 banks"]
BR["Python bridges<br/>(one systemd service each)"]
MQ{{"Mosquitto<br/>localhost:1883"}}
AUT["Automation service"]
DASH["Go dashboard<br/>:8080 / Caddy :443"]
DEV --> BR --> MQ
MQ <--> AUT
MQ --> DASH
end

MQ <-->|"outstation/# over Tailscale (optional)"| HA

subgraph Main["Main site"]
HA["Home Assistant<br/>+ Mosquitto"]
end
```

- **Local autonomy.** The broker, services, automations and dashboard all run
on the node. The link to the main site is optional.
- **One broker, one narrow link.** Everything on the node talks through a
single local MQTT broker, and no service calls another over HTTP. Only one
topic tree, `outstation/#`, crosses the Tailscale tunnel. That means no port
forwarding and no exposed broker.
- **Cheap hardware is the point.** A side building usually gets a spare Pi 1
or a Pi Zero W. That is why there is no SQLite, no server-side history and no
plugin system. Any newer Pi has room to spare.

| Component | Language | Role |
|---|---|---|
| [`dashboard/`](dashboard/) | Go | Web UI, `/api/v1` HTTP API, config editor, automation editor, updater. Also reports the node itself to Home Assistant. |
| [`services/`](services/) | Python | One bridge per device family, plus the automation engine and battery state of charge. |
| [`libs/`](libs/) | Python | Code shared by the services: MQTT, Discovery, scheduling, and the battery SoC engine. |
| [`installer/`](installer/) | Go | Desktop installer for setting up, updating and diagnosing a node. |
| [`integrations/homeassistant/`](integrations/homeassistant/) | Python | Native Home Assistant integrations, shipped through HACS. |
| Hardware | What Energy Node does with it |
|---|---|
| Shelly switches and meters, Gen1 and Gen2+ | read and switch |
| APsystems EZ1 microinverters | read, set the power limit, switch on and off |
| Lumentree inverters with a Trucki stick | read |
| Tuya devices | read and switch |
| LiFePO4 battery banks | state of charge, computed from your other devices |

Details for each device are in
[Device services](https://developer-simon.github.io/energy-node/services/).
Support for further device families is welcome, see
[CONTRIBUTING.md](CONTRIBUTING.md#new-device-services).

## Getting started

**With the installer (recommended).** Download the installer for your
computer from the [latest release](https://github.com/Developer-Simon/energy-node/releases).
Point it at a Raspberry Pi with SSH enabled, choose your services and let it
run. It fetches the right installation package for the Pi itself.
[Deploying a node](https://developer-simon.github.io/energy-node/installer.html) walks through every screen.

**By hand.** [Manual installation](https://developer-simon.github.io/energy-node/developing/manual-installation.html) describes every step the
installer automates, including the ARMv6 quirks: packages that have to be
installed in an old version first (Tailscale), and the pip flags a current
Raspberry Pi OS needs.

## Home Assistant integrations

With the MQTT bridge, every device already shows up in Home Assistant. Three
HACS integrations add dashboard features that run inside HA directly:

- [**`ha-battery-soc`**](https://developer-simon.github.io/energy-node/ha/battery-soc.html):
LiFePO4 state of charge. It uses the same coulomb-counting engine as the
node, set up through a config flow.
- [**`ha-energy-node-icons`**](https://developer-simon.github.io/energy-node/ha/icons.html):
the dashboard's device icons as an icon set for Home Assistant's icon pickers.
- [**`ha-energy-node-companion`**](https://developer-simon.github.io/energy-node/ha/companion.html):
fills gaps in the dashboard's browser history from the Home Assistant
recorder.
1. Download the installer for your computer from the
[latest release](https://github.com/Developer-Simon/energy-node/releases).
2. Let it prepare an SD card, or point it at a Raspberry Pi you already have.
3. Pick your devices and open the dashboard. A short tour shows you around.

All three are published from [`integrations/homeassistant/`](integrations/homeassistant/)
in this repository.
[Deploying a node](https://developer-simon.github.io/energy-node/installer.html)
walks through every screen. To set up a node by hand, follow
[manual installation](https://developer-simon.github.io/energy-node/developing/manual-installation.html).

## Documentation
## Home Assistant

The [documentation site](https://developer-simon.github.io/energy-node/) collects all pages. These are the
main entry points:
Connect the node to your Home Assistant and all devices appear there as
ordinary entities. A node at a remote site connects over a Tailscale tunnel, so
you need no port forwarding. Three integrations from HACS add more:

- [The dashboard, page by page](https://developer-simon.github.io/energy-node/dashboard/): every screen with a screenshot
- [Deploying a node](https://developer-simon.github.io/energy-node/installer.html): the installer, screen by screen
- [Device services](https://developer-simon.github.io/energy-node/services/): what each service talks to and publishes
- [Data flow](https://developer-simon.github.io/energy-node/developing/data-flow.html) and [configuration](https://developer-simon.github.io/energy-node/operating/configuration.html) reference
- [Performance on the Pi 1](https://developer-simon.github.io/energy-node/operating/performance.html): measured CPU and RAM per service
- [Releasing](https://developer-simon.github.io/energy-node/developing/releasing.html): how versions and releases are cut
- [Energy Node Companion](https://developer-simon.github.io/energy-node/ha/companion.html):
the dashboard in the Home Assistant sidebar, with history filled in from the
recorder.
- [Battery SoC](https://developer-simon.github.io/energy-node/ha/battery-soc.html):
the node's battery state of charge, running directly in Home Assistant.
- [Energy Node Icons](https://developer-simon.github.io/energy-node/ha/icons.html):
the dashboard's device icons for Home Assistant's icon pickers.

## Platforms

The Raspberry Pi 1 (ARMv6, single core, 512 MB RAM) is the floor every design
decision is measured against. The dashboard is a single Go binary without a
runtime or database, charts are drawn in your browser and nothing loads from a
CDN, so the node also works without internet.

| Node hardware | Package |
|---|---|
| Raspberry Pi 1, Zero, Zero W, 2 (32-bit Raspberry Pi OS) | `armv6` |
| Raspberry Pi Zero 2 W, 3, 4, 5 (64-bit Raspberry Pi OS) | `arm64` |
| x86 64-bit mini PCs and thin clients (Debian 13) | `amd64` |

The installer runs on Windows, macOS and Linux. Tested models and the right
image for each are listed under
[operating system](https://developer-simon.github.io/energy-node/installer-operating-system.html),
measured CPU and RAM per service under
[resources on a Pi 1](https://developer-simon.github.io/energy-node/operating/performance.html).

## Status
## Documentation

Everything else is on the
[documentation site](https://developer-simon.github.io/energy-node/): how the
parts fit together, the configuration and API reference and troubleshooting.

Energy Node is **in beta**. Everything described here runs every day on a
real node, but there is no 1.0 release yet. Until then, configuration formats
and screens can still change between 0.x versions, and the changelogs say when
they do.
## Status

The **dashboard speaks German and English.** Each browser picks its language
from the `DE | EN` switch in the header or from its own language setting.
This README and the documentation are in English.
Energy Node is in beta. It runs every day on a real site, but there is no 1.0
yet, so settings and screens can still change between versions. The
[release notes](https://developer-simon.github.io/energy-node/whats-new.html)
say when they do.

## Contributing
The dashboard speaks German and English. The documentation is in English.

Bug reports, fixes and support for new device families are welcome. Before
you start, see [CONTRIBUTING.md](CONTRIBUTING.md). It covers the development
setup, the test suites and the commit conventions.
Energy Node started at a single workshop with its own solar array and battery
bank. The goal is a tool that runs in any building with solar, a battery or
switchable loads, without touching the code.

## Background
## Contributing

Energy Node started with a single site: a workshop at a separate address with
its own solar array, battery bank and switchable loads. That is where it still
runs today, so some defaults still reflect that setup. The goal is a general
tool that anyone with a remote energy site can run without changing the code.
The project works towards that by moving configuration out of the code and
adding device support as new services, not forks.
Bug reports, fixes and new device families are welcome. Start with
[CONTRIBUTING.md](CONTRIBUTING.md).

## License

MIT, see [LICENSE](LICENSE).
MIT, see [LICENSE](LICENSE).
Loading
Loading