89 lines
3.3 KiB
YAML
89 lines
3.3 KiB
YAML
# Today's solar harvested + household energy used — daily-resetting kWh
|
|
# sensors for a dashboard indicator.
|
|
#
|
|
# This is a Home Assistant *package* (bundles several domains in one file)
|
|
# so the whole feature installs as one unit.
|
|
#
|
|
# Install:
|
|
# 1. Copy to <config>/lvx6048/daily_energy_package.yaml
|
|
# 2. In configuration.yaml (once), pull it in as a package:
|
|
# homeassistant:
|
|
# packages:
|
|
# lvx6048_daily_energy: !include lvx6048/daily_energy_package.yaml
|
|
# 3. Requires template_sensors.yaml already loaded (provides
|
|
# sensor.lvx6048_stack_ac_output_active_power).
|
|
# 4. Restart HA.
|
|
#
|
|
# Produces two dashboard-ready entities:
|
|
# sensor.solar_harvested_today kWh — PV generated today (both inverters)
|
|
# sensor.solar_used_today kWh — household load consumed today
|
|
#
|
|
# Data sources & why:
|
|
# - Harvested: each inverter exposes a *lifetime* Wh counter
|
|
# (total_pv_generated_energy); the LVX6048 firmware has no daily-energy
|
|
# query (ED is NAKed). A daily utility_meter on the lifetime counter gives
|
|
# today's harvest from the inverter's own internal accumulator (accurate).
|
|
# - Used: no cumulative load counter exists, so the household load *power*
|
|
# (sensor.lvx6048_stack_ac_output_active_power, sum of both inverters'
|
|
# AC output from template_sensors.yaml) is Riemann-integrated into energy
|
|
# and metered daily. This is an estimate; accuracy tracks powermon's GS
|
|
# poll cadence. Counts only load served by the inverters.
|
|
#
|
|
# NOTE: verify the two source entity_ids match your HA install
|
|
# (Developer Tools -> States): sensor.lvx6048_1_total_pv_generated_energy
|
|
# and sensor.lvx6048_2_total_pv_generated_energy.
|
|
|
|
template:
|
|
- sensor:
|
|
- name: "Solar Harvested Today"
|
|
unique_id: solar_harvested_today
|
|
unit_of_measurement: "kWh"
|
|
device_class: energy
|
|
state_class: total_increasing
|
|
icon: mdi:solar-power
|
|
availability: >
|
|
{{ has_value('sensor.solar_pv_today_unit_1')
|
|
and has_value('sensor.solar_pv_today_unit_2') }}
|
|
state: >
|
|
{{ ((states('sensor.solar_pv_today_unit_1') | float(0))
|
|
+ (states('sensor.solar_pv_today_unit_2') | float(0))) / 1000 }}
|
|
|
|
# Riemann-sum integration: household load power (W) -> energy (kWh)
|
|
sensor:
|
|
- platform: integration
|
|
source: sensor.lvx6048_stack_ac_output_active_power
|
|
name: "Household Load Energy"
|
|
unique_id: household_load_energy_total
|
|
unit_prefix: k
|
|
round: 3
|
|
method: trapezoidal
|
|
|
|
# Daily-resetting meters (reset at local midnight)
|
|
utility_meter:
|
|
solar_pv_today_unit_1:
|
|
source: sensor.lvx6048_1_total_pv_generated_energy
|
|
cycle: daily
|
|
solar_pv_today_unit_2:
|
|
source: sensor.lvx6048_2_total_pv_generated_energy
|
|
cycle: daily
|
|
solar_used_today:
|
|
source: sensor.household_load_energy
|
|
cycle: daily
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Dashboard card (paste into a Lovelace view, or Raw config editor):
|
|
#
|
|
# type: horizontal-stack
|
|
# cards:
|
|
# - type: tile
|
|
# entity: sensor.solar_harvested_today
|
|
# name: Harvested Today
|
|
# icon: mdi:solar-power
|
|
# color: amber
|
|
# - type: tile
|
|
# entity: sensor.solar_used_today
|
|
# name: Used Today
|
|
# icon: mdi:home-lightning-bolt
|
|
# color: blue
|
|
# ---------------------------------------------------------------------------
|