Request: will any user successfully using ESPhome as a remote IR transmitter please post their yaml

Yes I have and just as an update I started using an ESP32 to boost the signal for the receiver and the transmitter module I am using. I am also adding a delay in signal transmit as I am seeing the way the signal is coming it that it appears to be a longer code as you have suggested. I will post more as I get it working. I got it to change a channel, but it is not consistently doing it. Any suggestions based on the above?

This is what it looks like now with the new boosted signal on the esp32 from the remote reciever

[16:50:40][D][remote.raw:041]: Received Raw: 279, -871, 267, -1660, 267, -703, 266, -2758, 292, -1225, 292, -1225, 292, -1088, 292, -2595, 293
[16:50:40][D][remote.raw:041]: Received Raw: 294, -814, 291, -952, 292, -677, 292, -677, 292, -676, 293, -2458, 291, -678, 291, -678, 292
[16:50:40][D][remote.raw:041]: Received Raw: 311, -841, 290, -1637, 291, -679, 291, -2733, 289, -1228, 289, -1228, 290, -1089, 289, -2598, 289
[16:50:40][D][remote.raw:041]: Received Raw: 262, -845, 262, -2077, 261, -1804, 261, -708, 261, -709, 260, -2488, 263, -707, 260, -710, 261

Here it is in esphome:

remote_transmitter:
  pin: 19
  # Infrared remotes use a 50% carrier signal
  carrier_duty_percent: 50%

switch:
  - platform: gpio
    name: "${esphome_name}-Onboard-LED"
    pin: 02
#    inverted: True
  - platform: restart
    name: ${esphome_name}-restart
    id: restart_switch
#templates for remote
  - platform: template
    name: "cable_channel_up"
    id: cable_channel_up
    turn_on_action:
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [  279, -871, 267, -1660, 267, -703, 266, -2758, 292, -1225, 292, -1225, 292, -1088, 292, -2595, 293 ]
      - delay: 4 ms
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [  294, -814, 291, -952, 292, -677, 292, -677, 292, -676, 293, -2458, 291, -678, 291, -678, 292 ]
      - delay: 4 ms    
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [  311, -841, 290, -1637, 291, -679, 291, -2733, 289, -1228, 289, -1228, 290, -1089, 289, -2598, 289 ]
      - delay: 4 ms
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [  262, -845, 262, -2077, 261, -1804, 261, -708, 261, -709, 260, -2488, 263, -707, 260, -710, 261 ]

Here is the signal I get when I transmit via the esp32 to the receiver:

[17:33:06][D][remote.raw:041]: Received Raw: 319, -2401, 260, -923, 289, -1657, 236, -712, 290, -2736, 286, -1214, 260, -1292, 260, -1084, 284, -2608, 285
[17:33:06][D][remote.raw:041]: Received Raw: 307, -822, 287, -973, 262, -714, 259, -687, 285, -665, 283, -2478, 289, -711, 288, -686, 260
[17:33:06][D][remote.raw:041]: Received Raw: 339, -844, 260, -1688, 261, -713, 259, -2740, 288, -1238, 262, -1238, 261, -1134, 287, -2607, 260, -8569, 162
[17:33:06][D][remote.raw:041]: Received Raw: 235, -844, 289, -2052, 259, -1821, 259, -689, 261, -711, 260, -2504, 234, -740, 231, -741, 234

Not sure what you mean by boosted the signal.
Did you swap from an esp8266 to a esp32, or do you just mean the 4ms delay?

It also not clear to me, are the receiver and transmitter on the same esp32.

If you managed to change the channel, but it’s intermittent, that sounds like a range issue. Try it closer to the cable box.

This code from your other thread looks more like id expect in length, although it doesn’t look like a good timing pattern in IRscrutinizer

