schmiddydel

PV Überschuss Steuerung – Start

Jun 15th, 2025 (edited)
180
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 6.46 KB | Source Code | 0 0
  1. blueprint:
  2.   name: PV Überschuss Steuerung – Start
  3.   description: |
  4.    Startet bis zu 3 Phasen abhängig vom PV-Überschuss, Batterie-Ladung und Schalterzuständen.
  5.     Jede Phase wird nur aktiviert, wenn die vorherige bereits eingeschaltet ist.
  6.     Optional: Benachrichtigungen mit dynamischem Inhalt (abschaltbar).
  7.   domain: automation
  8.  
  9.   input:
  10.     trigger_entity:
  11.       name: Überschuss-Sensor
  12.       description: Sensor, der den PV-Überschuss in Watt misst (z. B. "sensor.grid_export_power")
  13.       selector:
  14.         entity:
  15.           domain: sensor
  16.  
  17.     trigger_above:
  18.       name: Schwellenwert (Watt)
  19.       description: Mindest-PV-Überschuss zum Starten (in Watt)
  20.       default: 1500
  21.       selector:
  22.         number:
  23.           min: 0
  24.           max: 10000
  25.           unit_of_measurement: W
  26.  
  27.     duration:
  28.       name: Mindestdauer Überschuss über Schwelle
  29.       description: Wie lange muss der Überschuss den Schwellenwert überschreiten?
  30.       default: "00:05:00"
  31.       selector:
  32.         duration:
  33.     battery_sensor:
  34.       name: Batteriesensor (in %)
  35.       description: Sensor, der den Batterieladestand anzeigt (z. B. "sensor.battery_level")
  36.       selector:
  37.         entity:
  38.           domain: sensor
  39.  
  40.     battery_threshold:
  41.       name: Mindest-Batterieladung (%)
  42.       description: Nur starten, wenn Batterie über diesem Wert liegt
  43.       default: 90
  44.       selector:
  45.         number:
  46.           min: 0
  47.           max: 100
  48.           unit_of_measurement: '%'
  49.  
  50.     phase_1:
  51.       name: Schalter Phase 1 (input_boolean)
  52.       selector:
  53.         entity:
  54.           domain: input_boolean
  55.  
  56.     phase_2:
  57.       name: Schalter Phase 2 (input_boolean)
  58.       selector:
  59.         entity:
  60.           domain: input_boolean
  61.  
  62.     phase_3:
  63.       name: Schalter Phase 3 (input_boolean)
  64.       selector:
  65.         entity:
  66.           domain: input_boolean
  67.  
  68.     message_phase_1:
  69.       name: Nachricht Phase 1
  70.       default: >-
  71.         ☀️ Phase 1 aktiviert
  72.  
  73.         Grund: {{ trigger_type }}
  74.  
  75.         PV-Export: {{ export_value }} W ≥ {{ export_threshold }} W
  76.  
  77.         Batterie: {{ battery_value }} % ≥ {{ battery_threshold }} %
  78.  
  79.         Zeit: {{ timestamp }}
  80.       selector:
  81.         text:
  82.     message_phase_2:
  83.       name: Nachricht Phase 2
  84.       default: >-
  85.         ☀️ Phase 2 aktiviert
  86.  
  87.         Grund: {{ trigger_type }}
  88.  
  89.         PV-Export: {{ export_value }} W ≥ {{ export_threshold }} W
  90.  
  91.         Batterie: {{ battery_value }} % ≥ {{ battery_threshold }} %
  92.  
  93.         Zeit: {{ timestamp }}
  94.       selector:
  95.         text:
  96.     message_phase_3:
  97.       name: Nachricht Phase 3
  98.       default: >-
  99.         ☀️ Phase 3 aktiviert
  100.  
  101.         Grund: {{ trigger_type }}
  102.  
  103.         PV-Export: {{ export_value }} W ≥ {{ export_threshold }} W
  104.  
  105.         Batterie: {{ battery_value }} % ≥ {{ battery_threshold }} %
  106.  
  107.         Zeit: {{ timestamp }}
  108.       selector:
  109.         text:
  110.     enable_notifications:
  111.       name: Benachrichtigungen aktivieren
  112.       description: Nur wenn aktiviert, werden Nachrichten versendet
  113.       selector:
  114.         entity:
  115.           domain: input_boolean
  116.  
  117.     notify_service:
  118.       name: Benachrichtigungsdienst
  119.       description: z. B. notify.mobile_app_dein_handy
  120.       selector:
  121.         text:
  122. trigger:
  123.   - platform: numeric_state
  124.     entity_id: !input trigger_entity
  125.     above: !input trigger_above
  126.     for: !input duration
  127.  
  128.   - platform: numeric_state
  129.     entity_id: !input battery_sensor
  130.     above: !input battery_threshold
  131.  
  132. condition:
  133.   - condition: and
  134.     conditions:
  135.       - condition: numeric_state
  136.         entity_id: !input battery_sensor
  137.         above: !input battery_threshold
  138.       - condition: numeric_state
  139.         entity_id: !input trigger_entity
  140.         above: !input trigger_above
  141.       - condition: state
  142.         entity_id: !input phase_3
  143.         state: "off"
  144.  
  145. action:
  146.   - variables:
  147.       export_entity: !input trigger_entity
  148.       battery_entity: !input battery_sensor
  149.       export_threshold: !input trigger_above
  150.       battery_threshold: !input battery_threshold
  151.       export_value: "{{ states(export_entity) | float | round(1) }}"
  152.       battery_value: "{{ states(battery_entity) | float | round(1) }}"
  153.       timestamp: "{{ now().strftime('%H:%M') }}"
  154.       trigger_type: >
  155.        {% if trigger.platform == 'numeric_state' %}
  156.           Wertänderung
  157.         {% else %}
  158.           Zeit-Trigger
  159.         {% endif %}
  160.  
  161.   - choose:
  162.       - conditions:
  163.           - condition: state
  164.             entity_id: !input phase_1
  165.             state: "off"
  166.         sequence:
  167.           - service: input_boolean.turn_on
  168.             target:
  169.               entity_id: !input phase_1
  170.           - if:
  171.               - condition: state
  172.                 entity_id: !input enable_notifications
  173.                 state: "on"
  174.             then:
  175.               - service: !input notify_service
  176.                 data:
  177.                   title: "PV-Überschuss: Phase 1 aktiviert"
  178.                   message: !input message_phase_1
  179.  
  180.       - conditions:
  181.           - condition: state
  182.             entity_id: !input phase_1
  183.             state: "on"
  184.           - condition: state
  185.             entity_id: !input phase_2
  186.             state: "off"
  187.         sequence:
  188.           - service: input_boolean.turn_on
  189.             target:
  190.               entity_id: !input phase_2
  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 2 aktiviert"
  199.                   message: !input message_phase_2
  200.  
  201.       - conditions:
  202.           - condition: state
  203.             entity_id: !input phase_1
  204.             state: "on"
  205.           - condition: state
  206.             entity_id: !input phase_2
  207.             state: "on"
  208.           - condition: state
  209.             entity_id: !input phase_3
  210.             state: "off"
  211.         sequence:
  212.           - service: input_boolean.turn_on
  213.             target:
  214.               entity_id: !input phase_3
  215.           - if:
  216.               - condition: state
  217.                 entity_id: !input enable_notifications
  218.                 state: "on"
  219.             then:
  220.               - service: !input notify_service
  221.                 data:
  222.                   title: "PV-Überschuss: Phase 3 aktiviert"
  223.                   message: !input message_phase_3
  224.  
  225.   - delay: "00:01:00"
  226.  
  227. mode: restart
  228.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment