Hi,
I am new to HA and try to automate my inverter output power due to the new German law Solarspitzengesetz.
This is how my configuration looks like:
template:
- sensor:
- name: "fronius_symo_pwr_limit"
# Solarspitzengesetz: maximum grid feed is 60% of kWp installed
# i.e. 5220 * 60% = 3120 W
# inverter max power is 5000 W
# value to control inverter power is in percent scaled by 100, i.e. 10000 = 100%
state: >
{% set max_power = 5000 %}
{% set scaling = 10000 %}
{% set installed_Wp = 5220 %}
{% set max_grid_feed = (installed_Wp * 0.60) %}
{{ (( [ ((states("sensor.shellypro3_total_active_power") | float(0) )
+ (states("sensor.fronius_symo_5_0_leistung_ac") | float(0) )
+ max_grid_feed), max_power] | min)
/ max_power * scaling) | int
}}
This code is fine in the template editor and when reloading the yaml.
Now, I want to use new sensor (fronius_symo_pwr_limit) in an automation like this:
- id: '1743520805814'
alias: Froinuis Symo limit output power
description: ''
triggers:
- trigger: state
entity_id:
- sensor.shellypro3_total_active_power
conditions:
- condition: numeric_state
entity_id: sensor.shellypro3_total_active_power
below: -3000
actions:
- action: modbus.write_register
data:
hub: mb_symo
address: 40242
value: '{{ states(''fronius_symo_pwr_limit'') }}'
- action: modbus.write_register
data:
hub: mb_symo
address: 40246
value: 1
mode: single
When I manual triggering the action, I receive an error expected int @ data['value'][0]. Got None
. Writing fixed values (s. second action) works fine.
What have I missed? Thanks for your help!