-
Notifications
You must be signed in to change notification settings - Fork 0
/
2_gang_switch.yaml
141 lines (122 loc) · 2.8 KB
/
2_gang_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
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
############# User configuration #############
substitutions:
# nodemcuv2 board
board: nodemcuv2
sub_name: kitchen
pin_gang_1: D0 #GPIO16
pin_gang_2: D5 #GPIO14
pin_receiver_data: D2 #GPIO4
determine_change_state: 50ms
# pin_led_blue: D4
# Wifi credentials
wifi_ssid: !secret wifi_ssid
wifi_password: !secret wifi_password
ip_address: !secret ip_address
ap_ssid: "vHomeSwitch"
ap_password: "1234567890"
# OTA and API
ota_password: "esphome"
api_password: "esphome"
########### End user configuration ###########
esphome:
name: vhomeswitch
platform: ESP8266
board: $board
wifi:
ssid: $wifi_ssid
password: $wifi_password
# use_address: $ip_address
fast_connect: on
ap:
ssid: $ap_ssid
password: $ap_password
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
web_server:
port: 80
binary_sensor:
- platform: status
name: "RF Switch Status"
- platform: gpio
name: "Gang1"
id: change_gang_1
pin:
number: $pin_gang_1
mode: INPUT_PULLUP
inverted: False
# filters:
# delayed_off: $determine_change_state
on_press:
then:
- switch.turn_on: line_1
on_release:
then:
- switch.turn_off: line_1
- platform: gpio
name: "Gang2"
id: change_gang_2
pin:
number: $pin_gang_2
mode: INPUT_PULLUP
inverted: False
# filters:
# delayed_off: $determine_change_state
on_press:
then:
- switch.turn_on: line_2
on_release:
then:
- switch.turn_off: line_2
remote_transmitter:
pin: $pin_receiver_data
carrier_duty_percent: 100%
switch:
- platform: template
name: "Line 1"
id: line_1
lambda: |-
if (id(change_gang_1).state) {
return true;
} else {
return false;
}
turn_on_action:
- logger.log: "Line 1 is ON"
- remote_transmitter.transmit_rc_switch_raw:
code: '000001000001010001010001'
protocol: 1
repeat:
times: 1
turn_off_action:
- logger.log: "Line 1 is OFF"
- remote_transmitter.transmit_rc_switch_raw:
code: '000001000001010001010001'
protocol: 1
repeat:
times: 1
- platform: template
name: "Line 2"
id: line_2
lambda: |-
if (id(change_gang_2).state) {
return true;
} else {
return false;
}
turn_on_action:
- logger.log: "Line 2 is ON"
- remote_transmitter.transmit_rc_switch_raw:
code: '000001000001010001010100'
protocol: 1
repeat:
times: 1
turn_off_action:
- logger.log: "Line 2 is OFF"
- remote_transmitter.transmit_rc_switch_raw:
code: '000001000001010001010100'
protocol: 1
repeat:
times: 1