From cd534c4d0bfd1aed5e83513bd84f0bf0bcc87aae Mon Sep 17 00:00:00 2001 From: MrSossidge Date: Mon, 18 May 2026 14:39:07 +0100 Subject: [PATCH] Add HA dashboard, configuration template and update README --- README.md | 39 ++++++++++++- configuration_template.yaml | 32 ++++++++++ dashboard.yaml | 113 ++++++++++++++++++++++++++++++++++++ 3 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 configuration_template.yaml create mode 100644 dashboard.yaml diff --git a/README.md b/README.md index 09f1b51..66216e2 100644 --- a/README.md +++ b/README.md @@ -193,4 +193,41 @@ Managed automatically by PlatformIO: ## Licence -MIT \ No newline at end of file +MIT + +--- + +## Home Assistant Dashboard + +A ready-made dashboard card is included in `home-assistant/dashboard.yaml`. + +Requires these HACS frontend plugins: +- [Mushroom](https://github.com/piitaya/lovelace-mushroom) +- [Mini Graph Card](https://github.com/kalkih/mini-graph-card) + +To use: **Dashboard → Edit → Add Card → Manual** and paste the contents. + +## Template Sensors + +Optional calculated sensors are in `home-assistant/configuration_template.yaml`: + +- **Garage Net Battery Power** — battery current × voltage in watts (positive = charging) +- **Garage Battery Status** — Charging / Discharging / Idle text sensor + +Add the `template:` block to your `configuration.yaml` and reload YAML. + +## Project Structure + +``` +├── home-assistant/ +│ ├── dashboard.yaml # Ready-made HA dashboard card +│ └── configuration_template.yaml # Optional template sensors +├── include/ +│ ├── config.h # Your config (excluded from git) +│ ├── example.config.h # Template — copy to config.h +│ └── victron_ble.h # BLE parser header +├── src/ +│ ├── main.cpp # Main firmware +│ └── victron_ble.cpp # AES decryption and parser +└── platformio.ini # PlatformIO build config +``` diff --git a/configuration_template.yaml b/configuration_template.yaml new file mode 100644 index 0000000..2e7f75d --- /dev/null +++ b/configuration_template.yaml @@ -0,0 +1,32 @@ +# ───────────────────────────────────────────────────────────── +# Victron SmartSolar MPPT — Home Assistant configuration.yaml +# +# Add the template section below to your configuration.yaml +# to create calculated sensors from the MPPT data. +# +# The MQTT sensors are created automatically via discovery — +# no manual MQTT config needed. +# ───────────────────────────────────────────────────────────── + +template: + - sensor: + # Net power in/out of battery (positive = charging, negative = discharging) + - name: "Garage Net Battery Power" + unit_of_measurement: "W" + device_class: power + state_class: measurement + state: > + {{ (states('sensor.victron_smartsolar_mppt_battery_current') | float * + states('sensor.victron_smartsolar_mppt_battery_voltage') | float) | round(1) }} + + # Simple charging status text + - name: "Garage Battery Status" + state: > + {% set current = states('sensor.victron_smartsolar_mppt_battery_current') | float %} + {% if current > 0.1 %} + Charging + {% elif current < -0.1 %} + Discharging + {% else %} + Idle + {% endif %} diff --git a/dashboard.yaml b/dashboard.yaml new file mode 100644 index 0000000..fcc19a3 --- /dev/null +++ b/dashboard.yaml @@ -0,0 +1,113 @@ +# ───────────────────────────────────────────────────────────── +# Victron SmartSolar MPPT — Home Assistant Dashboard +# +# Requires: +# - custom:mushroom-entity-card (HACS → Mushroom) +# - custom:mushroom-title-card (HACS → Mushroom) +# - custom:mini-graph-card (HACS → Mini Graph Card) +# +# To use: Dashboard → Edit → Add Card → Manual → paste this YAML +# ───────────────────────────────────────────────────────────── + +type: vertical-stack +cards: + - type: custom:mushroom-title-card + title: ⚡ Garage Solar + subtitle: Victron MPPT Monitor + + - type: custom:mushroom-title-card + title: Power Overview + subtitle: Solar generation and battery status + - type: horizontal-stack + cards: + - type: custom:mushroom-entity-card + entity: sensor.victron_smartsolar_mppt_pv_power + name: Solar In + icon: mdi:solar-power + primary_info: name + secondary_info: state + - type: custom:mushroom-entity-card + entity: sensor.garage_net_battery_power + name: Net Battery + icon: mdi:battery-charging + primary_info: name + secondary_info: state + - type: custom:mushroom-entity-card + entity: sensor.garage_battery_status + name: Status + icon: mdi:battery + primary_info: name + secondary_info: state + + - type: custom:mini-graph-card + entities: + - entity: sensor.victron_smartsolar_mppt_pv_power + name: Solar + color: '#f5a623' + - entity: sensor.victron_smartsolar_mppt_external_load_power + name: Load + color: '#e74c3c' + - entity: sensor.victron_smartsolar_mppt_battery_voltage + name: Battery V + y_axis: secondary + color: '#2ecc71' + name: Power History (24h) + hours_to_show: 24 + points_per_hour: 6 + line_width: 2 + fill: fade + show: + labels: true + points: false + legend: true + + - type: horizontal-stack + cards: + - type: custom:mushroom-entity-card + entity: sensor.victron_smartsolar_mppt_battery_voltage + name: Voltage + icon: mdi:lightning-bolt + primary_info: name + secondary_info: state + - type: custom:mushroom-entity-card + entity: sensor.victron_smartsolar_mppt_battery_current + name: Current + icon: mdi:current-dc + primary_info: name + secondary_info: state + - type: custom:mushroom-entity-card + entity: sensor.victron_smartsolar_mppt_yield_today + name: Yield Today + icon: mdi:weather-sunny + primary_info: name + secondary_info: state + + - type: horizontal-stack + cards: + - type: custom:mushroom-entity-card + entity: sensor.victron_smartsolar_mppt_external_load + name: Load Current + icon: mdi:current-ac + primary_info: name + secondary_info: state + - type: custom:mushroom-entity-card + entity: sensor.victron_smartsolar_mppt_external_load_power + name: Load Power + icon: mdi:lightning-bolt + primary_info: name + secondary_info: state + + - type: horizontal-stack + cards: + - type: custom:mushroom-entity-card + entity: sensor.victron_smartsolar_mppt_charge_state + name: Charge State + icon: mdi:ev-station + primary_info: name + secondary_info: state + - type: custom:mushroom-entity-card + entity: sensor.victron_smartsolar_mppt_error_code + name: Error Code + icon: mdi:alert-circle + primary_info: name + secondary_info: state