Good Morning,
i need help with these Code. The automatic temperature control should only work if the automatic switch is turned on. Is the code correct?
esphome:
name: "Steuerung Luftaustausch"
friendly_name: steuerung_luftaustausch
platform: ESP8266
board: nodemcuv2
#logging, wifi etc.
# IRF520 Mosfet
output:
- platform: esp8266_pwm
pin: D5
frequency: 16000 Hz
id: pwm_fan
# Fan
fan:
- platform: speed
output: fridge_fans
name: ${friendly_name} Lüfter
id: fan
sensor:
# Temperature Sensor
- platform: dht
pin: GPIO2
update_interval: 5s
temperature:
name: ${friendly_name} Temp
id: sensor_temp
on_value_range:
then:
- if:
condition:
and:
- switch.is_on: automatic
- below: 25.0
then:
- fan.turn_off: fan
- if:
condition:
and:
- switch.is_on: automatic
- above: 25.1
below: 27.0
then:
- switch.turn_on: fan_low
- if:
condition:
and:
- switch.is_on: automatic
- above: 27.1
below: 29.0
then:
- switch.turn_on: fan_med
- if:
condition:
and:
- switch.is_on: automatic
- above: 29
then:
- switch.turn_on: fan_hig
humidity:
name: ${friendly_name} Hum
# Fan Speed
switch:
- platform: template
name: ${friendly_name} Automatik
id: automatic
- platform: template
id: fan_low
turn_on_action:
- fan.turn_on:
id: fan
speed: LOW
- platform: template
id: fan_med
turn_on_action:
- fan.turn_on:
id: fan
speed: MEDIUM
- platform: template
id: fan_hig
turn_on_action:
- fan.turn_on:
id: fan
speed: HIGH