[14:46:34][D][remote.raw:028]: Received Raw: 165, -1762, 61, -910, 163, -2860, 161, -1355, 163, -1354, 162, -1219, 93, -2795, 164, -755, 80, -1014, 97, -1144, 107, -1778, 103, -866, 129, -2620, 166, -802, 95, -876, 165, -2875, 75, -958, 162, -1765, 162, -834, 99, -2897, 95, -1422, 

Ok here is what I did overnight and I am documenting so others can follow. First of all I am trying to emulate a Xfinity Comcast XR15 remote. Unfortunately I noticed that the module I bought requires 5v and looks like this.

As you can see I had to move to an ESP 32 and I pinned it on the Vin and GND pins for the board.
After that I noticed the data changed from the IR Reciever on the same ESP32 directly from the XR15 remote.

It changed to this:

[  279, -871, 267, -1660, 267, -703, 266, -2758, 292, -1225, 292, -1225, 292, -1088, 292, -2595, 293 ]
[  294, -814, 291, -952, 292, -677, 292, -677, 292, -676, 293, -2458, 291, -678, 291, -678, 292 ]
[  311, -841, 290, -1637, 291, -679, 291, -2733, 289, -1228, 289, -1228, 290, -1089, 289, -2598, 289 ]
[  262, -845, 262, -2077, 261, -1804, 261, -708, 261, -709, 260, -2488, 263, -707, 260, -710, 261 ]

When I replaced it in ESPHOME, boom it started working but not on every button press. After looking at the code coming back on the receiver, I noticed that I needed to add delays to fully get the IR code to match. Then the code started to work, but on every like 10th button press. I noticed when I use the Xfinity XR15 remote that the signal is bursting. So I kept playing with repeating the signal and then the delays until I settled on the code below. Now it works almost every button press.

#templates for remote
  - platform: template
    name: "cable_chan_up"
    id: cable_chan_up
    turn_on_action:
      - remote_transmitter.transmit_raw:
          repeat:
            times: 15
            wait_time: 16 ms
          carrier_frequency: 38kHz
          code: [  279, -871, 267, -1660, 267, -703, 266, -2758, 292, -1225, 292, -1225, 292, -1088, 292, -2595, 293 ]
      - delay: 16 ms
      - remote_transmitter.transmit_raw:
          repeat:
            times: 15
            wait_time: 16 ms
          carrier_frequency: 38kHz
          code: [  294, -814, 291, -952, 292, -677, 292, -677, 292, -676, 293, -2458, 291, -678, 291, -678, 292 ]
      - delay: 16 ms    
      - remote_transmitter.transmit_raw:
          repeat:
            times: 15
            wait_time: 16 ms
          carrier_frequency: 38kHz
          code: [  311, -841, 290, -1637, 291, -679, 291, -2733, 289, -1228, 289, -1228, 290, -1089, 289, -2598, 289 ]
      - delay: 16 ms
      - remote_transmitter.transmit_raw:
          repeat:
            times: 15
            wait_time: 16 ms
          carrier_frequency: 38kHz
          code: [  262, -845, 262, -2077, 261, -1804, 261, -708, 261, -709, 260, -2488, 263, -707, 260, -710, 261 ]

Any follow up thoughts? comments? Wow it took me weeks to get to this point.

2 Likes

Hi @agengr1293, I just wanted to say thank you for documenting your solution so fully, and I am sure I speak for everyone who finds this thread via search.

I have not touched the IR device I built when I started this thread (mine was a ceiling fan), but I well remember going insane trying to make it happen. So much experimenting!

But, it’s still working, so, I haven’t really had a reason to. The thought of building another IR device is still terrifying to me.

Anyway well done on getting there in the end, and for sharing what worked. This remains an extremely helpful community.

1 Like

IR/RF codes are one of those things that are quite confusing initially and slightly less confusing thereafter;)

It’s also seems to me to be an area where power, pins, board and connections can matter.

1 Like

Hey guys,

