236 lines
5.5 KiB
YAML
236 lines
5.5 KiB
YAML
esphome:
|
|
name: gartenlicht-a3
|
|
|
|
esp32:
|
|
board: wemos_d1_mini32
|
|
framework:
|
|
type: esp-idf
|
|
|
|
# Enable logging
|
|
logger:
|
|
|
|
# Enable Home Assistant API
|
|
api:
|
|
encryption:
|
|
key: !secret kGartenlichtA3
|
|
|
|
ota:
|
|
- platform: esphome
|
|
password: !secret pGartenlichtA3
|
|
|
|
wifi:
|
|
ssid: !secret wifi_ssid
|
|
password: !secret wifi_password
|
|
fast_connect: true
|
|
# use_address: gartenlicht_a3
|
|
|
|
|
|
script:
|
|
- id: script_light_1
|
|
then:
|
|
lambda: |-
|
|
bool geb1State = id(sensor_1).state && id(light_1_sensor_1).state;
|
|
bool geb2State = id(sensor_2).state && id(light_1_sensor_2).state;
|
|
bool geb3State = id(sensor_3).state && id(light_1_sensor_3).state;
|
|
|
|
if(geb1State || geb2State || geb3State || id(light_1_always_on).state){
|
|
id(light_1).turn_on();
|
|
} else {
|
|
id(light_1).turn_off();
|
|
}
|
|
- id: script_light_2
|
|
then:
|
|
lambda: |-
|
|
bool geb1State = id(sensor_1).state && id(light_2_sensor_1).state;
|
|
bool geb2State = id(sensor_2).state && id(light_2_sensor_2).state;
|
|
bool geb3State = id(sensor_3).state && id(light_2_sensor_3).state;
|
|
|
|
if(geb1State || geb2State || geb3State || id(light_2_always_on).state){
|
|
id(light_2).turn_on();
|
|
} else {
|
|
id(light_2).turn_off();
|
|
}
|
|
|
|
binary_sensor:
|
|
- platform: gpio
|
|
pin:
|
|
number: D0
|
|
inverted: true
|
|
mode:
|
|
input: true
|
|
pullup: true
|
|
name: "Sensor Garage"
|
|
id: "sensor_1"
|
|
filters:
|
|
- delayed_on: 10ms
|
|
- delayed_off: 50ms
|
|
on_state:
|
|
lambda: |-
|
|
id(script_light_1).execute();
|
|
id(script_light_2).execute();
|
|
- platform: gpio
|
|
pin:
|
|
number: D5
|
|
inverted: true
|
|
mode:
|
|
input: true
|
|
pullup: true
|
|
name: "Sensor Terasse"
|
|
id: "sensor_2"
|
|
filters:
|
|
- delayed_on: 10ms
|
|
- delayed_off: 50ms
|
|
on_state:
|
|
lambda: |-
|
|
id(script_light_1).execute();
|
|
id(script_light_2).execute();
|
|
- platform: gpio
|
|
pin:
|
|
number: D6
|
|
inverted: true
|
|
mode:
|
|
input: true
|
|
pullup: true
|
|
name: "Sensor Nici"
|
|
id: "sensor_3"
|
|
filters:
|
|
- delayed_on: 10ms
|
|
- delayed_off: 50ms
|
|
on_state:
|
|
lambda: |-
|
|
id(script_light_1).execute();
|
|
id(script_light_2).execute();
|
|
|
|
|
|
output:
|
|
- platform: gpio
|
|
pin: D1
|
|
id: light_1
|
|
- platform: gpio
|
|
pin: D2
|
|
id: light_2
|
|
|
|
switch:
|
|
- platform: template
|
|
name: L1 Garage
|
|
id: light_1_sensor_1
|
|
optimistic: true
|
|
restore_mode: RESTORE_DEFAULT_ON
|
|
on_turn_on:
|
|
then:
|
|
script.execute: script_light_1
|
|
on_turn_off:
|
|
then:
|
|
script.execute: script_light_1
|
|
- platform: template
|
|
name: L1 Terasse
|
|
id: light_1_sensor_2
|
|
optimistic: true
|
|
restore_mode: RESTORE_DEFAULT_ON
|
|
on_turn_on:
|
|
then:
|
|
script.execute: script_light_1
|
|
on_turn_off:
|
|
then:
|
|
script.execute: script_light_1
|
|
- platform: template
|
|
name: L1 Nici
|
|
id: light_1_sensor_3
|
|
optimistic: true
|
|
restore_mode: RESTORE_DEFAULT_ON
|
|
on_turn_on:
|
|
then:
|
|
script.execute: script_light_1
|
|
on_turn_off:
|
|
then:
|
|
script.execute: script_light_1
|
|
- platform: template
|
|
name: L1 Dauer
|
|
id: light_1_always_on
|
|
optimistic: true
|
|
restore_mode: RESTORE_DEFAULT_OFF
|
|
on_turn_on:
|
|
then:
|
|
script.execute: script_light_1
|
|
on_turn_off:
|
|
then:
|
|
script.execute: script_light_1
|
|
|
|
- platform: template
|
|
name: L2 Garage
|
|
id: light_2_sensor_1
|
|
optimistic: true
|
|
restore_mode: RESTORE_DEFAULT_ON
|
|
on_turn_on:
|
|
then:
|
|
script.execute: script_light_2
|
|
on_turn_off:
|
|
then:
|
|
script.execute: script_light_2
|
|
- platform: template
|
|
name: L2 Terasse
|
|
id: light_2_sensor_2
|
|
optimistic: true
|
|
restore_mode: RESTORE_DEFAULT_ON
|
|
on_turn_on:
|
|
then:
|
|
script.execute: script_light_2
|
|
on_turn_off:
|
|
then:
|
|
script.execute: script_light_2
|
|
- platform: template
|
|
name: L2 Nici
|
|
id: light_2_sensor_3
|
|
optimistic: true
|
|
restore_mode: RESTORE_DEFAULT_ON
|
|
on_turn_on:
|
|
then:
|
|
script.execute: script_light_2
|
|
on_turn_off:
|
|
then:
|
|
script.execute: script_light_2
|
|
- platform: template
|
|
name: L2 Dauer
|
|
id: light_2_always_on
|
|
optimistic: true
|
|
restore_mode: RESTORE_DEFAULT_OFF
|
|
on_turn_on:
|
|
then:
|
|
script.execute: script_light_2
|
|
on_turn_off:
|
|
then:
|
|
script.execute: script_light_2
|
|
|
|
button:
|
|
- platform: template
|
|
name: "Standard"
|
|
on_press:
|
|
lambda: |-
|
|
id(light_1_sensor_1).turn_on();
|
|
id(light_1_sensor_2).turn_on();
|
|
id(light_1_sensor_3).turn_on();
|
|
id(light_1_always_on).turn_off();
|
|
|
|
id(light_2_sensor_1).turn_on();
|
|
id(light_2_sensor_2).turn_on();
|
|
id(light_2_sensor_3).turn_on();
|
|
id(light_2_always_on).turn_off();
|
|
- platform: template
|
|
name: "Always On"
|
|
on_press:
|
|
lambda: |-
|
|
id(light_1_always_on).turn_on();
|
|
id(light_2_always_on).turn_on();
|
|
- platform: template
|
|
name: "All Off"
|
|
on_press:
|
|
lambda: |-
|
|
id(light_1_sensor_1).turn_off();
|
|
id(light_1_sensor_2).turn_off();
|
|
id(light_1_sensor_3).turn_off();
|
|
id(light_1_always_on).turn_off();
|
|
|
|
id(light_2_sensor_1).turn_off();
|
|
id(light_2_sensor_2).turn_off();
|
|
id(light_2_sensor_3).turn_off();
|
|
id(light_2_always_on).turn_off(); |