Skip to content

Instantly share code, notes, and snippets.

@hmoffatt
Created July 27, 2021 23:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hmoffatt/763755142858b10c13780e8cd9149be4 to your computer and use it in GitHub Desktop.
Save hmoffatt/763755142858b10c13780e8cd9149be4 to your computer and use it in GitHub Desktop.
Fronius meter configuration for Home Assistant
sensor:
- platform: fronius
resource: http://solar
monitored_conditions:
- sensor_type: power_flow
- platform: template
sensors:
# The raw Fronius photovoltaic state goes to unknown after dark, so force it to zero
photovoltaics_power:
friendly_name: "Solar Photovoltaics Power"
unit_of_measurement: 'W'
value_template:
"{{ states('sensor.power_photovoltaics_fronius_power_flow_0_http_solar')|float }}"
house_power:
friendly_name: "Total House Power Consumption"
unit_of_measurement: 'W'
value_template:
"{{ 0 - states('sensor.power_load_fronius_power_flow_0_http_solar')|float }}"
# The raw grid power is negative if exporting and positive if importing, so produce
# separate figures here so we can calculate energy based on them below
grid_import_power:
friendly_name: "Grid Imported Power"
unit_of_measurement: 'W'
value_template:
"{{ [states('sensor.power_grid_fronius_power_flow_0_http_solar')|float, 0]|max }}"
grid_export_power:
friendly_name: "Grid Exported Power"
unit_of_measurement: 'W'
value_template:
"{{ [0 - states('sensor.power_grid_fronius_power_flow_0_http_solar')|float, 0]|max }}"
- platform: integration
name: photovoltaics_total_energy
source: sensor.photovoltaics_power
unit: kWh
unit_time: h
unit_prefix: k
round: 2
method: left
- platform: integration
name: house_total_energy
source: sensor.house_power
unit: kWh
unit_time: h
unit_prefix: k
round: 2
method: left
- platform: integration
name: grid_import_total_energy
source: sensor.grid_import_power
unit: kWh
unit_time: h
unit_prefix: k
round: 2
method: left
- platform: integration
name: grid_export_total_energy
source: sensor.grid_export_power
unit: kWh
unit_time: h
unit_prefix: k
round: 2
method: left
utility_meter:
photovoltaics_daily_energy:
source: sensor.photovoltaics_total_energy
cycle: daily
house_daily_energy:
source: sensor.house_total_energy
cycle: daily
grid_import_daily_energy:
source: sensor.grid_import_total_energy
cycle: daily
grid_export_daily_energy:
source: sensor.grid_export_total_energy
cycle: daily
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment