-
Notifications
You must be signed in to change notification settings - Fork 3
/
media_power_strip.yaml
109 lines (95 loc) · 2.03 KB
/
media_power_strip.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
substitutions:
name: Media Power Strip
esphome:
name: media_power_strip
platform: ESP8266
esp8266_restore_from_flash: true
board: esp01_1m
on_boot:
then:
- switch.turn_on: blue_led
on_shutdown:
then:
- switch.turn_off: blue_led
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_psk
api:
logger:
ota:
status_led:
pin:
number: GPIO3
inverted: true
binary_sensor:
- platform: gpio
id: button
pin:
number: GPIO5
mode: INPUT_PULLUP
inverted: true
on_multi_click:
- timing:
- ON for 1s to 4s
- OFF for at least 0.5s
then:
- logger.log: "Single Long Clicked"
- switch.turn_off: usb_relay
- delay: 500ms
- switch.turn_off: plug_1_relay
- delay: 500ms
- switch.turn_off: plug_2_relay
- delay: 500ms
- switch.turn_off: plug_3_relay
- delay: 500ms
- switch.turn_off: plug_4_relay
- timing:
- ON for at most 1s
- OFF for at least 0.5s
then:
- logger.log: "Single Short Clicked"
- switch.turn_on: usb_relay
- delay: 500ms
- switch.turn_on: plug_1_relay
- delay: 500ms
- switch.turn_on: plug_2_relay
- delay: 500ms
- switch.turn_on: plug_3_relay
- delay: 500ms
- switch.turn_on: plug_4_relay
- platform: status
name: "$name Status"
switch:
- platform: gpio
id: blue_led
pin:
number: GPIO0
inverted: true
- platform: gpio
id: usb_relay
name: "$name USB Ports"
pin: GPIO16
- platform: gpio
id: plug_1_relay
name: "$name Plug 1"
pin:
number: GPIO4
inverted: true
- platform: gpio
id: plug_2_relay
name: "$name Plug 2"
pin:
number: GPIO13
inverted: true
- platform: gpio
id: plug_3_relay
name: "$name Plug 3"
pin:
number: GPIO12
inverted: true
- platform: gpio
id: plug_4_relay
name: "$name Plug 4"
pin:
number: GPIO14
inverted: true