Ive red most of the thread but still couldnt get my device to work.
I had a functioning ESP8266 board with IR Remote before and Im trying to switch to ESPHome.

I got the captured data, which before have only been positive numbers.
Thanks to this thread I changed every second value to negative.

I checked the soldered LED with a wire, the LED is working.
I checked the pin with an GPIO output switch, the switch turns the LED on.

But I cant get the remote transmitter to work.
The Pin im using is D2 / GPIO4, tried both of them in the configuration, doesnt work. Heres the code im currently using. Do you see anything suspicious?

esphome:
  name: esphome-web-392c4b

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:

# Example configuration entry
remote_transmitter:
  pin: 4
  carrier_duty_percent: 50%

switch:
#  - platform: gpio
#    pin: 4
#    name: "Test output"


    - platform: template
    name: Teufel an
    turn_on_action:
        remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          repeat:
            times: 3
            wait_time: 10ms
          code: [ -8976, 4488, -560, 1676, -560, 560, -558, 558, -560, 560, 
          -558, 558, -558, 560, -558, 560, -558, 558, -560, 558, -558, 1658, 
          -578, 1676, -560, 1678, -560, 1656, -580, 1678, -560, 1676, -562, 1678, 
          -560, 560, -558, 1678, -560, 560, -558, 1678, -558, 560, -558, 560,  -558, 
          560, -558, 560, -558, 1678, -558, 558, -560, 1678, -560, 560, -558, 1680, -558,
           1676, -560, 1678, -558, 1678, -560]

Please educate me, why must every second value be negative?

1 Like

Ive think I did read it in one of the posts here.
There is also this error message that pops up if you dont do alternating values.

Nevertheless, the IR LED should do something with the code. But I think its not even active.
Fehlermeldung RAW

1 Like

Your raw code starts and ends with negative values. What device did you use to capture the raw code? Are you sure these are not i) inverted or ii) partial (from a longer code)?

2 Likes

Hi @ThiccFrogg, actually, I’m with @Petrica here. I think your codes are inverted. If that’s true, you can fix it by inverting the pin you’re using to capture them, I think.

2 Likes

Thanks @Petrica and @DeeBeeKay for your suggestions!
I tried to change the + to - and reverse but it didnt help.

If the captured code is wrong, my device shouldnt turn on, but I should still be able to see the IR LED flashing. But I dont. So I think my problem is with setting up the Transmitter and not with the code?

What kind of IR blaster do you use?

These don’t work (you would be better off just de-soldering the transmitter and the receiver from the board and use them on a breadboard):
image

These work:

Also, this shield works:

To check the pins of the board it would be easier to use a regular led instead of the IR blaster.

Afterwards, you can check again the source of the raw signal.

I’m not sure the raw code would work if the receiver didn’t get the correct timings for the highs and lows as you manually added the lows.

1 Like

Here is my diy IR Blaster.



Also did a quick scetch of the wiring.
I cant find the breadboard with the IR receiver anymore, but I get your point regarding the raw signal.

But I got another update!
Tried again with the changed + and - and now it works! I just gotta be REALLY close to the receiving device.
I probably gotta find a way to extend the range now.

This lovely device from AliExpress.com combines an ESP8285, IR receiver, and IR transmitter all into one very small, quite compact device.

Can’t find out why this is not working. I can read codes from heatpumps remote ( Gree ). Gives me two options, even NEC or LG. If I’m using Arduino Heatpumpir code remote works ok so hardware is ok. But I need wifi-toggle and that’s not straight in heatpumpir-code so I should get one extra button to work.

Here’s my config:

remote_transmitter:
  pin: 
    number: GPIO4
  carrier_duty_percent: 50%
- platform: template
  name: "ILP wifi toggle"
  on_press:
    - remote_transmitter.transmit_lg:
        data: 0x8C40040A # wifi_toggle
        nbits: 32
    - delay: 16ms
    - remote_transmitter.transmit_lg:
        data: 0x8C40040E # wifi_toggle
        nbits: 32

