add controls to lvx
This commit is contained in:
106
LVX6048/homeassistant/README.md
Normal file
106
LVX6048/homeassistant/README.md
Normal file
@@ -0,0 +1,106 @@
|
||||
# HA-side configuration for the LVX6048 stack
|
||||
|
||||
Reference configs that go into your Home Assistant instance — they aren't
|
||||
installed by `install.sh` (HA typically lives on a different host or in an
|
||||
HA OS appliance), but they're tracked here so the full stack is reproducible.
|
||||
|
||||
Mirrors the `eg4battery/homeassistant/` pattern.
|
||||
|
||||
## What's in here
|
||||
|
||||
| File | Where it goes in HA |
|
||||
|----------------------------|--------------------------------------------------------------|
|
||||
| `mqtt_controls.yaml` | `configuration.yaml` → `mqtt: !include lvx6048/mqtt_controls.yaml` (or merge by hand) |
|
||||
| `lovelace_controls.yaml` | Raw Lovelace card config — paste into a new dashboard view |
|
||||
|
||||
The auto-discovery sensors (battery V, fault code, mode, MPPT power, …)
|
||||
arrive automatically from powermon — no HA-side config required for those.
|
||||
This folder only adds the pieces HA can't infer:
|
||||
|
||||
- **Control entities** — selects + numbers that publish to
|
||||
`solar/control/lvx6048/<action>` so users can change settings from a
|
||||
dashboard without touching the LCD.
|
||||
- **A dashboard view** that wraps those controls with the existing
|
||||
telemetry into one screen.
|
||||
|
||||
## Architecture (control path)
|
||||
|
||||
```
|
||||
HA dashboard (mqtt select / number)
|
||||
│
|
||||
│ payload e.g. "solar_battery_utility"
|
||||
▼
|
||||
solar/control/lvx6048/<action>
|
||||
│
|
||||
▼
|
||||
lvx-control.service (on the Pi)
|
||||
│ validates against allow-list,
|
||||
│ encodes to PI18 command (e.g. "POP01"),
|
||||
│ mirrors to BOTH inverters
|
||||
▼
|
||||
powermon/lvx6048_{1,2}/addcommand
|
||||
│
|
||||
▼
|
||||
powermon executes via PI18 setter, publishes
|
||||
"Succeeded" / "Failed" to powermon/lvx6048_{1,2}/result
|
||||
```
|
||||
|
||||
## Enabling in HA
|
||||
|
||||
1. Drop both YAMLs into `~/homeassistant/lvx6048/` on your HA host.
|
||||
2. Add to `configuration.yaml`:
|
||||
|
||||
```yaml
|
||||
mqtt: !include lvx6048/mqtt_controls.yaml
|
||||
```
|
||||
|
||||
(or, if you already have an `mqtt:` block, merge the `select:` and
|
||||
`number:` lists into it.)
|
||||
|
||||
3. Restart HA. The 3× selects and 1× number entity should appear under
|
||||
the "Home Assistant" device.
|
||||
|
||||
4. Add the dashboard:
|
||||
- **Settings → Dashboards → + Add Dashboard → New dashboard from scratch**
|
||||
- Open the new dashboard → ⋮ → **Edit dashboard → Raw configuration editor**
|
||||
- Paste the contents of `lovelace_controls.yaml`.
|
||||
|
||||
## Available controls
|
||||
|
||||
| Entity | Effect |
|
||||
|-------------------------------------------------|--------------------------------------------------------------------|
|
||||
| `select.lvx6048_output_priority` | POP — switch between SUB / SBU output source priority |
|
||||
| `select.lvx6048_charger_priority` | PCP — solar-first / solar+utility / solar-only charging |
|
||||
| `select.lvx6048_solar_power_priority` | PSP — battery+load+utility+AC vs load+battery+utility |
|
||||
| `number.lvx6048_max_charging_current` | MCHGC — combined solar+AC charge cap, 10–80 A in 10 A steps |
|
||||
| `select.lvx6048_max_utility_charging_current` | MUCHGC — grid-only charge cap, 2/10/20/…/80 A |
|
||||
|
||||
> **Note:** `MCHGC` / `MUCHGC` setters are sometimes rejected by the
|
||||
> firmware while the inverter is actively charging (mode 06). Result topics
|
||||
> show `"Failed"` in that case. If a charge-current change must apply
|
||||
> immediately, either retry while idle (mode 01) or use
|
||||
> `lvx-flash/flash.py apply` (which stops powermon for exclusive USB access).
|
||||
|
||||
Risky settings — battery thresholds (PSDV / MCHGV / BUCD), battery type
|
||||
(PBT), output mode (POPM), factory reset (PF) — are intentionally **not**
|
||||
exposed via HA. Use `lvx-flash/flash.py apply` with an explicit profile.
|
||||
|
||||
## Verifying
|
||||
|
||||
After HA reload, watch the result topics:
|
||||
|
||||
```bash
|
||||
mosquitto_sub -h <broker> -u mqtt -P <pass> -v \
|
||||
-t 'powermon/lvx6048_1/result' \
|
||||
-t 'powermon/lvx6048_2/result'
|
||||
```
|
||||
|
||||
…then flip a select in the dashboard. Both inverters should publish
|
||||
`"Succeeded"` within ~1 s.
|
||||
|
||||
## Energy / SoC dashboard wiring (optional)
|
||||
|
||||
Once both inverters' `ac_output_active_power` and the EG4 daemon's
|
||||
`pack_power` derived sensors are in place, the Energy dashboard can show
|
||||
solar in / battery in/out / load — wire under
|
||||
**Settings → Dashboards → Energy → Solar panels / Home battery storage**.
|
||||
85
LVX6048/homeassistant/lovelace_controls.yaml
Normal file
85
LVX6048/homeassistant/lovelace_controls.yaml
Normal file
@@ -0,0 +1,85 @@
|
||||
# Lovelace dashboard for LVX6048 controls + key telemetry.
|
||||
# Paste into a dashboard view's raw-config editor, or save as a YAML-mode
|
||||
# dashboard. Assumes mqtt_controls.yaml is loaded so the control entities
|
||||
# (select.lvx6048_*, number.lvx6048_*) exist.
|
||||
|
||||
views:
|
||||
- title: Inverters
|
||||
icon: mdi:flash
|
||||
path: inverters
|
||||
cards:
|
||||
# ---- summary header ----
|
||||
- type: horizontal-stack
|
||||
cards:
|
||||
- type: entity
|
||||
name: Bank V (master)
|
||||
entity: sensor.lvx6048_2_battery_voltage
|
||||
icon: mdi:battery-outline
|
||||
- type: entity
|
||||
name: SoC (open-loop)
|
||||
entity: sensor.lvx6048_1_battery_capacity
|
||||
icon: mdi:battery
|
||||
- type: entity
|
||||
name: Mode (master)
|
||||
entity: sensor.lvx6048_2_device_mode
|
||||
icon: mdi:state-machine
|
||||
|
||||
# ---- output / charger control ----
|
||||
- type: entities
|
||||
title: Output priorities
|
||||
show_header_toggle: false
|
||||
entities:
|
||||
- entity: select.lvx6048_output_priority
|
||||
name: Output source priority
|
||||
- entity: select.lvx6048_charger_priority
|
||||
name: Charger source priority
|
||||
- entity: select.lvx6048_solar_power_priority
|
||||
name: Solar power priority
|
||||
|
||||
# ---- charge-current control ----
|
||||
- type: entities
|
||||
title: Charge current limits
|
||||
show_header_toggle: false
|
||||
entities:
|
||||
- entity: number.lvx6048_max_charging_current
|
||||
name: Combined (solar + AC)
|
||||
- entity: select.lvx6048_max_utility_charging_current
|
||||
name: Grid only
|
||||
|
||||
# ---- live power flow ----
|
||||
- type: history-graph
|
||||
title: Power flow (last 12 h)
|
||||
hours_to_show: 12
|
||||
entities:
|
||||
- entity: sensor.lvx6048_1_mppt1_input_power
|
||||
name: Unit 1 PV
|
||||
- entity: sensor.lvx6048_2_mppt1_input_power
|
||||
name: Unit 2 PV
|
||||
- entity: sensor.lvx6048_1_battery_charging_current
|
||||
name: Unit 1 charge A
|
||||
- entity: sensor.lvx6048_2_battery_charging_current
|
||||
name: Unit 2 charge A
|
||||
- entity: sensor.lvx6048_1_ac_output_active_power
|
||||
name: Unit 1 AC out
|
||||
|
||||
# ---- per-unit health ----
|
||||
- type: glance
|
||||
title: Per-unit health
|
||||
columns: 4
|
||||
entities:
|
||||
- entity: sensor.lvx6048_1_fault_code
|
||||
name: U1 fault
|
||||
- entity: sensor.lvx6048_1_parallel_instance_number
|
||||
name: U1 role
|
||||
- entity: sensor.lvx6048_2_fault_code
|
||||
name: U2 fault
|
||||
- entity: sensor.lvx6048_2_parallel_instance_number
|
||||
name: U2 role
|
||||
- entity: sensor.lvx6048_1_inverter_heat_sink_temperature
|
||||
name: U1 temp
|
||||
- entity: sensor.lvx6048_2_inverter_heat_sink_temperature
|
||||
name: U2 temp
|
||||
- entity: sensor.lvx6048_1_battery_charging_current
|
||||
name: U1 chg A
|
||||
- entity: sensor.lvx6048_2_battery_charging_current
|
||||
name: U2 chg A
|
||||
81
LVX6048/homeassistant/mqtt_controls.yaml
Normal file
81
LVX6048/homeassistant/mqtt_controls.yaml
Normal file
@@ -0,0 +1,81 @@
|
||||
# LVX6048 control entities (HA → lvx-control bridge → both inverters).
|
||||
#
|
||||
# Each entity publishes a friendly value to solar/control/lvx6048/<action>;
|
||||
# lvx-control validates, encodes to PI18, and mirrors to both inverters'
|
||||
# powermon adhoc topics. State is read from the existing PIRI auto-discovery
|
||||
# entities (unit-1 only — both units stay in lock-step thanks to the mirror).
|
||||
#
|
||||
# Drop into ~/homeassistant/lvx6048/mqtt_controls.yaml and reference from
|
||||
# configuration.yaml, e.g.:
|
||||
#
|
||||
# mqtt: !include lvx6048/mqtt_controls.yaml
|
||||
#
|
||||
# (or merge into your existing top-level `mqtt:` block by hand).
|
||||
|
||||
select:
|
||||
- name: "LVX6048 output priority"
|
||||
unique_id: lvx6048_output_priority_control
|
||||
icon: mdi:transmission-tower-export
|
||||
command_topic: solar/control/lvx6048/output_priority
|
||||
options:
|
||||
- solar_utility_battery
|
||||
- solar_battery_utility
|
||||
state_topic: homeassistant/sensor/lvx6048_1_output_source_priority/state
|
||||
value_template: >-
|
||||
{% set m = {
|
||||
'Solar - Utility - Battery': 'solar_utility_battery',
|
||||
'Solar - Battery - Utility': 'solar_battery_utility'
|
||||
} %}
|
||||
{{ m.get(value, none) }}
|
||||
|
||||
- name: "LVX6048 charger priority"
|
||||
unique_id: lvx6048_charger_priority_control
|
||||
icon: mdi:battery-charging
|
||||
command_topic: solar/control/lvx6048/charger_priority
|
||||
options:
|
||||
- solar_first
|
||||
- solar_and_utility
|
||||
- solar_only
|
||||
state_topic: homeassistant/sensor/lvx6048_1_charger_source_priority/state
|
||||
value_template: >-
|
||||
{% set m = {
|
||||
'Solar First': 'solar_first',
|
||||
'Solar + Utility': 'solar_and_utility',
|
||||
'Only solar charging permitted': 'solar_only'
|
||||
} %}
|
||||
{{ m.get(value, none) }}
|
||||
|
||||
- name: "LVX6048 solar power priority"
|
||||
unique_id: lvx6048_solar_power_priority_control
|
||||
icon: mdi:solar-power-variant
|
||||
command_topic: solar/control/lvx6048/solar_power_priority
|
||||
options:
|
||||
- battery_load_utility_ac
|
||||
- load_battery_utility
|
||||
state_topic: homeassistant/sensor/lvx6048_1_solar_power_priority/state
|
||||
value_template: >-
|
||||
{% set m = {
|
||||
'Battery-Load-Utiliy + AC Charger': 'battery_load_utility_ac',
|
||||
'Load-Battery-Utiliy': 'load_battery_utility'
|
||||
} %}
|
||||
{{ m.get(value, none) }}
|
||||
|
||||
- name: "LVX6048 max utility charging current"
|
||||
unique_id: lvx6048_max_utility_charging_current_control
|
||||
icon: mdi:transmission-tower
|
||||
command_topic: solar/control/lvx6048/max_utility_charging_current
|
||||
options: ['2', '10', '20', '30', '40', '50', '60', '70', '80']
|
||||
state_topic: homeassistant/sensor/lvx6048_1_max_ac_charging_current/state
|
||||
# State publishes raw integer (no unit suffix); options are strings to match.
|
||||
|
||||
number:
|
||||
- name: "LVX6048 max charging current"
|
||||
unique_id: lvx6048_max_charging_current_control
|
||||
icon: mdi:current-dc
|
||||
command_topic: solar/control/lvx6048/max_charging_current
|
||||
state_topic: homeassistant/sensor/lvx6048_1_max_charging_current/state
|
||||
min: 10
|
||||
max: 80
|
||||
step: 10
|
||||
unit_of_measurement: A
|
||||
mode: slider
|
||||
Reference in New Issue
Block a user