substitutions:
device_name: aiyun_infrared
led_state: GPIO16 # 板载led灯,0绿亮红灭,1红亮绿灭
transmitter_gpio: GPIO14 # 红外发射
receiver_gpio: GPIO4 # 板载蜂鸣器 改 红外接收
butten: GPIO5 # 板载按钮
esphome:
name: $device_name
platform: ESP8266
esp8266_restore_from_flash: yes
build_path: build/$device_name
board: d1
status_led:
pin:
number: $led_state
inverted: true
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "pyJoQRrN8BTVK9aJUrDLB6wBMFTbwCqdDJ3nOaK3Va4="
ota:
safe_mode: true
password: "115bf6c163a88f51fefeed3b43817600"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: none
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Aiyun-Infrared Fallback Hotspot"
password: "IAH0xQPlA0gS"
captive_portal:
web_server:
port: 80
css_url: https://esphome.io/_static/webserver-v1.min.css
js_url: https://esphome.io/_static/webserver-v1.min.js
time:
- platform: sntp
id: sntp_time
remote_transmitter:
pin:
number: $transmitter_gpio
inverted: true
carrier_duty_percent: 50%
remote_receiver:
id: rcvr
pin:
number: $receiver_gpio
inverted: true
dump: all
#climate:
# - platform: coolix # adjust to match your AC unit!
# name: "Living Room AC"
# #receiver_id: rcvr
#
switch:
- platform: restart
name: "${device_name}_Restart"
- platform: template
name: turn_on_ktiao
turn_on_action:
- remote_transmitter.transmit_raw:
code: [9060, -4559, 636, -550, 636, -553, 662, -554, 636,
-1640, 662, -552, 636, -553, 663, -552, 637, -552, 664,
-1638, 664, -523, 664, -552, 637, -1638, 665, -550, 636,
-554, 660, -581, 609, -581, 633, -583, 632, -584, 581,
-608, 608, -608, 582, -581, 608, -608, 582, -608, 607,
-609, 581, -582, 607, -609, 581, -609, 607, -610, 580,
-1696, 580, -580, 607, -1669, 580, -580, 607, -582, 607,
-1696, 607, -607, 581]
carrier_frequency: 38000Hz
- platform: template
name: turn_off_ktiao
turn_on_action:
- remote_transmitter.transmit_raw:
code: [9055, -4560, 636, -551, 635, -553, 662, -554, 612,
-578, 662, -553, 663, -553, 637, -552, 664, -552, 637,
-1639, 638, -523, 663, -552, 638, -1638, 664, -549, 637,
-552, 663, -553, 636, -555, 660, -557, 658, -582, 607,
-583, 608, -584, 606, -557, 632, -608, 582, -583, 633,
-584, 606, -557, 631, -609, 582, -583, 632, -608, 583,
-1670, 605, -580, 607, -1645, 605, -579, 608, -581, 608,
-1671, 631, -606, 582]
carrier_frequency: 38000Hz
- platform: template
name: turn_off_ktiao1
turn_on_action:
- remote_transmitter.transmit_lg:
data: 0x2230048A
nbits: 32
binary_sensor:
- platform: gpio
pin:
number: $butten
inverted: true
name: "${device_name}_button"
id: "${device_name}_button"
i2c:
sda: 15
scl: 13
scan: true
id: bus_a
sensor:
- platform: bh1750
i2c_id: bus_a
name: "BH1750 Illuminance"
address: 0x23
update_interval: 60s