receiver feedback:

[14:22:39][D][button:013]: 'ILP wifi toggle' Pressed.
[14:22:39][D][remote_transmitter:075]: Sending remote code...
[14:22:39][D][remote.lg:054]: Received LG: data=0x8C40040A, nbits=32
[14:22:39][D][remote_transmitter:075]: Sending remote code...
[14:22:39][D][remote.lg:054]: Received LG: data=0x8C40040E, nbits=32

Any ideas what’s wrong ?

Hi, to you find a solution? :slight_smile:

I am not using any of these devices, but my IR issues were solved by just using raw codes only.
Choosing a protol was causing strange issues with the IR codes.

I bought a couple of Moes UFO R6 IR - Tuya WiFi IR Remote. They use a Tuya WB3S chip.

See Digiblur’s article and videos on the following:
I used Libertiny Cloudcutter and ESPhome.

ltchiptool Moes Universal IR profile
Working ESPhome YAML (Pronto only) follows:

esphome:
  name: moes-ir-ufo-r6-uni-rc
  friendly_name: moes-ir-lr

bk72xx:
  board: wb3s

# Enable logging
logger:
  level: DEBUG 

# Enable Home Assistant API
api:
  services:
    - service: send_ir
      variables:
        protocol: string
        code: string
      then:
        - lambda: 'ESP_LOGD("main", "Protocol: %s - Code:",  protocol.c_str(), code.c_str() ); '
        - if:
            condition: # --=[ *** PRONTO *** ]=--
              lambda: 'return protocol == "PRONTO";'
            then:
              - logger.log: "Sending PRONTO data...!"
              - remote_transmitter.transmit_pronto:
                  data: !lambda |-
                      return code.c_str();

ota:
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  domain: !secret wifi_domain

  # Enable fallback hotspot in case wifi connection fails
  ap:
    ssid: "Moes-Ir-Lr Fallback Hotspot"
    password: ..................

button:
  - platform: restart
    name: Restart

debug:
  update_interval: 30s

text_sensor:
  - platform: debug
    reset_reason:
      name: Reset Reason
  - platform: libretiny
    version:
      name: LibreTiny Version

status_led:
  pin: P9

web_server:

captive_portal:

mdns:

remote_receiver:
  pin:
    number: 8
    inverted: true
    mode:
      input: true
      pullup: true
  dump: all
  
remote_transmitter:
  pin: 26
  carrier_duty_percent: 50%

I don’t mind a little diy, but for an ir blaster that needs to sit in my living room I like it to look nice, so I bought the athom one (15€ on ahtom.tech) looks nice and works great. Comes preloaded with tasmota but flashing it with esphome was easy

There weren’t many ‘full examples’ I could find myself but I got it working so if anyone’s interested here’s mine (redacted some ‘double’ entries for brevity)

esphome:
  name: athom-ir-remote
  friendly_name: Athom_IR_Remote

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "yourownencryptionkey="

ota:
  password: "yourownotapassword"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Athom-Ir-Remote Fallback Hotspot"
    password: "somepassword"

captive_portal:
    
web_server:
  port: 80

sensor:
  - platform: wifi_signal
    name: "athom-ir-remote WiFi Signal"
    update_interval: 300s

  - platform: uptime
    name: "athom-ir-remote Uptime"

#text_sensor:
#  - platform: wifi_info
#    ip_address:
#      name: "athom-ir-remote IP Address"
#      disabled_by_default: true
#    ssid:
#      name: "athom-ir-remote SSID"
#    bssid:
#      name: "athom-ir-remote BSSID"
#    mac_address:
#      name: "athom-ir-remote Mac Wifi Address"
#    scan_results:
#      name: "athom-ir-remote Latest Scan Results"

switch:
  - platform: restart
    name: "athom-ir-remote restart"

# Transmitter send data
#defaults nbits is 32 for samsung, 28 for lg

