-
Notifications
You must be signed in to change notification settings - Fork 0
/
server_switch.yaml
91 lines (79 loc) · 1.8 KB
/
server_switch.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
substitutions:
devicename: server_switch
esphome:
name: ${devicename}
platform: ESP8266
board: esp8285
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: !secret server_switch_ip
gateway: !secret gateway
subnet: !secret subnet
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
time:
- platform: homeassistant
id: homeassistant_time
binary_sensor:
- platform: gpio
pin:
number: GPIO0
inverted: True
name: "${devicename}_button"
on_press:
- switch.toggle: led
- switch.toggle: relay
switch:
- platform: gpio
id: relay
name: "${devicename}_Relay"
pin: GPIO14
restore_mode: ALWAYS_ON
on_turn_on:
- switch.turn_on: led
on_turn_off:
- switch.turn_off: led
- platform: gpio
id: led
name: "${devicename}_LED_Red"
pin: GPIO13
inverted: True
restore_mode: ALWAYS_ON
sensor:
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: True
cf_pin: GPIO04
cf1_pin: GPIO05
# Higher value gives lower watt readout
current_resistor: 0.0021879
# Lower value gives lower voltage readout
voltage_divider: 780
current:
name: "${devicename}_Amperage"
unit_of_measurement: A
voltage:
name: "${devicename}_Voltage"
unit_of_measurement: V
power:
name: "${devicename}_Wattage"
unit_of_measurement: W
id: "${devicename}_Wattage"
change_mode_every: 8
update_interval: 10s
- platform: total_daily_energy
name: "${devicename}_Total Daily Energy"
power_id: "${devicename}_Wattage"
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
unit_of_measurement: kWh
# Extra sensor to keep track of plug uptime
- platform: uptime
name: ${devicename}_Uptime Sensor