Files
esphome-configs/mcu-staircase-light.yaml
T
randy 3374ed6ad8
CI / ESPHome config validation (push) Failing after 5s
CI / YAML lint (push) Failing after 19s
staircase-light: add second PIR sensor
2026-10-10 17:50:24 +02:00

87 lines
1.8 KiB
YAML

---
# Hardware: Sonoff Mini
# Pinout:
# GPIO12 -> relay (output gpio)
# GPIO13 -> led_blue (output gpio)
substitutions:
device: staircase-light
name: Staircase
area: Staircase
comment: Light
esphome:
name: mcu-${device}
friendly_name: ${name}
area: ${area}
comment: ${comment}
esp8266:
board: esp01_1m
packages:
common: !include common/common_esp8266.yaml
mdns_ipv6: !include common/esp8266_mdns_ipv6.yaml
# wifi:
# use_address: mcu-mini-04.local
binary_sensor:
# - platform: gpio
# pin:
# number: GPIO4
# mode: INPUT_PULLUP
# inverted: yes
# name: "${name} PIR"
# device_class: motion
# filters:
# invert:
# on_press:
# # min_length: 50ms
# # max_length: 350ms
# then:
# - switch.toggle: relay
# on_double_click:
# # min_length: 50ms
# # max_length: 350ms
# then:
# - switch.turn_on: relay
# - light.turn_on: light_blue
# - delay: 2h
# - switch.turn_off: relay
# - light.turn_off: light_blue
- platform: homeassistant
id: motion
entity_id: binary_sensor.zigbee_staircase_pir_occupancy
on_state:
if:
condition: &no_motion
and:
- binary_sensor.is_off: motion
- binary_sensor.is_off: motion_2
then:
- light.turn_off: light_relay
- platform: homeassistant
id: motion_2
entity_id: binary_sensor.zigbee_staircase_2_pir_occupancy
on_state:
if:
condition: *no_motion
then:
- light.turn_off: light_relay
output:
- platform: gpio
pin: GPIO13
id: led_blue
inverted: True
- platform: gpio
pin: GPIO12
id: relay
light:
- platform: binary
name: Light
id: light_relay
output: relay
restore_mode: ALWAYS_ON