# Neufunk
  - platform: template
    name: NeuFunk_TV_ON
    turn_on_action:
      - remote_transmitter.transmit_lg:
          data: 0x04FB4AB5
          nbits: 32
# Samsung
  - platform: template
    name: Samsung_TV_ON
    turn_on_action:
      - remote_transmitter.transmit_samsung:
          data: 0xE0E040BF
          #nbits: 32
# Onkyo stereo receiver
  - platform: template
    name: Onkyo_Stereo_on
    turn_on_action:
      - remote_transmitter.transmit_lg:
          data: 0x4B36D32C
          nbits: 32

#-binary sensor >> status + all codes to receive from the old dyon remote 
binary_sensor:
  - platform: status
    name: "athom-ir-remote IR Status"

  - platform: gpio
    pin: GPIO0
    id: physical_button
# Dyon Remote ----------------Off
  - platform: remote_receiver
    name: 'Remote_Off'
    lg:
      data: 0x807C708F
      nbits: 32
# Dyon Remote ----------------Numbers
  - platform: remote_receiver
    name: 'Remote_1'
    lg:
      data: 0x807C708F
      nbits: 32

#redacted 2-0

# Dyon Remote ----------------Colors
  - platform: remote_receiver
    name: 'Remote_Red'
    lg:
      data: 0x807CD22D
      nbits: 32

#redacted colours

status_led:
  pin: GPIO13

remote_transmitter:
  pin:
    number: GPIO4
  carrier_duty_percent: 50%

remote_receiver:
  pin:
    number: GPIO5
    inverted: true
  dump: 
    - lg 
    - samsung

Hope someone will find it usefull

2 Likes

Hi all

Whilst this discussion seems to be focused on IR signals, I’m trying to set up a RF transmitter. I’m using an ESP32 with a MX-05V. At hte moment I’m just trying to receive the codes which I hope to transmit later. I have two problems. First though, here’s my configuration:

esphome:
  name: remote-for-433mhz
  friendly_name: Remote for 433MHz

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "***"

ota:
  password: "***"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Remote-For-433Mhz"
    password: "***"

captive_portal:

switch:
  - platform: gpio
    pin: GPIO2
    name: "Built in LED"

remote_receiver:
  pin:
    number: GPIO4
    inverted: true
    mode:
      input: true
      pullup: true
  dump: raw

The first problem I have is that, without me doing anything, the log shows that codes are being received. Here’s the log soon after boot:

