esphome/gartenhaus_taster_input.yaml

185 lines
4.0 KiB
YAML
Raw Normal View History

2023-08-22 14:15:17 +02:00
esphome:
name: gartenhaus-taster-input
esp32:
board: esp32-poe
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret api_encryption_key
ota:
password: !secret ota_password
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
power_pin: GPIO12
globals:
- id: taster_oben_state
type: int
restore_value: yes
initial_value: '0'
binary_sensor:
- platform: gpio
name: "gartenhaus_lichtschalter_gross"
filters:
- invert:
- delayed_on: 10ms
pin:
number: 4
mode:
input: true
pullup: true
device_class: LIGHT
on_press:
then:
- if:
condition:
lambda: 'return (id(taster_oben_state) == 0);'
then:
- globals.set:
id: taster_oben_state
value: '1'
- homeassistant.service:
service: scene.turn_on
data:
entity_id: scene.garten_farbig
else:
- globals.set:
id: taster_oben_state
value: '0'
- homeassistant.service:
service: scene.turn_on
data:
entity_id: scene.garten_aus
- platform: gpio
name: "gartenhaus_lichtschalter_klein_links"
filters:
- invert:
- delayed_on: 10ms
pin:
number: 15
mode:
input: true
pullup: true
device_class: LIGHT
on_press:
homeassistant.service:
service: script.esphome_light_toggle
data:
light_name: "light.gartenhaus_deckenlicht_mitte, light.gartenhaus_deckenlicht_hinten"
transition: "0"
red: "0"
blue: "0"
green: "0"
white: "255"
- platform: gpio
name: "gartenhaus_lichtschalter_klein_rechts"
filters:
- invert:
- delayed_on: 10ms
pin:
number: 16
mode:
input: true
pullup: true
device_class: LIGHT
on_press:
homeassistant.service:
service: script.esphome_light_toggle
data:
light_name: "light.gartenhaus_deckenlicht_vorne"
transition: "0"
red: "0"
blue: "0"
green: "0"
white: "255"
- platform: gpio
name: "gartenhaus_taster1"
filters:
- invert:
- delayed_on: 10ms
pin:
number: 14
mode:
input: true
pullup: true
device_class: LIGHT
- platform: gpio
name: "gartenhaus_taster2"
filters:
- invert:
- delayed_on: 10ms
pin:
number: 13
mode:
input: true
pullup: true
device_class: LIGHT
- platform: gpio
name: "gartenhaus_taster3"
filters:
- invert:
- delayed_on: 10ms
pin:
number: 2
mode:
input: true
pullup: true
device_class: LIGHT
- platform: gpio
name: "gartenhaus_taster4"
filters:
- invert:
- delayed_on: 10ms
pin:
number: 5
mode:
input: true
pullup: true
device_class: LIGHT
#on_multi_click:
# - timing:
# - ON for at most 1s
# - OFF for at most 0.3s
# - ON for at most 1s
# - OFF for at least 0.2s
# then:
# - homeassistant.event:
# event: esphome.gartenhaus_lichtschalter_gross_doubleclick
# - homeassistant.service:
# service: light.toggle
# data:
# entity_id: light.gartenhaus_deckenlicht_mitte
# - timing:
# - ON for at most 1s
# - OFF for at least 0.5s
# then:
# - homeassistant.event:
# event: esphome.gartenhaus_lichtschalter_gross_click
# - homeassistant.service:
# service: light.toggle
# data:
# entity_id: light.gartenhaus_deckenlicht_hinten