Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias: Nibe F750 Dynamic Max Add Power (Grid Aware, Capped)
- description: >
- Dynamically sets max internal add power based on remaining grid headroom,
- excluding current add power. Uses 3 kW daytime weekday limit and 4 kW
- night/weekend limit, rounded down to 0.5 kW, with a hard cap at 4.0 kW.
- triggers:
- - entity_id:
- - sensor.sh10rt20_grid_energy_purchasing_power
- - sensor.int_el_add_power_43084
- trigger: state
- - seconds: /30
- trigger: time_pattern
- conditions: []
- actions:
- - variables:
- grid_kw: "{{ states('sensor.sh10rt20_grid_energy_purchasing_power') | float(0) }}"
- add_kw: "{{ states('sensor.int_el_add_power_43084') | float(0) }}"
- current_limit: "{{ states('number.max_int_add_power_47212') | float(0) }}"
- is_weekday: "{{ now().weekday() < 5 }}"
- is_daytime: "{{ now().hour >= 7 and now().hour < 20 }}"
- grid_limit: |
- {% if is_weekday and is_daytime %}
- 3.0
- {% else %}
- 4.0
- {% endif %}
- hard_cap: 4
- base_kw: "{{ grid_kw - add_kw }}"
- raw_headroom: "{{ grid_limit - base_kw }}"
- clamped_headroom: "{{ [raw_headroom, 0] | max }}"
- capped_headroom: "{{ [clamped_headroom, hard_cap] | min }}"
- stepped_headroom: |
- {{ (capped_headroom / 0.5) | int * 0.5 }}
- - condition: template
- value_template: "{{ stepped_headroom != current_limit }}"
- - action: number.set_value
- target:
- entity_id: number.max_int_add_power_47212
- data:
- value: "{{ stepped_headroom }}"
- - action: logbook.log
- data:
- name: Nibe F750
- message: >
- Grid={{ grid_kw }} kW (add={{ add_kw }} kW, base={{ base_kw }} kW),
- limit={{ grid_limit }} kW → max add power={{ stepped_headroom }} kW.
- mode: restart
Advertisement