169 lines
5.8 KiB
YAML
169 lines
5.8 KiB
YAML
# See also sungrow.yaml
|
|
|
|
utility_meter:
|
|
monthly_energy_import:
|
|
unique_id: 45592bcec26dce9610a2
|
|
source: sensor.eagle_200_total_meter_energy_delivered
|
|
name: Energy imported
|
|
cycle: monthly
|
|
tariffs:
|
|
- peak
|
|
- offpeak
|
|
|
|
daily_energy_import:
|
|
unique_id: 369a60ac77147745dc93
|
|
source: sensor.eagle_200_total_meter_energy_delivered
|
|
name: Energy imported
|
|
cycle: daily
|
|
tariffs:
|
|
- peak
|
|
- offpeak
|
|
|
|
monthly_energy_export:
|
|
unique_id: f1ad1161d984e5318715
|
|
source: sensor.eagle_200_total_meter_energy_received
|
|
name: Energy exported
|
|
cycle: monthly
|
|
|
|
daily_energy_export:
|
|
unique_id: 327f806728f2d087e8e5
|
|
source: sensor.eagle_200_total_meter_energy_received
|
|
name: Energy exported
|
|
cycle: daily
|
|
|
|
# daily_supply_charge:
|
|
# unique_id: 31887b27e2ecd837328b
|
|
|
|
template:
|
|
- trigger:
|
|
- platform: time_pattern
|
|
hours: "*" # calculate hourly should be fine
|
|
sensor:
|
|
# Increases every day by 1W to fake a daily supply charge in energy dashboard.
|
|
- state: >-
|
|
{{ 0.001 * (now() - "2022-09-26" | as_datetime | as_local).days }}
|
|
unit_of_measurement: kWh
|
|
state_class: total_increasing
|
|
device_class: energy
|
|
unique_id: 3970c65019ebd336b074
|
|
name: "Days for daily supply charge"
|
|
|
|
automation:
|
|
- id: b508954f792ff8483254
|
|
alias: Change electricity tariff
|
|
mode: single
|
|
trigger:
|
|
- platform: time
|
|
at: "15:00:00"
|
|
variables:
|
|
tariff: peak
|
|
- platform: time
|
|
at: "21:00:00"
|
|
variables:
|
|
tariff: offpeak
|
|
action:
|
|
- service: select.select_option
|
|
target:
|
|
entity_id:
|
|
- select.monthly_energy_import
|
|
- select.daily_energy_import
|
|
data:
|
|
option: "{{ tariff }}"
|
|
|
|
- id: 4f863af550147e9b3170
|
|
alias: update pvoutput
|
|
trigger:
|
|
platform: time_pattern
|
|
minutes: /5
|
|
action:
|
|
service: rest_command.update_pvoutput
|
|
data: {}
|
|
mode: single
|
|
|
|
rest_command:
|
|
# https://pvoutput.org/help/api_specification.html#id1
|
|
update_pvoutput:
|
|
url: https://pvoutput.org/service/r2/addstatus.jsp
|
|
method: post
|
|
headers:
|
|
Host: pvoutput.org
|
|
User-Agent: HomeAssistant
|
|
X-Pvoutput-Apikey: !secret pvoutput_api_key
|
|
X-Pvoutput-SystemId: !secret pvoutput_system_id
|
|
payload: "{{ states('sensor.pvoutput_payload') }}"
|
|
content_type: "application/x-www-form-urlencoded"
|
|
|
|
sensor:
|
|
- platform: template
|
|
sensors:
|
|
pvoutput_payload:
|
|
unique_id: pvoutput_payload
|
|
friendly_name: PVOutput payload
|
|
value_template: >-
|
|
d={{now().strftime("%Y%m%d")}} {#- date -#}
|
|
&t={{now().strftime("%H:%M")}} {#- time -#}
|
|
&c1=2 {#- cumulative mode -#}
|
|
&v1={{states('sensor.inverter_pv_generation_today') | int * 1000 }} {#- energy generation -#}
|
|
&v2={{states('sensor.inverter_pv_power')|float|round(0)}} {#- power generation (W) -#}
|
|
&v4={{states('sensor.inverter_load_power')|float|round(0)}} {#- power consumption (W) -#}
|
|
&v6={{states('sensor.inverter_phase_a_voltage')|float|round(1)}} {#- voltage -#}
|
|
|
|
# eagle_200_meter_power_demand_w:
|
|
# unique_id: 528a94ffdd069f6f5dcd
|
|
# friendly_name: Eagle-200 Meter Power Demand (W)
|
|
# value_template: >-
|
|
# {{ states('sensor.eagle_200_meter_power_demand') | float * 1000 }}
|
|
# unit_of_measurement: W
|
|
# device_class: power
|
|
|
|
inverter_grid_power_demand:
|
|
unique_id: 733c721fd52bf672d0ed
|
|
friendly_name: Inverter grid power demand
|
|
value_template: >-
|
|
{{ iif(states('sensor.inverter_export_power') | float == 0, 0, -1 * states('sensor.inverter_export_power') | float) }}
|
|
unit_of_measurement: W
|
|
device_class: power
|
|
|
|
current_electricity_cost:
|
|
unique_id: current_electricity_cost
|
|
value_template: |
|
|
{{ (states('sensor.electricity_general_price') | float * states('sensor.eagle_200_meter_power_demand') | float) | round(2) }}
|
|
unit_of_measurement: $/hr
|
|
device_class: monetary
|
|
friendly_name: Current electricity cost
|
|
|
|
property_power_usage:
|
|
unique_id: property_power_usage
|
|
value_template: |
|
|
{{ [0, (states('sensor.eagle_200_meter_power_demand') | float + states('sensor.inverter_active_power') | float) | round(0)] | max }}
|
|
unit_of_measurement: W
|
|
device_class: power
|
|
friendly_name: Property power usage
|
|
|
|
# This should count any power that is not coming _directly_ from the sun, including the home battery. This is
|
|
# because power used here can cause purchasing to happen later when the battery is drained, and the proportion of
|
|
# usage between the main house and the tiny house should reflect the proportion of the bill.
|
|
#
|
|
# Note: Ideally, if we drain from battery and then the sun re-charges it, it wouldn't be counted, but that might be trickier so I'll have to work on that later.
|
|
budgeted_property_power_usage:
|
|
unique_id: budgeted_property_power_usage
|
|
value_template: |
|
|
{{ [0, (states('sensor.eagle_200_meter_power_demand') | float + states('sensor.inverter_active_power') | float - states('sensor.inverter_pv_power') | float)| round(0)] | max }}
|
|
unit_of_measurement: W
|
|
device_class: power
|
|
friendly_name: Property power usage
|
|
|
|
- platform: integration
|
|
source: sensor.property_power_usage
|
|
name: Property energy usage
|
|
unique_id: property_energy_usage
|
|
unit_prefix: k
|
|
round: 2
|
|
|
|
- platform: integration
|
|
source: sensor.budgeted_property_power_usage
|
|
name: Budgeted property energy usage
|
|
unique_id: budgeted_property_energy_usage
|
|
unit_prefix: k
|
|
round: 2
|