Files
esphome-configs/mcu-socket-01.yaml
T
randy 1a2aec5d01 Document hardware, pinout and I2C devices in a header comment of every device
Merge the old pinout comment blocks into the header and mark what each pin is used for.
2026-09-29 23:22:17 +02:00

135 lines
3.1 KiB
YAML

---
# Hardware: BlitzWolf BW-SHP2/SHP6
# Pinout:
# GPIO0 GPIO_LED1_INV Red LED (inverted), Power Status -> led_red (output gpio)
# GPIO1 GPIO_USER RXD, Optional sensor
# GPIO2 GPIO_LEDLNK_INV Blue LED (inverted), Link Status -> led_blue (output gpio)
# GPIO3 GPIO_USER TXD, Optional sensor
# GPIO5 GPIO_HJL_CF BL0937 or HJL-01 CF power -> sensor/hlw8012 (sensor hlw8012 cf_pin)
# GPIO12 GPIO_NRG_SEL_INV BL0937 or HJL-01 Sel output (0 = Voltage) -> sensor/hlw8012 (sensor hlw8012 sel_pin) (inverted)
# GPIO13 GPIO_KEY1 Button -> Button (binary_sensor gpio) (inverted)
# GPIO14 GPIO_NRG_CF1 BL0937 or HJL-01 CF1 current / voltage -> sensor/hlw8012 (sensor hlw8012 cf1_pin)
# GPIO15 GPIO_REL1 Relay -> Relay (switch gpio)
substitutions:
device: socket-01
name: Socket 01
area: Bedroom
comment: TV Socket
current_res: "0.00290"
voltage_div: "940"
esphome:
name: mcu-${device}
friendly_name: ${name}
area: ${area}
comment: ${comment}
esp8266:
board: esp01_1m
packages:
common: !include common/common_esp8266.yaml
binary_sensor:
- platform: gpio
pin:
number: GPIO13
mode: INPUT_PULLUP
inverted: yes
name: Button
# 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
output:
- platform: gpio
pin: GPIO00
id: led_red
inverted: True
- platform: gpio
pin: GPIO02
id: led_blue
inverted: True
light:
- platform: binary
name: Red LED
id: light_red
output: led_red
- platform: binary
name: Blue LED
id: light_blue
output: led_blue
sensor:
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: true
cf_pin: GPIO05
cf1_pin: GPIO14
current_resistor: ${current_res}
voltage_divider: ${voltage_div}
current:
name: Current
icon: mdi:flash-circle
accuracy_decimals: 3
voltage:
name: Voltage
icon: mdi:current-ac
power:
name: Power
id: power
icon: mdi:flash-outline
update_interval: 30s
change_mode_every: 4
- platform: total_daily_energy
name: Total Daily Power"
power_id: power
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
unit_of_measurement: kWh
icon: mdi:circle-slice-3
switch:
- platform: gpio
name: Relay
# icon: mdi:power-socket-eu
pin: GPIO15
id: relay
on_turn_on:
- light.turn_on: light_red
on_turn_off:
- light.turn_off: light_red
# status_led:
# pin:
# number: GPIO00
# inverted: True
# time:
# - platform: homeassistant
# timezone: Europe/Bratislava
# on_time:
# # Switch on on the hour
# - seconds: 0
# minutes: /15
# hours: "*"
# then:
# - switch.turn_on: relay_1
# - delay: 12min
# - switch.turn_off: relay_1