# Lernaufbau: manuell gestarteter, lokal begrenzter 30-s-Zyklus. # GPIO26: active-high MOSFET-Treiber, NICHT direkt das Ventil. esphome: name: makershop-garten friendly_name: Makershop Garten on_boot: priority: -100 then: - switch.turn_off: ventil esp32: board: esp32dev framework: type: esp-idf logger: api: encryption: key: !secret garden_api_key ota: - platform: esphome password: !secret garden_ota_password wifi: ssid: !secret wifi_ssid password: !secret wifi_password on_disconnect: then: - script.stop: wasserzyklus - switch.turn_off: ventil globals: - id: messzeit type: uint32_t restore_value: no initial_value: '0' - id: plausibel type: bool restore_value: no initial_value: 'false' sensor: - platform: adc pin: GPIO34 id: boden_spannung name: Boden Signalspannung attenuation: auto update_interval: 5s accuracy_decimals: 2 on_value: then: - lambda: |- id(messzeit) = millis(); id(plausibel) = !isnan(x) && x > 0.05f && x < 2.30f; - if: condition: lambda: 'return !id(plausibel);' then: - script.stop: wasserzyklus - switch.turn_off: ventil switch: - platform: gpio pin: GPIO26 id: ventil internal: true restore_mode: ALWAYS_OFF script: - id: wasserzyklus mode: single then: - if: condition: and: - wifi.connected: - lambda: |- return id(plausibel) && (uint32_t)(millis() - id(messzeit)) < 15000; then: - switch.turn_on: ventil - delay: 30s - switch.turn_off: ventil else: - logger.log: "Start gesperrt: WLAN oder Messsignal pruefen." button: - platform: template name: 30 Sekunden bewaessern on_press: - script.execute: wasserzyklus - platform: template name: Bewaesserung stoppen on_press: - script.stop: wasserzyklus - switch.turn_off: ventil binary_sensor: - platform: template name: Ventil angesteuert lambda: 'return id(ventil).state;' - platform: template name: Messsignal plausibel lambda: |- return id(plausibel) && (uint32_t)(millis() - id(messzeit)) < 15000; interval: - interval: 1s then: - if: condition: lambda: |- return id(ventil).state && (!id(plausibel) || (uint32_t)(millis() - id(messzeit)) >= 15000); then: - script.stop: wasserzyklus - switch.turn_off: ventil