-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathir.yaml
116 lines (104 loc) · 3.31 KB
/
ir.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
substitutions:
devicename: ir
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_pw
fast_connect: true
ap:
ssid: ${devicename}
password: !secret ap_pw
captive_portal:
web_server:
port: !secret web_port
auth:
username: !secret web_user
password: !secret web_pw
api:
password: !secret api_pw
ota:
password: !secret ota_pw
logger:
esphome:
name: ${devicename}
platform: ESP8266
board: esp8285
remote_receiver:
pin:
number: GPIO14
inverted: True
dump: all
on_lg:
then:
- lambda: |-
if (x.data & 0x10000000) {
id(climate_switch).publish_state(true);
} else {
id(climate_switch).publish_state(false);
}
on_raw:
then:
- lambda: |-
short irCode[256] = {0}; std::string decode;
for (int i = 0; i < x.size(); i++) {
int isNega = 0;
char temp[16] = {0};
irCode[i] = (short)x[i];
if (i == 0) {
decode += "9000, ";
continue;
}
if (i == 1) {
decode += "-4500, ";
continue;
}
if (irCode[i] < 0) {
irCode[i] = -irCode[i];
isNega = 1;
}
irCode[i] = (irCode[i] / 560 + (irCode[i] % 560 > 280 ? 1 : 0)) * 560;
sprintf(temp, isNega ? "-%d, " : "%d, ", irCode[i]);
decode += temp;
if (i % 32 == 31) {
ESP_LOGI("main", "raw: %s", decode.c_str());
decode.clear();
}
}
ESP_LOGI("main", "raw: %s", decode.c_str());
remote_transmitter:
pin: GPIO4
# Infrared remotes use a 50% carrier signal
carrier_duty_percent: 50%
# climate:
# - platform: custom
# lambda: |-
# auto qundaClimate = new Qunda();
# App.register_component(qundaClimate);
# return {qundaClimate};
# climates:
# - name: "空调"
switch:
- platform: template
name: "空调"
id: climate_switch
optimistic: true
turn_on_action:
remote_transmitter.transmit_raw:
carrier_frequency: 38kHz
code: [9000, -4500, 560, -560, 560, -560, 560, -560, 560, -1680, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -1680, 560, -1680, 560, -1680, 560, -560, 560, -560,
560, -560, 560, -1680, 560, -1680, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -1680, 560, -560, 560, -560,
560, -560, 560, -560, 560, -560, 560, -1680, 560, -1680, 560, -560, 560, -560, 560, -560, 560, -560, 560, -10080]
turn_off_action:
remote_transmitter.transmit_raw:
carrier_frequency: 38kHz
code: [9000, -4500, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -1680, 560, -1680, 560, -1680, 560, -560, 560, -560,
560, -560, 560, -1680, 560, -1680, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -560, 560, -1680, 560, -560, 560, -560,
560, -560, 560, -560, 560, -560, 560, -1680, 560, -1680, 560, -560, 560, -560, 560, -560, 560, -560, 560, -10080]
sensor:
- platform: dht
model: DHT22
pin: TX
temperature:
name: "Temperature"
humidity:
name: "Humidity"
update_interval: 30s