-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sonoff POW - Switch template with power monitoring
117 lines (98 loc) · 2.1 KB
/
Sonoff POW - Switch template with power monitoring
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
substitutions:
name: "{{name of the device}}"
friendly_name: "{{friendly name}}"
esphome:
name: "${name}"
friendly_name: "${friendly_name}"
project:
name: esphome.sonoff_s20_light-template
version: "1.0"
esp8266:
board: sonoff_s20
restore_from_flash: true
preferences:
flash_write_interval: 0s
logger:
api:
encryption:
key: !secret api_encryption_key
ota:
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
password: !secret ap_password
captive_portal:
web_server:
port: 80
auth:
username: !secret web_server_username
password: !secret web_server_password
version: 2
local: true
text_sensor:
- platform: wifi_info
ip_address:
name: WiFi - IP-address
ssid:
name: WiFi - Connected SSID
bssid:
name: WiFi - Connected BSSID
mac_address:
name: WiFi - MAC-address
scan_results:
name: WiFi - Latest Scan Results
dns_address:
name: WiFi - DNS Address
sensor:
- platform: wifi_signal
name: "WiFi - Signal"
update_interval: 60s
entity_category: "diagnostic"
### EDIT BELOW THIS LINE ###
- platform: total_daily_energy
name: 'Device - Power (daily)'
power_id: sonoff_pow_power
unit_of_measurement: 'kWh'
state_class: total_increasing
device_class: energy
accuracy_decimals: 3
filters:
# Multiplication factor from W to kW is 0.001
multiply: 0.001
- platform: hlw8012
sel_pin: 5
cf_pin: 14
cf1_pin: 13
update_interval: 2s
current:
name: Device - Current
voltage:
name: Device - Voltage
power:
name: Device - Power
id: sonoff_pow_power
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: Device - Button
on_press:
- switch.toggle: relay
switch:
- platform: gpio
pin: GPIO12
name: Device - Relay
id: relay
- platform: restart
name: "Device - Restart"
status_led:
pin:
number: GPIO15
inverted: true
time:
- platform: homeassistant
id: homeassistant_time