-
Notifications
You must be signed in to change notification settings - Fork 0
/
sonoff_s31.yaml
119 lines (103 loc) · 2.63 KB
/
sonoff_s31.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
esphome:
name: "plug-1" #prepended to every entity name
friendly_name: "plug-1" #if friendly name is set, the friendly name is prepended to entity friendly name
comment: "Sonoff: V1.02 - default on"
substitutions:
update_interval: 10s #power data update interval
esp8266:
board: esp01_1m
# Enable Home Assistant API
api:
encryption:
key: "your new random key"
ota:
password: "whatever you want"
# ******************************** Device Specific Config ********************************
# Enable logging
logger:
baud_rate: 0 # (UART logging interferes with cse7766)
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "S31 Fallback Hotspot"
password: "fallback"
captive_portal:
preferences:
flash_write_interval: "24h" #save flash write cycles
uart:
rx_pin: RX
baud_rate: 4800
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: Button
internal: True
on_press:
- switch.toggle: relay
- platform: status
name: Status
sensor:
- platform: wifi_signal
name: WiFi Signal
update_interval: 60s
- platform: cse7766
current:
name: Current
state_class: measurement
device_class: current
accuracy_decimals: 2
filters:
- throttle_average: ${update_interval}
voltage:
name: Voltage
state_class: measurement
device_class: voltage
accuracy_decimals: 1
filters:
- throttle_average: ${update_interval}
power:
name: Power
state_class: measurement
device_class: power
accuracy_decimals: 2
id: my_power
filters:
- throttle_average: ${update_interval}
#apparent_power:
# name: Apparent Power
# state_class: measurement
# device_class: apparent_power
# accuracy_decimals: 2
# filters:
# - throttle_average: ${update_interval}
#power_factor:
# name: Power Factor
# state_class: measurement
# device_class: power_factor
# accuracy_decimals: 2
# filters:
# - throttle_average: ${update_interval}
- platform: total_daily_energy
name: Daily Energy
power_id: my_power
method: left
state_class: total_increasing
device_class: energy
accuracy_decimals: 2
switch:
- platform: gpio
name: Relay
icon: "mdi:power-socket-us"
pin: GPIO12
id: relay
restore_mode: ALWAYS_ON # ************* Choose this wisely!!!! Depends on application
time:
- platform: homeassistant
id: my_time
status_led:
pin: GPIO13