1720
|
1 esphome:
|
|
2 name: "theater-blaster"
|
|
3 platform: esp32
|
|
4 board: lolin32
|
|
5
|
|
6 # MAC: 3c:71:bf:ab:6e:94
|
|
7
|
|
8 logger:
|
|
9 baud_rate: 0
|
|
10 level: DEBUG
|
|
11 logs:
|
|
12 out: DEBUG
|
|
13
|
|
14 wifi:
|
|
15 ssid: !secret wifi_ssid
|
|
16 password: !secret wifi_password
|
|
17
|
|
18 ota:
|
|
19
|
|
20 sensor:
|
|
21 - platform: wifi_signal
|
|
22 name: "wifi_signal"
|
|
23 update_interval: 60s
|
|
24
|
|
25 mqtt:
|
|
26 broker: '10.2.0.1'
|
|
27 port: 1883
|
|
28 username: ''
|
|
29 password: ''
|
|
30 on_json_message:
|
|
31 - topic: theater_blaster/ir_out/volume_up
|
|
32 then:
|
|
33 - remote_transmitter.transmit_nec:
|
|
34 address: 0x4BB6
|
|
35 command: 0x40BF
|
|
36 repeat:
|
|
37 times: !lambda |-
|
|
38 if (x.containsKey("times")) {
|
|
39 return x["times"];
|
|
40 }
|
|
41 return 1;
|
|
42 - topic: theater_blaster/ir_out/volume_down
|
|
43 then:
|
|
44 - remote_transmitter.transmit_nec:
|
|
45 address: 0x4BB6
|
|
46 command: 0xC03F
|
|
47 repeat:
|
|
48 times: !lambda |-
|
|
49 if (x.containsKey("times")) {
|
|
50 return x["times"];
|
|
51 }
|
|
52 return 1;
|
|
53 on_message:
|
|
54 - topic: theater_blaster/ir_out
|
|
55 payload: "input_bd"
|
|
56 then:
|
|
57 - remote_transmitter.transmit_nec:
|
|
58 address: 0x4B36
|
|
59 command: 0x31CE
|
|
60 - topic: theater_blaster/ir_out
|
|
61 payload: "input_cbl"
|
|
62 then:
|
|
63 - remote_transmitter.transmit_nec:
|
|
64 address: 0x4BB6
|
|
65 command: 0x708F
|
|
66 - topic: theater_blaster/ir_out
|
|
67 payload: "input_game"
|
|
68 then:
|
|
69 - remote_transmitter.transmit_nec:
|
|
70 address: 0x4BB6
|
|
71 command: 0xB04F
|
|
72 - topic: theater_blaster/ir_out
|
|
73 payload: "input_pc"
|
|
74 then:
|
|
75 - remote_transmitter.transmit_nec:
|
|
76 address: 0x4BB6
|
|
77 command: 0x39C6
|
|
78
|
|
79
|
|
80 remote_receiver:
|
|
81 - id: ir_in
|
|
82 # CHO1838 receiver; sig|gnd|vcc 3v3
|
|
83 pin:
|
|
84 number: GPIO27
|
|
85 mode: INPUT
|
|
86 inverted: True
|
|
87 dump: nec
|
|
88 - id: rf_in
|
|
89 pin: GPIO13
|
|
90 tolerance: 20%
|
|
91 filter: 250us
|
|
92 idle: 8ms
|
|
93 dump: rc_switch
|
|
94 on_rc_switch:
|
|
95 then:
|
|
96 - logger.log:
|
|
97 level: INFO
|
|
98 tag: out
|
|
99 format: "RF read; proto %d; code %08llx"
|
|
100 args: [x.protocol, x.code]
|
|
101 - mqtt.publish_json:
|
|
102 topic: theater_blaster/rf_received
|
|
103 payload: !lambda |-
|
|
104 root["protocol"] = x.protocol;
|
|
105 root["code0"] = static_cast<unsigned long>(x.code >> 32);
|
|
106 root["code1"] = static_cast<unsigned long>(x.code & 0xffff);
|
|
107 remote_transmitter:
|
|
108 id: ir_out
|
|
109 pin: GPIO14
|
|
110 carrier_duty_percent: 50%
|
|
111
|
|
112
|
|
113 #13 rf recv
|
|
114 #12 rf send
|
|
115 #https://www.passion-radio.com/img/cms/wifi-kit-32-pinout.png
|
|
116
|
|
117
|
|
118 #on_...:
|
|
119 # - remote_transmitter.transmit_nec:
|
|
120 # address: 0x1234
|
|
121 # command: 0x78AB
|
|
122
|
|
123 i2c:
|
|
124 sda: 4
|
|
125 scl: 15
|
|
126
|
|
127 font:
|
|
128 - file: "/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf"
|
|
129 id: font_vera
|
|
130 size: 20
|
|
131
|
|
132 display:
|
|
133 - platform: ssd1306_i2c
|
|
134 model: "SSD1306 128x64"
|
|
135 reset_pin: 16
|
|
136 address: 0x3C
|
|
137 lambda: |-
|
|
138 it.print(128/2, 0+6, id(font_vera), TextAlign::TOP_CENTER, "big cast erisk");
|
|
139 it.print(128/2, 64-6, id(font_vera), TextAlign::BOTTOM_CENTER ,"Volume 45");
|