本帖最后由 kjjuhfv 于 2023-11-17 21:54 编辑
esp8266:
board: esp_wroom_02
# Enable logging
logger:
# Enable Home Assistant API
api:
services:
- service: rf_433_send #ha服务可以调用于发射rc_switch_raw格式的433mhz射频
variables:
code: string
repeat: int
then:
- remote_transmitter.transmit_rc_switch_raw:
transmitter_id: Rf433_transmitter
code: !lambda 'return code;'
repeat:
times: !lambda 'return repeat;'
- service: send_ir_command
variables:
command: int[]
then:
- remote_transmitter.transmit_raw:
code: !lambda 'return command;'
carrier_frequency: 38kHz
transmitter_id: hongwai_fashe
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp12F-B2E27C Fallback Hotspot"
password: "C46oA4s7CwAW"
captive_portal:
remote_transmitter:
- id: hongwai_fashe
pin: GPIO14 #红外引脚
carrier_duty_percent: 50%
- id: Rf433_transmitter
pin: GPIO5 #射频433引脚
carrier_duty_percent: 100%
remote_receiver:
- id: IR_receiver
pin:
number: GPIO12 #红外接收引脚
inverted: True
dump:
- raw
- nec
switch:
- platform: template
name: "linion on"
turn_on_action:
- remote_transmitter.transmit_rc_switch_raw:
code: '1110111110011101000011110'
protocol: 1
repeat: 5
transmitter_id: Rf433_transmitter
- platform: template
name: "linion off"
turn_on_action:
- remote_transmitter.transmit_rc_switch_raw:
code: '1110111110011101000001110'
protocol: 1
repeat: 5
transmitter_id: Rf433_transmitter
几个引脚pin自己选一个接上就是了
你看A3那张图 我标注有焊接点的作用
比如你esp32的pin20用作红外发射 你就把pin20连接到pwm_5那里就可以了
|