-
Notifications
You must be signed in to change notification settings - Fork 0
/
blitzwolf-ambilight-amplifier.yaml
200 lines (188 loc) · 4.74 KB
/
blitzwolf-ambilight-amplifier.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
substitutions:
device_name: Blitzwolf Ambilight Amplifier
espname: "blitzwolf-ambilight-amplifier"
short_name: bw-ambilight-ampl
# Higher value gives lower watt readout
current_res: '0.002291'
# Lower value gives lower voltage readout
voltage_div: '940'
# BW-SHP7, dual outlet with powermonitoring.
# One button for each relay, and one red led for each relay, as well as a blue status led
# Static IP is configured, and fast_connect is enabled, as the SSID is hidden
# Webserver is active and pw protected, and the OTA is password protected
esphome:
name: '${espname}'
comment: 'Blitzwolf SHP7'
esp8266:
board: esp8285
wifi:
use_address: 10.0.30.143
packages:
wifi: !include
file: common/wifi.yaml
vars:
device_name: ${short_name}
network_diagnostics: !include common/network_diagnostics.yaml
base_config: !include common/base_config.yaml
# Button configuration
binary_sensor:
- platform: gpio
id: button1
name: button1
internal: true
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: true
on_press:
- switch.toggle: relay1
- platform: gpio
id: button2
name: button2
internal: true
pin:
number: GPIO12
mode: INPUT_PULLUP
inverted: true
on_press:
- switch.toggle: relay2
- platform: gpio
pin: GPIO15
id: gpio15_irq
internal: true
# Setup of LED's used in displaying LED status
output:
- platform: esp8266_pwm
id: led1
pin:
number: GPIO13
inverted: true
- platform: esp8266_pwm
id: led2
pin:
number: GPIO2
inverted: true
# Config for switches
switch:
- platform: gpio
pin: GPIO14
id: relay1
name: 'relay1' #Used for Ambilight
on_turn_on:
- output.turn_on: led1
on_turn_off:
- output.turn_off: led1
- platform: gpio
pin: GPIO16
id: relay2
name: 'relay2' #Used for Amplifier
on_turn_on:
- output.turn_on: led2
on_turn_off:
- output.turn_off: led2
# Status LED for connection
status_led:
pin:
number: GPIO01
inverted: true
# Sensors for WIFI signal strength, Uptime, Voltage, Current, Power, Daily energy usage
sensor:
- platform: hlw8012
sel_pin:
number: GPIO03
inverted: true
cf_pin: GPIO04
cf1_pin: GPIO05
current_resistor: ${current_res}
voltage_divider: ${voltage_div}
current:
name: '${device_name} current'
unit_of_measurement: 'A'
accuracy_decimals: 2
icon: mdi:flash-outline
id: current
filters:
- or:
- throttle_average: 60s
- delta: 0.1
voltage:
name: '${device_name} voltage'
unit_of_measurement: 'V'
icon: mdi:flash-outline
id: voltage
accuracy_decimals: 1
filters:
- or:
- throttle_average: 60s
- delta: 1
power:
name: '${device_name} power'
unit_of_measurement: 'W'
id: power
accuracy_decimals: 0
filters:
- or:
- throttle_average: 60s
- delta: 5
icon: mdi:flash-outline
energy:
name: "${device_name} Energy"
unit_of_measurement: "kWh"
icon: mdi:flash-outline
filters:
- multiply: 0.001 #From Wh to kWh.
- or:
- throttle_average: 60s
- delta: 0.1
change_mode_every: 4
update_interval: 1s
- platform: total_daily_energy #I think this sensor can be removed?
name: '${device_name} daily energy'
power_id: power
unit_of_measurement: kWh
accuracy_decimals: 5
filters:
- multiply: 0.001 #From Wh to kWh.
- platform: template
name: "${device_name} Apparent Power"
lambda: |-
return id(voltage).state * id(current).state;
update_interval: 1s
device_class: apparent_power
unit_of_measurement: "VA"
id: apparent_power
filters:
- or:
- throttle_average: 60s
- delta: 2.0
- platform: template
name: "${device_name} Power Factor"
lambda: |-
if (round(id(power).state) == 0) {
return 0;
} else {
return id(power).state / id(voltage).state / id(current).state;
}
update_interval: 1s
device_class: power_factor
id: power_factor
filters:
- or:
- throttle_average: 60s
- delta: 0.1
- platform: template
name: "${device_name} Reactive Power"
lambda: |-
if (pow(id(voltage).state * id(current).state, 2) <= pow(id(power).state, 2)) {
return 0;
} else {
return sqrt(pow(id(voltage).state * id(current).state, 2) - pow(id(power).state, 2));
}
update_interval: 1s
device_class: reactive_power
unit_of_measurement: "var"
id: reactive_power
filters:
- or:
- throttle_average: 60s
- delta: 2.0