154 lines
5.9 KiB
YAML
154 lines
5.9 KiB
YAML
# Manuel toggle per zone – starter med slider-varighed, stopper hvis allerede aktiv
|
||
vanding_toggle_hojbed_1:
|
||
alias: Toggle Højbed 1 – Ærter
|
||
mode: single
|
||
sequence:
|
||
- choose:
|
||
- conditions:
|
||
- condition: state
|
||
entity_id: switch.hojbed_2
|
||
state: "on"
|
||
sequence:
|
||
- service: switch.turn_off
|
||
target:
|
||
entity_id: switch.hojbed_2
|
||
default:
|
||
- service: rainbird.start_irrigation
|
||
data:
|
||
entity_id: switch.hojbed_2
|
||
duration: "{{ states('input_number.vanding_varighed_hojbed_1') | int(15) }}"
|
||
|
||
vanding_toggle_hojbed_2:
|
||
alias: Toggle Højbed 2 – Kartofler
|
||
mode: single
|
||
sequence:
|
||
- choose:
|
||
- conditions:
|
||
- condition: state
|
||
entity_id: switch.hojbed_1
|
||
state: "on"
|
||
sequence:
|
||
- service: switch.turn_off
|
||
target:
|
||
entity_id: switch.hojbed_1
|
||
default:
|
||
- service: rainbird.start_irrigation
|
||
data:
|
||
entity_id: switch.hojbed_1
|
||
duration: "{{ states('input_number.vanding_varighed_hojbed_2') | int(15) }}"
|
||
|
||
vanding_toggle_hojbed_3:
|
||
alias: Toggle Højbed 3 – Rabarber
|
||
mode: single
|
||
sequence:
|
||
- choose:
|
||
- conditions:
|
||
- condition: state
|
||
entity_id: switch.drivhus_drypvanding
|
||
state: "on"
|
||
sequence:
|
||
- service: switch.turn_off
|
||
target:
|
||
entity_id: switch.drivhus_drypvanding
|
||
default:
|
||
- service: rainbird.start_irrigation
|
||
data:
|
||
entity_id: switch.drivhus_drypvanding
|
||
duration: "{{ states('input_number.vanding_varighed_hojbed_3') | int(15) }}"
|
||
|
||
vanding_hojbed_skiftevis:
|
||
alias: Smart vanding – højbed 1, 2 og 3 efter fugtighed
|
||
mode: single
|
||
sequence:
|
||
# Stop hvis regnsensor er aktiv eller regn-forsinkelse sat
|
||
- condition: and
|
||
conditions:
|
||
- condition: state
|
||
entity_id: binary_sensor.annes_vanding_rainsensor
|
||
state: "off"
|
||
- condition: numeric_state
|
||
entity_id: number.annes_vanding_rain_delay
|
||
below: 1
|
||
|
||
# Gem startfugtighed og nulstil vandingstæller
|
||
- variables:
|
||
start_hb1: "{{ states('sensor.annes_havesensor_soil_moisture_1') | float(0) | round(1) }}"
|
||
start_hb2: "{{ states('sensor.annes_havesensor_soil_moisture_2') | float(0) | round(1) }}"
|
||
start_hb3: "{{ states('sensor.annes_havesensor_soil_moisture_3') | float(0) | round(1) }}"
|
||
count_hb1: 0
|
||
count_hb2: 0
|
||
count_hb3: 0
|
||
|
||
# Ydre løkke: bliv ved mens mindst ét bed er tørt – maks 8 runder
|
||
- repeat:
|
||
while:
|
||
- condition: template
|
||
value_template: >
|
||
{{
|
||
states('sensor.annes_havesensor_soil_moisture_1') | float(100) < 40 or
|
||
states('sensor.annes_havesensor_soil_moisture_2') | float(100) < 40 or
|
||
states('sensor.annes_havesensor_soil_moisture_3') | float(100) < 40
|
||
}}
|
||
- condition: template
|
||
value_template: "{{ repeat.index <= 8 }}"
|
||
sequence:
|
||
# HB1 – Ærter (switch.hojbed_2) – kun hvis tørt
|
||
- if:
|
||
- condition: numeric_state
|
||
entity_id: sensor.annes_havesensor_soil_moisture_1
|
||
below: 40
|
||
then:
|
||
- service: rainbird.start_irrigation
|
||
data:
|
||
entity_id: switch.hojbed_2
|
||
duration: "{{ states('input_number.vanding_varighed_smart') | int(15) }}"
|
||
- delay:
|
||
minutes: "{{ states('input_number.vanding_varighed_smart') | int(15) }}"
|
||
- variables:
|
||
count_hb1: "{{ count_hb1 | int + 1 }}"
|
||
|
||
# HB2 – Kartofler (switch.hojbed_1) – kun hvis tørt
|
||
- if:
|
||
- condition: numeric_state
|
||
entity_id: sensor.annes_havesensor_soil_moisture_2
|
||
below: 40
|
||
then:
|
||
- service: rainbird.start_irrigation
|
||
data:
|
||
entity_id: switch.hojbed_1
|
||
duration: "{{ states('input_number.vanding_varighed_smart') | int(15) }}"
|
||
- delay:
|
||
minutes: "{{ states('input_number.vanding_varighed_smart') | int(15) }}"
|
||
- variables:
|
||
count_hb2: "{{ count_hb2 | int + 1 }}"
|
||
|
||
# HB3 – Rabarber (switch.drivhus_drypvanding) – kun hvis tørt
|
||
- if:
|
||
- condition: numeric_state
|
||
entity_id: sensor.annes_havesensor_soil_moisture_3
|
||
below: 40
|
||
then:
|
||
- service: rainbird.start_irrigation
|
||
data:
|
||
entity_id: switch.drivhus_drypvanding
|
||
duration: "{{ states('input_number.vanding_varighed_smart') | int(15) }}"
|
||
- delay:
|
||
minutes: "{{ states('input_number.vanding_varighed_smart') | int(15) }}"
|
||
- variables:
|
||
count_hb3: "{{ count_hb3 | int + 1 }}"
|
||
|
||
# Send notifikation med resultat
|
||
- variables:
|
||
slut_hb1: "{{ states('sensor.annes_havesensor_soil_moisture_1') | float(0) | round(1) }}"
|
||
slut_hb2: "{{ states('sensor.annes_havesensor_soil_moisture_2') | float(0) | round(1) }}"
|
||
slut_hb3: "{{ states('sensor.annes_havesensor_soil_moisture_3') | float(0) | round(1) }}"
|
||
varighed: "{{ states('input_number.vanding_varighed_smart') | int(15) }}"
|
||
- service: notify.mobile_app_claus_iphone_15pro
|
||
data:
|
||
title: "Vanding afsluttet 🌱"
|
||
message: >
|
||
HB1 Ærter: {{ start_hb1 }}% → {{ slut_hb1 }}% ({{ count_hb1 | int * varighed | int }} min)
|
||
HB2 Kartofler: {{ start_hb2 }}% → {{ slut_hb2 }}% ({{ count_hb2 | int * varighed | int }} min)
|
||
HB3 Rabarber: {{ start_hb3 }}% → {{ slut_hb3 }}% ({{ count_hb3 | int * varighed | int }} min)
|
||
|