Hello,
I am currently trying out ESPHome, I would like to use it for my irrigation.
The structure is that a 4-way relay board makes four switching processes.
a) Irrigation according to the schedule, the Relay1 (power supply 12V DC) should be switched on every day at a desired time, after 2 seconds a (Relay2) solenoid valve should be switched, switch-off vice versa.
The same with the second solenoid valve (Relay3) as well.
In addition, there are two actuators for each solenoid valve, with a shutdown logic (long button press)
It switches on but no longer off …
I have a relatively unstable WiFi in the greenhouse, so it should work independently of the home assistant.
Can someone look over my code to see if I have an obvious mistake?
Thanks!!!
Gerald
esphome:
name: arrosoir
comment: Bewässerung im Treibhaus
platform: ESP8266
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Regenmaster Fallback Hotspot"
password: "ZSH3jEUeIAZF"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
mqtt:
broker: !secret mqtt_broker
username: !secret mqtt_user
password: !secret mqtt_password
web_server:
port: 80
sensor:
- platform: wifi_signal
name: "WiFi Signal Sensor"
update_interval: 30s
- platform: dallas
address: 0x5E00000535651F28
name: "Treibhaus"
text_sensor:
- platform: wifi_info
ip_address:
name: IP
##Pinbelegung der Platine
## GPIO0 PU Taster 1
## GPI04
## GPIO5
## GPIO15 PD
## GPIO2 PU Taster2
## GPIO3 RX 1Wire
## GPIO1 TX
## GPIO12 Relay3
## GPIO13 Relay4
## GPIO14 Relay2
## GPIO16 Relay1
## Zeiteinstellung und Timer
time:
- platform: homeassistant
id: homeassistant_time
on_time:
## Bewässerungsstrang 1
- seconds: 0
minutes: 00
hours: 4
days_of_week: MON-SUN
then:
- switch.turn_on: b1
## Bewässerungsstrang 2
- seconds: 0
minutes: 05
hours: 5
days_of_week: MON-SUN
then:
- switch.turn_on: b2
## Dachbelüftung
- seconds: 0
minutes: /40
then:
- switch.turn_on: rel4
- delay: 15min
- switch.turn_off: rel4
## Taster 1 und 2
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "Bewässerung 1 manuell"
on_press:
then:
- switch.toggle: b1
on_click:
min_length: 2s
max_length: 4s
then:
- switch.turn_off: rel2
- delay: 2s
- switch.turn_off: rel1
- platform: gpio
pin:
number: GPIO2
mode: INPUT_PULLUP
inverted: True
name: "Bewässerung 2 manuell"
on_press:
then:
- switch.toggle: b2
on_click:
min_length: 2s
max_length: 4s
then:
- switch.turn_off: rel3
- delay: 2s
- switch.turn_off: rel1
## Ausgangsschalter (Relais)
switch:
- platform: gpio
name: "12V Versorgung"
id: "rel1"
pin: GPIO16
- platform: gpio
name: "Strang 1"
icon: "mdi:valve-open"
id: "rel2"
pin: GPIO14
- platform: gpio
name: "Strang 2"
icon: "mdi:valve-open"
id: "rel3"
pin: GPIO12
- platform: gpio
name: "Dachbelüftung"
icon: "mdi:fan"
id: "rel4"
pin: GPIO13
## Automaten
- platform: template
name: "Bewässerung 1"
id: "b1"
icon: "mdi:watering-can-outline"
turn_on_action:
- switch.turn_on: rel1
- delay: 2s
- switch.turn_on: rel2
- delay: 15min
- switch.turn_off: rel2
- delay: 3s
- switch.turn_off: rel1
- platform: template
name: "Bewässerung 2"
id: "b2"
icon: "mdi:watering-can-outline"
turn_on_action:
- switch.turn_on: rel1
- delay: 2s
- switch.turn_on: rel3
- delay: 15min
- switch.turn_off: rel3
- delay: 3s
- switch.turn_off: rel1
## 1Wire Sensoren
dallas:
- pin: GPIO3
-lk-