blueprint: name: Daikin Demand Curve Controller (Select 5%) description: > Regelt die Demand-Leistung einer Klimaanlage anhand einer Außentemperatur-Kennlinie mit linearer Interpolation. Der Demand wird auf 5% Schritte gerundet und über eine select-Entity gesetzt. domain: automation input: hvac: name: Klimaanlage selector: entity: domain: climate outdoor_sensor: name: Außentemperatur selector: entity: domain: sensor device_class: temperature room_sensor: name: Raumtemperatur selector: entity: domain: sensor device_class: temperature demand_entity: name: Demand Entity selector: entity: domain: select demand_curve: name: Demand Kennlinie description: JSON Liste von Punkten [Temperatur, Demand] default: "[[-5,60],[0,55],[5,50],[10,45],[15,30]]" selector: text: demand_min: name: Minimum Demand default: 30 selector: number: min: 0 max: 100 demand_max: name: Maximum Demand default: 80 selector: number: min: 0 max: 100 boost_threshold: name: Heiz-Boost Temperaturdifferenz default: 0.5 selector: number: min: 0 max: 2 step: 0.1 boost_amount: name: Demand Boost % default: 10 selector: number: min: 0 max: 50 trigger: - platform: state entity_id: !input outdoor_sensor - platform: state entity_id: !input room_sensor condition: - condition: state entity_id: !input hvac state: heat action: - variables: hvac_entity: !input hvac outdoor_sensor_entity: !input outdoor_sensor room_sensor_entity: !input room_sensor demand_entity_var: !input demand_entity boost_threshold: !input boost_threshold boost_amount: !input boost_amount demand_min: !input demand_min demand_max: !input demand_max curve_raw: !input demand_curve - variables: curve: "{{ curve_raw | from_json }}" outdoor: "{{ states(outdoor_sensor_entity) | float }}" room: "{{ states(room_sensor_entity) | float }}" target: "{{ state_attr(hvac_entity,'temperature') | float }}" - variables: base_demand: > {% set out = outdoor %} {% set pts = curve %} {% if out <= pts[0][0] %} {{ pts[0][1] }} {% elif out >= pts[-1][0] %} {{ pts[-1][1] }} {% else %} {% for i in range(pts|length - 1) %} {% set a = pts[i] %} {% set b = pts[i+1] %} {% if out >= a[0] and out <= b[0] %} {% set ratio = (out - a[0]) / (b[0] - a[0]) %} {{ (a[1] + ratio * (b[1] - a[1])) }} {% endif %} {% endfor %} {% endif %} - variables: diff: "{{ target - room }}" demand: > {% set base = base_demand | float %} {% if diff > boost_threshold %} {{ base + boost_amount }} {% else %} {{ base }} {% endif %} - variables: limited: > {% set val = demand | float %} {{ [demand_max, [val, demand_min] | max] | min }} rounded: "{{ (limited / 5) | round(0) * 5 }}" option: "{{ rounded | int }}" - service: select.select_option target: entity_id: "{{ demand_entity_var }}" data: option: "{{ option }}" mode: restart