|
mqtt: |
|
# https://www.home-assistant.io/integrations/sensor.mqtt |
|
sensor: |
|
- name: Inverters YieldTotal |
|
unique_id: D6A6659B-EE6A-4C3F-91F4-C0FBD46E8CF5 |
|
state_class: total_increasing |
|
device_class: energy |
|
unit_of_measurement: "kWh" |
|
state_topic: "opendtu/ac/yieldtotal" |
|
value_template: "{{ value|float }}" |
|
# availability_topic: "opendtu/ac/is_valid" |
|
# payload_available: "1" |
|
# payload_not_available: "0" |
|
|
|
- name: Inverters YieldDay |
|
unique_id: "01e37eed-3045-4eee-a786-1249567fe310" |
|
state_class: total_increasing |
|
device_class: energy |
|
unit_of_measurement: "kWh" |
|
state_topic: "opendtu/ac/yieldday" |
|
value_template: "{{ value|float / 1000.0 }}" |
|
# availability_topic: "opendtu/ac/is_valid" |
|
# payload_available: "1" |
|
# payload_not_available: "0" |
|
|
|
- name: Inverters Power |
|
unique_id: "01e37eed-3045-4eee-a786-1249567fe315" |
|
state_class: measurement |
|
device_class: power |
|
unit_of_measurement: W |
|
state_topic: "opendtu/ac/power" |
|
value_template: "{{ value|int }}" |
|
availability_topic: "opendtu/ac/is_valid" |
|
payload_available: "1" |
|
payload_not_available: "0" |
|
|
|
- name: Inverters PowerDC |
|
unique_id: "01e37eed-3045-4eee-a786-1249567fe316" |
|
state_class: measurement |
|
device_class: power |
|
unit_of_measurement: W |
|
state_topic: "opendtu/dc/power" |
|
value_template: "{{ value|int }}" |
|
availability_topic: "opendtu/dc/is_valid" |
|
payload_available: "1" |
|
payload_not_available: "0" |
|
|
|
template: |
|
# https://www.home-assistant.io/integrations/sensor/ |
|
- sensor: |
|
- name: Inverters Energy |
|
unique_id: 6E14EC86-0965-463E-BFBF-6008B61B56AF |
|
state_class: total_increasing |
|
device_class: energy |
|
unit_of_measurement: "kWh" |
|
state: "{{ [states.sensor.inverters_yieldtotal.state|float(0), states.sensor.inverters_energy.state|float(0) ] | max }}" |
|
|
|
- name: Inverter 1 Adjusted Irradiation |
|
unique_id: C47E36DF-4FCD-40CA-B3C7-8B186A02A015 |
|
state_class: measurement |
|
unit_of_measurement: "%" |
|
availability: "{{ ['sensor.inverter_1_powerdc', 'sensor.inverter_1_temperature']|map('states')|map('is_number')|min }}" |
|
state: "{{ [100, states.sensor.inverter_1_powerdc.state|float / (400 * (110 - states.sensor.inverter_1_temperature.state|float * 0.4) / 100) * 100] | min }}" |
|
|
|
- name: Inverter 2 Adjusted Irradiation |
|
unique_id: C0EB72EE-725E-42C0-A25F-677BB3984EFA |
|
state_class: measurement |
|
unit_of_measurement: "%" |
|
availability: "{{ ['sensor.inverter_2_powerdc', 'sensor.inverter_2_temperature']|map('states')|map('is_number')|min }}" |
|
state: "{{ [100, states.sensor.inverter_2_powerdc.state|float / (400 * (110 - states.sensor.inverter_2_temperature.state|float * 0.4) / 100) * 100] | min }}" |
|
|
|
- name: Inverter 3 Adjusted Irradiation |
|
unique_id: 8A61D828-4545-48AC-9CEB-80C96CEAC421 |
|
state_class: measurement |
|
unit_of_measurement: "%" |
|
availability: "{{ ['sensor.inverter_3_powerdc', 'sensor.inverter_3_temperature']|map('states')|map('is_number')|min }}" |
|
state: "{{ [100, states.sensor.inverter_3_powerdc.state|float / (400 * (110 - states.sensor.inverter_3_temperature.state|float * 0.4) / 100) * 100] | min }}" |
|
|
|
- name: Inverter 4 Adjusted Irradiation |
|
unique_id: 5B1EB6CC-1CF4-4EBD-B476-1254951BB8EA |
|
state_class: measurement |
|
unit_of_measurement: "%" |
|
availability: "{{ ['sensor.inverter_4_powerdc', 'sensor.inverter_4_temperature']|map('states')|map('is_number')|min }}" |
|
state: "{{ [100, states.sensor.inverter_4_powerdc.state|float / (400 * (110 - states.sensor.inverter_4_temperature.state|float * 0.4) / 100) * 100] | min }}" |
|
|
|
- name: Inverter 5 Adjusted Irradiation |
|
unique_id: 33EBEF2B-F8C0-4E7E-A90B-7C6706F63E1E |
|
state_class: measurement |
|
unit_of_measurement: "%" |
|
availability: "{{ ['sensor.inverter_5_powerdc', 'sensor.inverter_5_temperature']|map('states')|map('is_number')|min }}" |
|
state: "{{ [100, states.sensor.inverter_5_powerdc.state|float / (400 * (110 - states.sensor.inverter_5_temperature.state|float * 0.4) / 100) * 100] | min }}" |
|
|
|
- name: Inverter 6 Adjusted Irradiation |
|
unique_id: B9B3BEE3-9958-43F9-80A4-06163F5B0022 |
|
state_class: measurement |
|
unit_of_measurement: "%" |
|
availability: "{{ ['sensor.inverter_6_powerdc', 'sensor.inverter_6_temperature']|map('states')|map('is_number')|min }}" |
|
state: "{{ [100, states.sensor.inverter_6_powerdc.state|float / (400 * (110 - states.sensor.inverter_6_temperature.state|float * 0.4) / 100) * 100] | min }}" |
|
|
|
# https://www.home-assistant.io/integrations/utility_meter/ |
|
utility_meter: |
|
inverters_energy_meter_daily: |
|
name: Inverters Energy Meter Daily |
|
unique_id: 4C4D8D06-C9D2-4408-B21A-1274A6E0F041 |
|
source: sensor.inverters_energy |
|
cycle: daily |
|
|
|
# https://www.home-assistant.io/integrations/input_number |
|
input_number: |
|
inverters_absolute_power_limit: |
|
name: Inverters Absolute Power Limit |
|
unit_of_measurement: W |
|
min: 0 |
|
max: 400 |
|
step: 1 |
|
mode: slider |
|
inverters_excess_setpoint: |
|
name: Inverters Excess Setpoint |
|
unit_of_measurement: W |
|
min: -2000 |
|
max: 2000 |
|
step: 100 |
|
mode: slider |
|
inverters_excess_setpoint_limiter: |
|
name: Inverters Excess Setpoint With Limiter |
|
unit_of_measurement: W |
|
min: -2000 |
|
max: 2000 |
|
step: 100 |
|
mode: slider |
|
|
|
# https://www.home-assistant.io/docs/automation/ |
|
automation: |
|
- id: "0000000000038" |
|
alias: "OpenDTU: Set Inverters Absolute Power Limit" |
|
trigger: |
|
- trigger: state |
|
entity_id: |
|
- input_number.inverters_absolute_power_limit |
|
condition: [] |
|
action: |
|
- action: number.set_value |
|
data: |
|
value: "{{[400, [0, states.input_number.inverters_absolute_power_limit.state|int]|max]|min}}" |
|
target: |
|
entity_id: |
|
- number.inverter_1_limit_nonpersistent_absolute |
|
- number.inverter_2_limit_nonpersistent_absolute |
|
- number.inverter_3_limit_nonpersistent_absolute |
|
- number.inverter_4_limit_nonpersistent_absolute |
|
- number.inverter_5_limit_nonpersistent_absolute |
|
- number.inverter_6_limit_nonpersistent_absolute |
|
- id: "0000000000039" |
|
alias: "OpenDTU: Auto Adjust Inverters Absolute Power Limit" |
|
trigger: |
|
- trigger: time_pattern |
|
minutes: /2 |
|
condition: |
|
- condition: state |
|
entity_id: binary_sensor.opendtu_status |
|
state: "on" |
|
- condition: template |
|
value_template: | |
|
{{['sensor.grid_power']|map('states')|map('is_number')|min}} |
|
- condition: template |
|
value_template: | |
|
{{ range(1, 7)|map('regex_replace', '(\d+)', "sensor.inverter_\\1_power")|map('states')|map('is_number')|reject("false")|list|count > 0 }} |
|
action: |
|
- variables: |
|
new_limit: >- |
|
{% set setpointWithoutLimiter = states('input_number.inverters_excess_setpoint')|float(0) %} |
|
{% set setpointWithLimiter = states('input_number.inverters_excess_setpoint_limiter')|float(0) %} |
|
{% set limiterEnabled = states('binary_sensor.3erl_bridage_demande') == 'on' %} |
|
{% set setpoint = setpointWithLimiter if limiterEnabled else setpointWithoutLimiter %} |
|
{% set grid = states('sensor.grid_power')|float %} |
|
{% set available = range(1, 7)|map('regex_replace', '(\d+)', "sensor.inverter_\\1_power")|map('states')|map('is_number')|reject("false")|list|count %} |
|
{% set error = ((grid - setpoint) / available) | int if available > 0 else 0 %} |
|
{{[400, [0, states.input_number.inverters_absolute_power_limit.state|int + error]|max]|min}} |
|
- action: input_number.set_value |
|
data: |
|
value: "{{ new_limit }}" |
|
target: |
|
entity_id: |
|
- input_number.inverters_absolute_power_limit |
|
- id: "0000000000041" |
|
alias: "OpenDTU: Auto Adjust Setpoint with Limiter" |
|
triggers: |
|
- trigger: state |
|
entity_id: |
|
- binary_sensor.openevse_vehicle_connected |
|
- sensor.openevse_vehicle_battery_level |
|
conditions: [] |
|
actions: |
|
- if: |
|
- condition: state |
|
entity_id: binary_sensor.openevse_vehicle_connected |
|
state: "on" |
|
- condition: numeric_state |
|
entity_id: sensor.openevse_vehicle_battery_level |
|
below: 100 |
|
then: |
|
- action: input_number.set_value |
|
metadata: {} |
|
data: |
|
value: -500 |
|
target: |
|
entity_id: input_number.inverters_excess_setpoint_limiter |
|
else: |
|
- action: input_number.set_value |
|
metadata: {} |
|
data: |
|
value: -300 |
|
target: |
|
entity_id: input_number.inverters_excess_setpoint_limiter |
|
# |
|
# total unavailable: {{ range(1, 7)|map('regex_replace', '(\d+)', "sensor.inverter_\\1_power")|map('states')|map('is_number')|reject("true")|list|count }} |
|
# total available: {{ range(1, 7)|map('regex_replace', '(\d+)', "sensor.inverter_\\1_power")|map('states')|map('is_number')|reject("false")|list|count }} |