schmiddydel

PV Überschuss Steuerung - Stop

Jun 15th, 2025 (edited)
159
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 6.61 KB | Source Code | 0 0
  1. blueprint:
  2.   name: "PV Überschuss Steuerung – Stop"
  3.   description: |
  4.     Schaltet Heizstab-Phasen NUR ab wenn:
  5.    1. PV-Export < Schwellwert FÜR [Dauer] UND
  6.     2. Batterie < Mindestladung.
  7.     Prüft alle 15 Minuten zusätzlich.
  8.     Optional: Benachrichtigungen mit dynamischem Inhalt (abschaltbar).
  9.   domain: automation
  10.  
  11.   input:
  12.     export_sensor:
  13.       name: "PV Export Sensor"
  14.       description: "Sensor für Netzrückspeisung in Watt (z. B. sensor.grid_power)"
  15.       selector:
  16.         entity:
  17.           domain: sensor
  18.  
  19.     batterieladung_sensor:
  20.       name: "Batterieladung Sensor"
  21.       description: "Sensor für Batterieladung in % (z. B. sensor.battery_soc)"
  22.       selector:
  23.         entity:
  24.           domain: sensor
  25.  
  26.     phase_1:
  27.       name: "Phase 1 Schalter"
  28.       description: "Input Boolean für Phase 1"
  29.       selector:
  30.         entity:
  31.           domain: input_boolean
  32.  
  33.     phase_2:
  34.       name: "Phase 2 Schalter"
  35.       description: "Input Boolean für Phase 2"
  36.       selector:
  37.         entity:
  38.           domain: input_boolean
  39.  
  40.     phase_3:
  41.       name: "Phase 3 Schalter"
  42.       description: "Input Boolean für Phase 3"
  43.       selector:
  44.         entity:
  45.           domain: input_boolean
  46.  
  47.     export_threshold:
  48.       name: "Export Schwellwert"
  49.       description: "Abschaltgrenze in Watt (z. B. 500)"
  50.       default: 500
  51.       selector:
  52.         number:
  53.           min: 0
  54.           max: 5000
  55.           step: 50
  56.           unit_of_measurement: W
  57.  
  58.     battery_threshold:
  59.       name: "Batterie Schwellwert"
  60.       description: "Mindestladung in % (z. B. 20)"
  61.       default: 20
  62.       selector:
  63.         number:
  64.           min: 0
  65.           max: 100
  66.           step: 5
  67.           unit_of_measurement: "%"
  68.  
  69.     duration:
  70.       name: "Mindestdauer"
  71.       description: "Dauer der Unterschreitung (z. B. 5:00)"
  72.       default: "00:05:00"
  73.       selector:
  74.         duration:
  75.           enable_day: false
  76.  
  77.     enable_notifications:
  78.       name: "Benachrichtigungen aktivieren"
  79.       description: "Nur wenn aktiviert, werden Nachrichten versendet"
  80.       selector:
  81.         entity:
  82.           domain: input_boolean
  83.  
  84.     notify_service:
  85.       name: "Benachrichtigungsdienst"
  86.       description: "Service für Benachrichtigungen (z. B. notify.mobile_app_xyz)"
  87.       selector:
  88.         text:
  89.     message_phase_1:
  90.       name: Nachricht Phase 1
  91.       default: >-
  92.         ⚠️ Phase 1 abgeschaltet
  93.  
  94.         Grund: {{ trigger_type }}
  95.  
  96.         PV-Export: {{ export_value }} W < {{ export_threshold }} W
  97.  
  98.         Batterie: {{ battery_value }} % < {{ battery_threshold }} %
  99.  
  100.         Zeit: {{ timestamp }}
  101.       selector:
  102.         text:
  103.     message_phase_2:
  104.       name: Nachricht Phase 2
  105.       default: >-
  106.         ⚠️ Phase 2 abgeschaltet
  107.  
  108.         Grund: {{ trigger_type }}
  109.  
  110.         PV-Export: {{ export_value }} W < {{ export_threshold }} W
  111.  
  112.         Batterie: {{ battery_value }} % < {{ battery_threshold }} %
  113.  
  114.         Zeit: {{ timestamp }}
  115.       selector:
  116.         text:
  117.     message_phase_3:
  118.       name: Nachricht Phase 3
  119.       default: >-
  120.         ⚠️ Phase 3 abgeschaltet
  121.  
  122.         Grund: {{ trigger_type }}
  123.  
  124.         PV-Export: {{ export_value }} W < {{ export_threshold }} W
  125.  
  126.         Batterie: {{ battery_value }} % < {{ battery_threshold }} %
  127.  
  128.         Zeit: {{ timestamp }}
  129.       selector:
  130.         text:
  131. trigger:
  132.   - platform: numeric_state
  133.     entity_id: !input export_sensor
  134.     below: !input export_threshold
  135.     for: !input duration
  136.  
  137.   - platform: numeric_state
  138.     entity_id: !input batterieladung_sensor
  139.     below: !input battery_threshold
  140.     for: !input duration
  141.  
  142.   - platform: time_pattern
  143.     minutes: "/15"
  144.  
  145. condition:
  146.   - condition: and
  147.     conditions:
  148.       - condition: numeric_state
  149.         entity_id: !input export_sensor
  150.         below: !input export_threshold
  151.       - condition: numeric_state
  152.         entity_id: !input batterieladung_sensor
  153.         below: !input battery_threshold
  154.       - condition: or
  155.         conditions:
  156.           - condition: state
  157.             entity_id: !input phase_1
  158.             state: "on"
  159.           - condition: state
  160.             entity_id: !input phase_2
  161.             state: "on"
  162.           - condition: state
  163.             entity_id: !input phase_3
  164.             state: "on"
  165.  
  166. action:
  167.   - variables:
  168.       export_entity: !input export_sensor
  169.       battery_entity: !input batterieladung_sensor
  170.       export_threshold: !input export_threshold
  171.       battery_threshold: !input battery_threshold
  172.       export_value: "{{ states(export_entity) | float(0) | round(1) }}"
  173.       battery_value: "{{ states(battery_entity) | float(0) | round(1) }}"
  174.       timestamp: "{{ now().strftime('%H:%M') }}"
  175.       trigger_type: >
  176.        {% if trigger.platform == 'time_pattern' %}
  177.           Zeit-Trigger
  178.         {% else %}
  179.           Wertänderung
  180.         {% endif %}
  181.  
  182.   - choose:
  183.       - conditions:
  184.           - condition: state
  185.             entity_id: !input phase_3
  186.             state: "on"
  187.         sequence:
  188.           - service: input_boolean.turn_off
  189.             target:
  190.               entity_id: !input phase_3
  191.           - if:
  192.               - condition: state
  193.                 entity_id: !input enable_notifications
  194.                 state: "on"
  195.             then:
  196.               - service: !input notify_service
  197.                 data:
  198.                   title: "PV-Überschuss: Phase 3 abgeschaltet"
  199.                   message: !input message_phase_3
  200.  
  201.       - conditions:
  202.           - condition: state
  203.             entity_id: !input phase_2
  204.             state: "on"
  205.         sequence:
  206.           - service: input_boolean.turn_off
  207.             target:
  208.               entity_id: !input phase_2
  209.           - if:
  210.               - condition: state
  211.                 entity_id: !input enable_notifications
  212.                 state: "on"
  213.             then:
  214.               - service: !input notify_service
  215.                 data:
  216.                   title: "PV-Überschuss: Phase 2 abgeschaltet"
  217.                   message: !input message_phase_2
  218.  
  219.       - conditions:
  220.           - condition: state
  221.             entity_id: !input phase_1
  222.             state: "on"
  223.         sequence:
  224.           - service: input_boolean.turn_off
  225.             target:
  226.               entity_id: !input phase_1
  227.           - if:
  228.               - condition: state
  229.                 entity_id: !input enable_notifications
  230.                 state: "on"
  231.             then:
  232.               - service: !input notify_service
  233.                 data:
  234.                   title: "PV-Überschuss: Phase 1 abgeschaltet"
  235.                   message: !input message_phase_1
  236.  
  237. mode: single
  238.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment