i’m trying to hook up some reed contact that are build in my home.
They came with resistors in it, so i hooked them up to a esp32 and read there analoge value.
now i need to turn on / off a swtich at certain value.
in the log’s it seems to work, but the switch isn’t changing its state in lovelace.
what can i do to see the changes in lovelace.
Next i wan’t to automate my heating, if a door or window is opend longer than x minutes, the heating should be turned off.
here is the config from esphome:
esphome:
name: alarmpanel
platform: ESP32
board: nodemcu-32s
wifi:
ssid: "##########"
password: "#######"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Alarmpanel Fallback Hotspot"
password: "#########"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "#########"
ota:
password: "#########"
switch:
- platform: template
name: "Raam achter"
id: raamachter
- platform: template
name: "Raam voor"
id: raamvoor
- platform: template
name: "Achter deur"
id: achterdeur
- platform: template
name: "Voor deur"
id: voordeur
sensor:
- platform: adc
pin: GPIO36
name: "Raam voor" #ingang 1
attenuation: 11db
update_interval: 5s
on_value_range:
- above: 2.1
then:
- switch.turn_on: raamvoor
- below: 2.0
then:
- switch.turn_off: raamvoor
- platform: adc
pin: GPIO39
name: "Raam achter" #ingang 2
update_interval: 5s
attenuation: 11db
on_value_range:
- above: 2.1
then:
- switch.turn_on: raamachter
- below: 2.0
then:
- switch.turn_off: raamachter
- platform: adc
pin: GPIO34
name: "Achterdeur" #ingang 3
update_interval: 5s
attenuation: 11db
on_value_range:
- above: 2.1
then:
- switch.turn_on: achterdeur
- below: 2.0
then:
- switch.turn_off: achterdeur
- platform: adc
pin: GPIO35
name: "Voordeur" #ingang 4
update_interval: 5s
attenuation: 11db
on_value_range:
- above: 2.1
then:
- switch.turn_on: voordeur
- below: 2.0
then:
- switch.turn_off: voordeur