mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-10-14 16:35:12 +02:00
Merge the old pinout comment blocks into the header and mark what each pin is used for.
153 lines
3.6 KiB
YAML
153 lines
3.6 KiB
YAML
---
|
|
# Hardware: Sonoff Dual R2
|
|
# Pinout:
|
|
# GPIO0 Pin "button 0" on expansion header -> Light Switch (binary_sensor gpio) (inverted)
|
|
# GPIO5 Relay #2 and green color on LED -> Socket 1 (switch gpio)
|
|
# GPIO9 Pin "button 1" on expansion header -> Door (binary_sensor gpio) (inverted)
|
|
# GPIO10 Push Button -> Socket 1 Switch (binary_sensor gpio) (inverted)
|
|
# GPIO12 Relay #1 and red color on LED -> Sewage Treatment Aerator Pump [relay_1] (switch gpio)
|
|
# GPIO13 Blue Status LED -> status_led (status_led) (inverted)
|
|
substitutions:
|
|
device: basement
|
|
name: Basement
|
|
area: Basement
|
|
comment: Sockets
|
|
|
|
esphome:
|
|
name: mcu-${device}
|
|
friendly_name: ${name}
|
|
area: ${area}
|
|
comment: ${comment}
|
|
|
|
esp8266:
|
|
board: esp01_1m
|
|
|
|
packages:
|
|
common: !include common/common_esp8266.yaml
|
|
|
|
globals:
|
|
- id: aerator_auto
|
|
type: bool
|
|
restore_value: true
|
|
initial_value: "true"
|
|
|
|
binary_sensor:
|
|
- platform: gpio
|
|
pin:
|
|
number: 0
|
|
mode: INPUT_PULLUP
|
|
inverted: True
|
|
name: Light Switch
|
|
device_class: light
|
|
on_click:
|
|
- min_length: 50ms
|
|
max_length: 350ms
|
|
then:
|
|
- homeassistant.action:
|
|
action: light.toggle
|
|
data:
|
|
entity_id: light.mcu_basement_2_light
|
|
- min_length: 351ms
|
|
max_length: 1000ms
|
|
then:
|
|
- homeassistant.action:
|
|
action: light.toggle
|
|
data:
|
|
entity_id: light.exercise_room
|
|
- min_length: 1001ms
|
|
max_length: 10000ms
|
|
then:
|
|
# - homeassistant.service:
|
|
# service: light.turn_off
|
|
# data:
|
|
# entity_id: light.basement_light
|
|
- homeassistant.action:
|
|
action: light.turn_off
|
|
data:
|
|
entity_id: light.exercise_room
|
|
- homeassistant.action:
|
|
action: light.turn_off
|
|
data:
|
|
entity_id: light.exercise_room_fan
|
|
- platform: gpio
|
|
pin:
|
|
number: 10
|
|
mode: INPUT_PULLUP
|
|
inverted: true
|
|
name: Socket 1 Switch
|
|
on_press:
|
|
- switch.toggle: relay_2
|
|
- platform: gpio
|
|
pin:
|
|
number: 9
|
|
mode: INPUT_PULLUP
|
|
inverted: true
|
|
name: Door
|
|
device_class: door
|
|
filters:
|
|
invert:
|
|
on_press:
|
|
- homeassistant.action:
|
|
action: light.turn_on
|
|
data:
|
|
entity_id: light.mcu_basement_2_light
|
|
|
|
select:
|
|
- platform: template
|
|
name: Sewage Treatment Aerator Pump
|
|
icon: mdi:hair-dryer-outline
|
|
optimistic: true
|
|
options:
|
|
- "ON"
|
|
- "AUTO"
|
|
- "OFF"
|
|
initial_option: "AUTO"
|
|
restore_value: true
|
|
on_value:
|
|
then:
|
|
- lambda: |-
|
|
switch (i) {
|
|
case 0: {
|
|
id(aerator_auto) = false;
|
|
id(relay_1).turn_on();
|
|
} break;
|
|
case 1: {
|
|
id(aerator_auto) = true;
|
|
} break;
|
|
case 2:
|
|
id(aerator_auto) = false;
|
|
id(relay_1).turn_off();
|
|
}
|
|
|
|
status_led:
|
|
pin:
|
|
number: 13
|
|
inverted: yes
|
|
|
|
switch:
|
|
- platform: gpio
|
|
name: Sewage Treatment Aerator Pump
|
|
icon: mdi:hair-dryer-outline
|
|
pin: 12
|
|
id: relay_1
|
|
restore_mode: ALWAYS_ON
|
|
- platform: gpio
|
|
name: Socket 1
|
|
icon: mdi:power-socket-fr
|
|
pin: 5
|
|
id: relay_2
|
|
|
|
time:
|
|
- id: !extend ha_time
|
|
on_time:
|
|
- seconds: 0
|
|
minutes: /15
|
|
then:
|
|
- if:
|
|
condition:
|
|
lambda: 'return id(aerator_auto);'
|
|
then:
|
|
- switch.turn_on: relay_1
|
|
- delay: 12min
|
|
- switch.turn_off: relay_1
|