-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmcu-socket-01.yaml
133 lines (123 loc) · 3.08 KB
/
mcu-socket-01.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
substitutions:
device: socket-01
device_id: socket_01
name: Socket 01
current_res: "0.00290"
voltage_div: "940"
comment: "First floor, Bedroom: TV"
esphome:
name: mcu-${device}
comment: ${comment}
esp8266:
board: esp01_1m
packages:
common: !include common/common_esp8266.yaml
# BlitzWolf BW-SHP2 and BW-SHP6 (ESP8285 - BL0937 or HJL-01 Energy Monitoring)
# Pin Name Function
# GPIO15 GPIO_REL1 Relay
# GPIO13 GPIO_KEY1 Button
# GPIO00 GPIO_LED1_INV Red LED (inverted), Power Status
# GPIO02 GPIO_LEDLNK_INV Blue LED (inverted), Link Status
# GPIO05 GPIO_HJL_CF BL0937 or HJL-01 CF power
# GPIO12 GPIO_NRG_SEL_INV BL0937 or HJL-01 Sel output (0 = Voltage)
# GPIO14 GPIO_NRG_CF1 BL0937 or HJL-01 CF1 current / voltage
# GPIO01 GPIO_USER RXD, Optional sensor
# GPIO03 GPIO_USER TXD, Optional sensor
binary_sensor:
- platform: gpio
pin:
number: GPIO13
mode: INPUT_PULLUP
inverted: yes
name: "${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: "${name} Red LED"
id: light_red
output: led_red
- platform: binary
name: "${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: "${name} Current"
icon: mdi:flash-circle
accuracy_decimals: 3
voltage:
name: "${name} Voltage"
icon: mdi:current-ac
power:
name: "${name} Power"
id: "${device_id}_power"
icon: mdi:flash-outline
update_interval: 30s
change_mode_every: 4
- platform: total_daily_energy
name: "${name} Total Daily Power"
power_id: "${device_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: "${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:
- !include common/time/homeassistant.yaml
# - 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