Hello,
I am trying to capture a code and replay it via a button in Home Assistant using an ESP & CC1101-rf.
I can successfully capture the code from a button, but I am unable to send it—it just doesn't work. Can you help me?
When I capture a signal from the remote:
[18:14:42.661][I][remote.rc_switch:260]: Received RCSwitch Raw: protocol=1 data='01001011111000000101010110101'
When I press the button in HA to send the command:
[18:14:57.150][I][remote.raw:035]: Received Raw: 275
esphome:
name: cc1101-rf
friendly_name: CC1101 RF
esp32:
board: nodemcu-32s
framework:
type: esp-idf
logger:
level: INFO
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "CC1101 RF Fallback"
password: "12345678"
captive_portal:
spi:
clk_pin: GPIO18
miso_pin: GPIO19
mosi_pin: GPIO23
cc1101:
id: radio
cs_pin: GPIO15
gdo0_pin:
number: GPIO4
allow_other_uses: true
frequency: 433.92MHz
# remote_receiver:
# pin:
# number: GPIO4
# allow_other_uses: true
# dump:
# - raw
# - rc_switch
# tolerance: 60%
# filter: 4us
# idle: 10ms
# buffer_size: 8kb
# on_rc_switch:
# then:
# - logger.log:
# format: "RF reçu: protocol=%d code=0x%llX"
# args: [x.protocol, x.code]
# - homeassistant.event:
# event: esphome.rf433_received
# data:
# protocol: !lambda |-
# return std::to_string((int) x.protocol);
# code: !lambda |-
# return std::to_string((uint64_t) x.code);
# remote_transmitter:
# pin:
# number: GPIO4
# allow_other_uses: true
# carrier_duty_percent: 100%
# on_transmit:
# then:
# - cc1101.begin_tx: radio
# on_complete:
# then:
# - cc1101.begin_rx: radio
remote_receiver:
pin: GPIO25
dump:
- raw
- rc_switch
tolerance: 60%
filter: 4us
idle: 10ms
buffer_size: 8kb
remote_transmitter:
pin:
number: GPIO4
allow_other_uses: true
carrier_duty_percent: 100%
on_transmit:
then:
- cc1101.begin_tx: radio
on_complete:
then:
- cc1101.begin_rx: radio
button:
- platform: template
name: "Ventilateur Lumière"
on_press:
- remote_transmitter.transmit_rc_switch_raw:
code: "01001011111000000101010110101"
protocol: 1
repeat:
times: 20
wait_time: 5ms
# button:
# - platform: restart
# name: "Redémarrer CC1101 RF"
# - platform: template
# name: "Ventilateur On Off"
# on_press:
# - remote_transmitter.transmit_rc_switch_raw:
# code: "01001011111000000101110010001"
# protocol: 1
# repeat:
# times: 10
# wait_time: 0s
# - platform: template
# name: "Ventilateur Vitesse 1"
# on_press:
# - remote_transmitter.transmit_rc_switch_raw:
# code: "01001011111000000101111101000"
# protocol: 1
# repeat:
# times: 10
# wait_time: 0s
# - platform: template
# name: "Ventilateur Vitesse 2"
# on_press:
# - remote_transmitter.transmit_rc_switch_raw:
# code: "01001011111000000101111001000"
# protocol: 1
# repeat:
# times: 10
# wait_time: 0s
# - platform: template
# name: "Ventilateur Vitesse 3"
# on_press:
# - remote_transmitter.transmit_rc_switch_raw:
# code: "01001011111000000101110101001"
# protocol: 1
# repeat:
# times: 10
# wait_time: 0s
# - platform: template
# name: "Ventilateur Vitesse 4"
# on_press:
# - remote_transmitter.transmit_rc_switch_raw:
# code: "01001011111000000101110001001"
# protocol: 1
# repeat:
# times: 10
# wait_time: 0s
# - platform: template
# name: "Ventilateur Vitesse 5"
# on_press:
# - remote_transmitter.transmit_rc_switch_raw:
# code: "01001011111000000101101101010"
# protocol: 1
# repeat:
# times: 10
# wait_time: 0s
# - platform: template
# name: "Ventilateur Vitesse 6"
# on_press:
# - remote_transmitter.transmit_rc_switch_raw:
# code: "01001011111000000101101001010"
# protocol: 1
# repeat:
# times: 10
# wait_time: 0s
# - platform: template
# name: "Ventilateur Lumière"
# on_press:
# - remote_transmitter.transmit_rc_switch_raw:
# code: "01001011111000000101010110101"
# protocol: 1
# repeat:
# times: 10
# wait_time: 0s