forked from Samurai1201/Esp8266-IR-Transceiver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathir.yaml
97 lines (81 loc) · 2.29 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
esphome:
name: "ir"
friendly_name: IR
includes:
- irfunctions.h
packages:
wifi: !include wifi.yaml
esp8266:
board: esp12e
# Enable logging
logger:
level: DEBUG
# Enable Home Assistant API
api:
id: api_server
ota:
web_server:
port: 80
captive_portal:
text_sensor:
- platform: template
name: "Remote Raw Code Sensor"
id: ir_remote_raw
- platform: template
name: "Remote Code Sensor"
id: ir_remote_code
remote_receiver:
pin:
number: GPIO14
inverted: true
dump: raw
# dump: all
idle: 100ms
# rc5 decode appears to be broken
on_rc5:
then:
- lambda: !lambda |-
std::string s=str_sprintf("{\"protocol\":\"rc5\",\"address\":0x%x,\"command\":0x%x}",
x.address,x.command);
id(ir_remote_code).publish_state(s);
on_nec:
then:
- lambda: !lambda |-
std::string s=str_sprintf("{\"protocol\":\"nec\",\"address\":0x%x,\"command\":0x%x,\"command_repeats\":0x%x}",
x.address,x.command,x.command_repeats);
id(ir_remote_code).publish_state(s);
on_rc6:
then:
- lambda: !lambda |-
std::string s=str_sprintf("{\"protocol\":\"rc6\",\"address\":0x%x,\"command\":0x%x,\"mode\":0x%x,\"toggle\":0x%x}",
x.address,x.command,x.mode,x.toggle);
id(ir_remote_code).publish_state(s);
on_sony:
then:
- lambda: !lambda |-
std::string s=str_sprintf("{\"protocol\":\"sony\",\"data\":0x%x,\"nbits\":0x%x",
x.data,x.nbits);
id(ir_remote_code).publish_state(s);
on_samsung:
then:
- lambda: !lambda |-
std::string s=str_sprintf("{\"protocol\":\"samsung\",\"data\":0x%llx,\"nbits\":0x%x",
x.data,x.nbits);
id(ir_remote_code).publish_state(s);
on_raw:
then:
- lambda: !lambda |-
std::string s;
char out[x.size()*2];
int i=0;
for (int n : x) {
out[i]=n&255;
out[i+1]=(n>>8)&255;
i+=2;
}
s.assign(out,0,i);
id(ir_remote_raw).publish_state(base64_encode(s));
remote_transmitter:
pin: GPIO4
# Infrared remotes use a 50% carrier signal
carrier_duty_percent: 50%