INFO ESPHome 2023.10.1
INFO Reading configuration /config/esphome/remote-for-433mhz.yaml...
WARNING GPIO2 is a Strapping PIN and should be avoided.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Starting log output from remote-for-433mhz.local using esphome API
INFO Successfully connected to remote-for-433mhz.local
[09:36:03][I][app:102]: ESPHome version 2023.10.1 compiled on Oct 21 2023, 16:24:19
[09:36:03][C][wifi:546]: WiFi:
[09:36:03][C][wifi:382]:   Local MAC: [redacted]
[09:36:03][C][wifi:383]:   SSID: [redacted]
[09:36:03][C][wifi:384]:   IP Address: 192.168.0.135
[09:36:03][C][wifi:386]:   BSSID: [redacted]
[09:36:03][C][wifi:387]:   Hostname: 'remote-for-433mhz'
[09:36:03][C][wifi:389]:   Signal strength: -52 dB ▂▄▆█
[09:36:03][C][wifi:393]:   Channel: 11
[09:36:03][C][wifi:394]:   Subnet: 255.255.255.0
[09:36:03][C][wifi:395]:   Gateway: 192.168.0.1
[09:36:03][C][wifi:396]:   DNS1: 192.168.0.1
[09:36:03][C][wifi:397]:   DNS2: 0.0.0.0
[09:36:03][I][remote.raw:041]: Received Raw: -667, 847, -1603, 832, -148, 787, -1002, 353, -2578, 225, -893, 161, -2388, 229, -5453, 174, -7231, 256, -2192, 239, -2963, 431, -4218, 275, -4464, 239, -84, 189
[09:36:03][C][logger:361]: Logger:
[09:36:03][C][logger:362]:   Level: DEBUG
[09:36:03][C][logger:363]:   Log Baud Rate: 115200
[09:36:03][C][logger:365]:   Hardware UART: UART0
[09:36:03][I][remote.raw:041]: Received Raw: 270, -4285, 450, -784, 269, -1694, 220
[09:36:03][I][remote.raw:041]: Received Raw: 343
[09:36:03][C][switch.gpio:068]: GPIO Switch 'Built in LED'
[09:36:03][C][switch.gpio:091]:   Restore Mode: always OFF
[09:36:03][C][switch.gpio:031]:   Pin: GPIO2
[09:36:03][I][remote.raw:041]: Received Raw: 312, -4081, 317, -2441, 280, -659, 345, -1821, 830, -104, 788, -523, 1324, -16, 736, -533, 115, -803, 720, -690, 206, -3422, 182, -3726, 116
[09:36:03][C][remote_receiver.esp32:054]: Remote Receiver:
[09:36:03][C][remote_receiver.esp32:055]:   Pin: GPIO4
[09:36:03][C][remote_receiver.esp32:060]:   Channel: 0
[09:36:03][C][remote_receiver.esp32:061]:   RMT memory blocks: 3
[09:36:03][C][remote_receiver.esp32:062]:   Clock divider: 80
[09:36:03][C][remote_receiver.esp32:063]:   Tolerance: 25%
[09:36:03][C][remote_receiver.esp32:064]:   Filter out pulses shorter than: 50 us
[09:36:03][C][remote_receiver.esp32:065]:   Signal is done after 10000 us of no changes
[09:36:03][I][remote.raw:041]: Received Raw: 198, -3040, 139
[09:36:03][I][remote.raw:041]: Received Raw: 211, -2534, 231, -2765, 250, -33, 168
[09:36:03][C][captive_portal:088]: Captive Portal:
[09:36:03][I][remote.raw:041]: Received Raw: 313, -3450, 210
[09:36:03][C][mdns:115]: mDNS:
[09:36:03][C][mdns:116]:   Hostname: remote-for-433mhz
[09:36:03][I][remote.raw:041]: Received Raw: 288, -1553, 2179, -1431, 766, -1053, 287, -2071, 191, -576, 127
[09:36:03][C][ota:097]: Over-The-Air Updates:
[09:36:03][C][ota:098]:   Address: remote-for-433mhz.local:3232
[09:36:03][C][ota:101]:   Using Password.
[09:36:03][I][remote.raw:041]: Received Raw: 214, -2370, 200, -127, 145, -2749, 208, -4185, 152, -9953, 243, -3654, 215, -2822, 183
[09:36:03][C][api:138]: API Server:
[09:36:03][C][api:139]:   Address: remote-for-433mhz.local:6053
[09:36:03][C][api:141]:   Using noise encryption: YES
[09:36:03][I][remote.raw:041]: Received Raw: 281
[09:36:03][I][remote.raw:041]: Received Raw: 323, -2615, 462, -6279, 188, -6918, 1555, -57
[09:36:03][I][remote.raw:041]: Received Raw: -855
[09:36:17][I][remote.raw:041]: Received Raw: -4250, 419
[09:36:17][I][remote.raw:041]: Received Raw: 295
[09:36:17][I][remote.raw:041]: Received Raw: 258, -7311, 348, -7987, 291
[09:36:17][I][remote.raw:041]: Received Raw: 560, -26, 3145, -6181, 5634, -50

The other problem is that, when I do press buttons on my remote, I do receive codes but, there doesn’t seem to be any consistency in the codes received.

I hope someone can help.

Thanks