esphome:
name: esp32irsensor
platform: ESP32
board: nodemcu-32s
wifi:
ssid: "myssid"
password: "11111111"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp32Irsensor Fallback Hotspot"
password: "11111111"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "11111111"
services:
- service: send_raw_command
variables:
command: int[]
then:
- remote_transmitter.transmit_raw:
code: !lambda 'return command;'
carrier_frequency: 38kHz
- service: send_nec_command
variables:
address: int
command: int
then:
- remote_transmitter.transmit_nec:
address: !lambda 'return address;'
command: !lambda 'return command;'
ota:
password: "11111111"
web_server: ## 这个是web控制,添加了这2行,就可以打开设备ip,有控制页面
port: 80
sensor:
- platform: dht ## 不能更改
pin: GPIO13 ## 使用GPIO-13
model: DHT11 ## 不能更改
update_interval: 4s ## 数据更新时间
temperature:
name: "Temperature" ## 名称可以自定义
filters: ## 下面这些是对温湿度数据进行初始化处理,求平均值上报
- sliding_window_moving_average:
window_size: 5
send_every: 5
send_first_at: 5
humidity:
name: "Humidity"
filters:
- sliding_window_moving_average:
window_size: 5
send_every: 5
send_first_at: 5
remote_receiver:
pin:
number: GPIO23
inverted: True
dump: raw
remote_transmitter:
pin:
number: GPIO21
carrier_duty_percent: 50%
## 随便搞2开关测试下红外发射
switch:
- platform: template
name: "media_fan_power"
turn_on_action:
- remote_transmitter.transmit_raw:
code: [9018, -4395, 634, -1594, 635, -480, 633, -481, 634, -480, 634, -481, 634, -480, 634, -482, 633, -480, 634, -481, 635, -1593, 634, -1595, 634, -1595, 633, -1595, 634, -1594, 634, -1595, 633, -1599, 631, -1594, 633, -1595, 634, -481, 634,
-480, 634, -480, 634, -480, 634, -480, 634, -480, 634, -480, 634, -481, 634, -1594, 634, -1594, 634, -1596, 633, -1594, 634, -1595, 634, -1594, 634, -1595, 634, -1594, 634, -480, 635, -480, 634, -480, 634, -481, 634, -479, 634, -481, 634, -480, 634,
-481, 633, -1594, 635, -1594, 635, -1594, 634, -1594, 634, -1595, 634, -1594, 634]
carrier_frequency: 38kHz
- platform: template
name: "media_fan_speed"
turn_on_action:
- remote_transmitter.transmit_raw:
code: [9017, -4392, 635, -1595, 634, -480, 634, -480, 634, -481, 633, -481, 634, -480, 634, -481, 634, -480, 634, -480, 634, -1595, 634, -1595, 634, -1595, 635, -1595, 634, -1595, 634, -1595, 635, -1595, 634, -1595, 634, -1595, 634, -1595, 634,
-480, 634, -481, 634, -481, 634, -480, 633, -481, 634, -481, 634, -480, 634, -481, 633, -1595, 634, -1595, 634, -1595, 634, -1595, 634, -1595, 634, -1594, 634, -1595, 634, -1595, 634, -480, 634, -480, 634, -480, 635, -480, 634, -480, 634, -480, 635,
-480, 634, -480, 634, -1595, 634, -1594, 633, -1596, 634, -1595, 634, -1595, 634]
carrier_frequency: 38kHz