forked from barrenechea/esphome-config-files
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sonoff-powr2-00139037f2.yaml
89 lines (75 loc) · 1.91 KB
/
sonoff-powr2-00139037f2.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
substitutions:
devicename: Sonoff POWR2
deviceserial: 00139037F2
esphome:
name: sonoff-powr2-00139037f2
esp8266:
board: esp8285
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: ${devicename} ${deviceserial}
password: hJ3hJJCSlslr
captive_portal:
# Make sure logging is not using the serial port
logger:
baud_rate: 0
# Enable Home Assistant API
api:
encryption:
key: !secret api_encryption_key
ota:
password: !secret ota_password
# Enable ESPHome status output though green LED
status_led:
pin:
number: GPIO13
inverted: True
uart:
rx_pin: RX
baud_rate: 4800
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: ${devicename} ${deviceserial} Button
internal: true
on_press:
- switch.toggle: relay
sensor:
- platform: wifi_signal
name: ${devicename} ${deviceserial} WiFi Signal
update_interval: 60s
- platform: cse7766
update_interval: 1s
current:
name: ${devicename} ${deviceserial} Current
voltage:
name: ${devicename} ${deviceserial} Voltage
power:
id: sonoff_power
name: ${devicename} ${deviceserial} Power
filters:
# Multiplication factor from W to kW is 0.001
# Done so it can be measured through HA's Household consumption
- multiply: 0.001
unit_of_measurement: kW
accuracy_decimals: 4
- platform: total_daily_energy
name: ${devicename} ${deviceserial} Total Daily Energy
power_id: sonoff_power
switch:
- platform: gpio
name: ${devicename} ${deviceserial} Relay
pin: GPIO12
id: relay
- platform: restart
name: ${devicename} ${deviceserial} Restart
# Enable time component to reset energy at midnight
time:
- platform: sntp # could be platform: homeassistant
timezone: America/Santiago