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

That’s just it, though. What you’ve received there looks more like what I expect an RF code to look like: a bit of a mess. Whereas the code you are transmitting in your YAML file is crisply divisible by 500. So, from my extremely limited experience, it looks a bit like you’re not transmitting what you received.

Something else that occurs to me is that I vaguely remember there being a thing where you can’t transmit different protocols out of the same pin. I’ve scratched through the documentation and I can’t now find the thing I’m thinking of, but, I wonder if there isn’t some unplanned weirdness happening as a result of you listening and transmitting at the same time on the same NodeMCU board. A quick way to test this would be to simply comment out the receiving section of your code and recompile. If the problem goes away, it was that.

But purely for a troubleshooting thing, I would like you, if possible, to set up the receiver on a separate device. That way we can monitor and compare the difference between the actual remote, and the DIY remote. Right now there’s a hanging question of whether doing those jobs together works. (or not? I dunno, I’m quite ignorant)

Also I noticed a problem in your YAML, but I assume it’s a copypasta thing because I’m not sure it would compile as it stands. You’re missing a hyphen in front of remote_transmitter.transmit_raw: It’s causing the whole statement to be at the wrong indent.

Hi, I just want you to know that after a lot of attempts, I found what the problem was. For some strange reason every time that I was using a nodemcu board it was not working. I changed to an D1 mini and worked, even an esp01 worked too. So all this time the two nodemcu boards I was using were the problem. Nevertheless, you information here was very helpful. Thanks again.

3 Likes

@laca75tn, I wonder what the difference between the pins is on a nodeMCU versus a D1? I think D1 has 3.3V. It could also be something like, the specific pin you attached to on the nodeMCU either can’t do PWM, or else, isnt actually the pin you thought. Some of the clone boards play a little fast and loose with the labelling.

But whatever, I’m glad it’s working!

Some good info here https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/

1 Like

Have any of you implemented a ‘set volume to a value’ automation on the IR Transmitter? What I want to do is have a switch that when pressed it will set my projector to a predetermined volume, i.e., 30. My projector remote does not have a mute button (IR code), therefore this will also help me to implement it by setting the volume to 0. Any thoughts/ideas? Thanks,

Hi @laca75tn, I haven’t, but I’d like to. The problem is that the original remote defines what you can do with an IR emitter, pretty much. Most remotes support Vol Up and Vol Down, but not Vol 30 (or whatever number).

There’s two ways you could do this, that I can think of right now.

One is, count the number of presses it takes to get from Vol 0 to Vol 30 (probably 30). Then, define a switch that sends the IR code for Vol Up 30 times. The downside is that without feedback, it’s just going to add 30 clicks to whatever volume you already had.

The other is, find a way to get feedback from the projector/sound bar/whatever. If we know what the volume currently is, making specific changes is easy. However, getting this feedback is ninja level hard. I did see a project where a guy used an ESP32Cam module to look at the LED display of a device and translate it to machine-readable code. Maybe something you could try?

1 Like

Perhaps leave the projector at a set level and set the volume on your amplifier, which are usually better integrated in ha.

Hi,

can please someone explain me the difference between the 2 different captured lines in the log, with a receiver

remote_receiver:
    pin:
      number: GPIO04
      inverted: true
    #dump: nec
    #dump: raw
    dump: all

i get the following lines logged:

[14:02:34][D][remote.raw:028]: Received Raw: 593, -1566, 1683, -494, 592, -1589, 1661, -521, 564, -1566, 1683, -521, 563, -1567, 1686, -520, 562, -1565, 1689, -493, 589, -1591, 1660, -521, 565, -1589, 1662, -520, 538, -1616, 1663, -519, 564, -1590, 566, -1568, 590, -1590, 567, -1567,
[14:02:34][D][remote.raw:041]:   590, -1565, 591, -1591, 569, -1566, 1683, -494, 593
[14:02:34][D][remote.raw:028]: Received Raw: 594, -1589, 1659, -524, 563, -1565, 1660, -546, 566, -1566, 1658, -546, 566, -1589, 1634, -548, 566, -1565, 1660, -520, 589, -1590, 1662, -520, 564, -1570, 1681, -523, 539, -1615, 1662, -520, 564, -1565, 592, -1591, 568, -1568, 589, -1591,
[14:02:34][D][remote.raw:041]:   567, -1590, 566, -1569, 590, -1567, 1683, -522, 539
[14:02:34][D][remote.raw:028]: Received Raw: 589, -1564, 1686, -521, 567, -1565, 1683, -496, 590, -1567, 1683, -521, 566, -1567, 1683, -521, 567, -1564, 1685, -522, 565, -1564, 1685, -498, 591, -1588, 1662, -493, 593, -1567, 1685, -520, 566, -1589, 568, -1565, 591, -1592, 1661, -521,
[14:02:34][D][remote.raw:041]:   564, -1591, 568, -1589, 567, -1591, 1661, -522, 565
[14:02:34][D][remote.raw:028]: Received Raw: 593, -1566, 1688, -520, 564, -1590, 1661, -496, 590, -1566, 1689, -491, 592, -1564, 1687, -495, 592, -1565, 1687, -519, 563, -1569, 1686, -495, 589, -1564, 1687, -496, 593, -1562, 1687, -496, 591, -1564, 592, -1591, 567, -1564, 1689, -493,
[14:02:34][D][remote.raw:041]:   594, -1588, 567, -1566, 592, -1563, 1663, -546, 565
[14:02:34][D][remote.raw:028]: Received Raw: 593, -1565, 1687, -521, 564, -1563, 1689, -521, 539, -1592, 1686, -494, 592, -1589, 1662, -493, 592, -1564, 1687, -495, 583, -1573, 1670, -511, 592, -1562, 1691, -492, 598, -1561, 1686, -492, 594, -1564, 593, -1568, 591, -1564, 1687, -492,
[14:02:34][D][remote.raw:041]:   594, -1564, 594, -1567, 591, -1589, 1662, -493, 592
[14:02:35][D][remote.raw:028]: Received Raw: 594, -1567, 1686, -495, 589, -1565, 1686, -522, 564, -1590, 1662, -493, 592, -1567, 1660, -518, 592, -1567, 1686, -520, 564, -1592, 1663, -519, 567, -1563, 1686, -522, 566, -1563, 1689, -519, 566, -1564, 592, -1564, 595, -1564, 1689, -521,
[14:02:35][D][remote.raw:041]:   566, -1588, 569, -1561, 595, -1567, 1660, -546, 565
[14:02:35][D][remote.raw:028]: Received Raw: 594, -1567, 1682, -523, 566, -1564, 1687, -521, 565, -1562, 1690, -494, 592, -1567, 1684, -497, 589, -1566, 1685, -521, 563, -1567, 1687, -496, 589, -1591, 1663, -520, 563, -1568, 1685, -494, 594, -1565, 592, -1564, 594, -1567, 1685, -519,
[14:02:35][D][remote.raw:041]:   565, -1565, 594, -1591, 567, -1563, 1690, -520, 565

there are lines with remote.raw:028 and on the other hand lines with remote.raw:041.

When i set up my sender like this (with the codes from the longer remote.raw:028 lines:

remote_transmitter:
  - id: screen
    pin: D6
    carrier_duty_percent: 50%

switch:
  - platform: template
    name: "Screen down"
    turn_on_action:
      remote_transmitter.transmit_raw:
        #repeat:
        #  times: 15
        #  wait_time: 0s
        #code: [591,-1567,1658,-518,592,-1566,1684,-495,563,-1593,1657,-519,592,-1565,1659,-521,563,-1592,1658,-520,590,-1568,1658,-522,565,-1588,1659,-522,563,-1594,1656,-519,568,-1591,590,-1568,564,-1589,593,-1569]
        #code: [578,-1585,1666,-512,573,-1585,1668,-513,577,-1583,1666,-514,573,-1584,1666,-515,577,-1581,1668,-513,577,-1581,1667,-514,575,-1583,1668,-514,577,-1582,1669,-511,574,-1585,575,-1580,577,-1583,575,-1583]
        code : [ 591, -1565, 1680, -524, 563, -1566, 1680, -523, 537, -1595, 1655, -548, 536, -1592, 1681, -524, 560, -1593, 1634, -546, 538, -1591, 1682, -522, 564, -1567, 1681, -498, 562, -1616, 1659, -522, 1655, -496, 1681, -523, 562, -1568, 564, -1617,  592, -1589, 1633, -548, 561, -1592, 1659, -521, 563, -1565, 1685, -521, 566, -1564, 1683, -521, 563, -1566, 1683, -523, 563, -1567, 1682, -522, 542, -1611, 1659, -524, 562, -1590, 1633, -523, 1679, -496, 1683, -500, 561, -1593, 563, -1596,  593, -1565, 1681, -523, 565, -1567, 1681, -521, 563, -1591, 1662, -491, 594, -1588, 1658, -496, 591, -1566, 1685, -520, 562, -1567, 1684, -494, 590, -1591, 1659, -523, 561, -1592, 1660, -496, 1683, -521, 1656, -523, 564, -1589, 541, -1617,  589, -1591, 1659, -527, 559, -1566, 1681, -524, 563, -1565, 1683, -524, 538, -1591, 1683, -495, 590, -1568, 1684, -520, 562, -1569, 1680, -498, 593, -1561, 1685, -493, 594, -1590, 1659, -493, 1685, -493, 1688, -490, 595, -1562, 594, -1568,  618, -1539, 1682, -523, 563, -1568, 1682, -523, 562, -1592, 1659, -494, 592, -1564, 1686, -495, 563, -1593, 1684, -493, 590, -1568, 1684, -493, 592, -1566, 1659, -520, 565, -1592, 1683, -494, 1686, -492, 1661, -546, 565, -1568, 588, -1567,  594, -1567, 1679, -524, 562, -1567, 1683, -495, 563, -1595, 1683, -522, 561, -1569, 1658, -547, 564, -1565, 1683, -524, 537, -1592, 1683, -523, 561, -1569, 1683, -498, 562, -1591, 1684, -523, 1657, -522, 1657, -494, 591, -1565, 593, -1565,  589, -1563, 1686, -522, 563, -1593, 1660, -520, 563, -1590, 1661, -520, 566, -1588, 1660, -495, 591, -1591, 1633, -547, 564, -1565, 1685, -496, 590, -1567, 1682, -523, 563, -1591, 1660, -495, 1683, -497, 1682, -494, 591, -1567, 592, -1590,  593, -1563, 1686, -492, 593, -1565, 1659, -520, 591, -1568, 1682, -494, 593, -1562, 1686, -495, 565, -1591, 1685, -495, 592, -1564, 1660, -547, 564, -1564, 1660, -548, 537, -1591, 1686, -494, 1685, -494, 1660, -546, 564, -1566, 590, -1592,  593, -1565, 1686, -494, 593, -1560, 1687, -494, 594, -1564, 1684, -495, 592, -1564, 1689, -519, 564, -1590, 1659, -495, 593, -1559, 1690, -496, 564, -1592, 1682, -493, 593, -1569, 1684, -520, 1657, -496, 1658, -546, 540, -1591, 589, -1567]
        carrier_frequency: 38kHz

I can capture the following lines on the same receiver:

[14:12:41][D][remote.raw:028]: Received Raw: 583, -1609, 1730, -487, 502, -1656, 1702, -479, 558, -1583, 1709, -533, 499, -1612, 1706, -502, 534, -1625, 1680, -510, 558, -1578, 1735, -506, 502, -1636, 1706, -452, 507, -1706, 1679, -512, 1653, -480, 1733, -476, 508, -1628, 533, -1657,
[14:12:41][D][remote.raw:028]:   559, -1629, 1679, -511, 508, -1653, 1708, -479, 509, -1629, 1733, -508, 558, -1550, 1736, -507, 478, -1630, 1732, -510, 479, -1629, 1710, -504, 594, -1568, 1704, -486, 507, -1655, 1677, -514, 1672, -510, 1681, -510, 480, -1652, 509, -1657, 616, -1550,
[14:12:41][D][remote.raw:028]:   1737, -477, 558, -1579, 1736, -475, 508, -1652, 1708, -455, 613, -1574, 1684, -508, 507, -1629, 1734, -478, 509, -1656, 1707, -480, 508, -1655, 1704, -485, 506, -1651, 1684, -512, 1704, -507, 1678, -510, 503, -1656, 568, -1570, 536, -1684, 1651, -512,

now with remote.raw:028, and you guess, the motor screen does exactly nothing.

Something must be still wrong.

When I take the codes from the remote.raw:041 lines, only remote.raw:041 lines are logged on the receiver, here’s a sample with 3 different codes transmitted:

[15:13:26][D][remote.raw:041]: Received Raw: 594, -1607, 607, -1560, 1685, -517, 1708, -516, 578
[15:13:26][D][remote.raw:041]: Received Raw: 619, -1564, 581, -1587, 1710, -488, 1707, -489, 581
[15:13:27][D][remote.raw:041]: Received Raw: 578, -1604, 605, -1564, 1683, -544, 1653, -513, 608
[15:13:27][D][remote.raw:041]: Received Raw: 577, -1602, 582, -1588, 1705, -523, 1651, -516, 604
[15:13:27][D][remote.raw:041]: Received Raw: 577, -1605, 580, -1591, 1680, -517, 1682, -543, 551
[15:13:27][D][remote.raw:041]: Received Raw: 586, -1615, 563, -1587, 1684, -541, 1656, -542, 552
[15:13:27][D][remote.raw:041]: Received Raw: 599, -1580, 616, -1556, 1717, -509, 1687, -509, 583
[15:13:27][D][remote.raw:041]: Received Raw: 598, -1581, 623, -1546, 1723, -506, 1695, -501, 590
[15:13:27][D][remote.raw:041]: Received Raw: 627, -1552, 623, -1546, 1725, -503, 1695, -502, 591
[15:13:28][D][remote.raw:041]: Received Raw: 506, -1679, 570, -1604, 598, -1576, 599, -1604, 660
[15:13:28][D][remote.raw:041]: Received Raw: 602, -1588, 515, -1661, 579, -1594, 603, -1594, 546
[15:13:28][D][remote.raw:041]: Received Raw: 577, -1595, 572, -1605, 578, -1590, 574, -1628, 553
[15:13:29][D][remote.raw:041]: Received Raw: 592, -1579, 576, -1604, 579, -1589, 580, -1617, 569
[15:13:29][D][remote.raw:041]: Received Raw: 573, -1598, 574, -1601, 611, -1559, 611, -1586, 544
[15:13:29][D][remote.raw:041]: Received Raw: 573, -1597, 598, -1578, 621, -1549, 619, -1579, 542
[15:13:29][D][remote.raw:041]: Received Raw: 572, -1598, 573, -1604, 549, -1623, 649, -1550, 520
[15:13:29][D][remote.raw:041]: Received Raw: 621, -1549, 571, -1605, 549, -1625, 549, -1652, 519
[15:13:29][D][remote.raw:041]: Received Raw: 550, -1619, 570, -1607, 614, -1555, 548, -1654, 518
[15:13:29][D][remote.raw:041]: Received Raw: 544, -1625, 569, -1608, 603, -1566, 545, -1658, 516
[15:13:36][D][remote.raw:041]: Received Raw: 590, -1630, 487, -1661, 630, -1540, 609, -1588, 488
[15:13:36][D][remote.raw:041]: Received Raw: 590, -1660, 459, -1658, 631, -1540, 610, -1587, 544
[15:13:36][D][remote.raw:041]: Received Raw: 577, -1622, 490, -1657, 605, -1567, 612, -1585, 544
[15:13:36][D][remote.raw:041]: Received Raw: 576, -1627, 540, -1603, 607, -1565, 615, -1583, 544
[15:13:36][D][remote.raw:041]: Received Raw: 600, -1604, 543, -1603, 604, -1567, 615, -1612, 516
[15:13:36][D][remote.raw:041]: Received Raw: 576, -1628, 543, -1606, 599, -1597, 616, -1558, 540
[15:13:36][D][remote.raw:041]: Received Raw: 598, -1604, 544, -1606, 598, -1569, 683, -1516, 544
[15:13:36][D][remote.raw:041]: Received Raw: 658, -1541, 569, -1577, 583, -1587, 687, -1512, 568
[15:13:36][D][remote.raw:041]: Received Raw: 570, -1632, 567, -1578, 551, -1620, 685, -1514, 542
[15:13:36][D][remote.raw:041]: Received Raw: 520, -1680, 567, -1579, 576, -1594, 653, -1546, 541
[15:13:37][D][remote.raw:041]: Received Raw: 594, -1623, 539, -1637, 576, -1568, 612, -1584, 511
[15:13:37][D][remote.raw:041]: Received Raw: 600, -1620, 539, -1605, 607, -1596, 585, -1613, 483
[15:13:37][D][remote.raw:041]: Received Raw: 519, -1711, 510, -1608, 604, -1566, 613, -1587, 509
[15:13:37][D][remote.raw:041]: Received Raw: 575, -1626, 541, -1608, 602, -1567, 642, -1556, 540
[15:13:37][D][remote.raw:041]: Received Raw: 625, -1576, 541, -1605, 602, -1571, 649, -1548, 542
[15:13:37][D][remote.raw:041]: Received Raw: 574, -1626, 566, -1581, 601, -1571, 684, -1513, 544
[15:13:37][D][remote.raw:041]: Received Raw: 572, -1628, 601, -1546, 597, -1574, 688, -1513, 568
[15:13:37][D][remote.raw:041]: Received Raw: 662, -1539, 600, -1545, 551, -1620, 686, -1513, 569
[15:13:37][D][remote.raw:041]: Received Raw: 567, -1633, 570, -1576, 552, -1619, 680, -1518, 567
[15:13:37][D][remote.raw:041]: Received Raw: 543, -1661, 564, -1578, 551, -1621, 654, -1544, 541

Hi @onkelbeh. As I understand it, the difference between raw:028 and raw:041 is that raw:028 is the start of a sequence, and raw:041 is a follow-on line - when a sequence of data is too long for a single line.

Therefore, you need to paste your received codes into a text editor and join them into one statement for retransmission. For example, in your first post above, the first two lines are:

Your problem is you are not transmitting the whole sequence, only a part of it. Edit the two lines together and you should have this:


code: [593, -1566, 1683, -494, 592, -1589, 1661, -521, 564, -1566, 1683, -521, 563, -1567, 1686, -520, 562, -1565, 1689, -493, 589, -1591, 1660, -521, 565, -1589, 1662, -520, 538, -1616, 1663, -519, 564, -1590, 566, -1568, 590, -1590, 567, -1567, 590, -1565, 591, -1591, 569, -1566, 1683, -494, 593]

I hope that helps.

5 Likes

Yep, Yes! Thanks! Now this makes all sense and finally works. Something prevented me from seeing the wood for the trees… Took a spreadsheet and calculated the medians for about 20 transmissions for each code, removed some lines with higher standard deviation, and added some more minutes to clean up the timing according to the chinese datasheet: http://www.princeton.com.tw/Portals/0/Product/PT2272.pdf. One tick there is 1 / (38000 * 2) seconds because the internal clock runs at 72kHz and is divided to generate the carrier. This led me to the 16 ms wait_time for the retransmission. The receiver has to get 2 valid transmissions in a row to get to work.

This now frees the original remote from the 4-way relais card again :slight_smile:

Here’s the final code for the PT2262 / PT2272 IR Remote Control for the Ultraluxx Motor Screen:

substitutions:
  name: esp21irtest

esphome:
  name: ${name}
  platform: ESP8266
  board: nodemcuv2

<<: !include global.yaml

remote_transmitter:
  pin: D2
  carrier_duty_percent: 50%

remote_receiver:
    pin:
      number: D5
      mode: INPUT
      inverted: true
    dump: raw


switch:
  #- platform: template
  #  name: "Optoma Toggler"
  #  turn_on_action:
  #      address: 0x4CB3
  #      command: 0x817E

  # PT2262 / PT 2272 IR Remote Control for
  # Ultraluxx Motor Screen
  
  - platform: template
    name: "Screen down"
    turn_on_action:
      remote_transmitter.transmit_raw:
        repeat:
          times: 5
          wait_time: 16ms
        code: [553, -1624, 1624, -541, 546, -1625, 1630, -533, 550, -1623, 1625, -538, 546, -1627, 1630, -537, 542, -1627, 1626, -537, 551, -1623, 1625, -534, 550, -1627, 1632, -533, 542, -1629, 1628, -539, 549, -1619, 530, -1626, 532, -1625, 535, -1622, 529, -1627, 528, -1628, 1633, -539, 1637, -534, 555]
        carrier_frequency: 38kHz
  - platform: template
    name: "Screen up"
    turn_on_action:
      remote_transmitter.transmit_raw:
        repeat:
          times: 5
          wait_time: 16ms
        code: [559, -1620, 1629, -526, 556, -1626, 1628, -535, 549, -1623, 1630, -528, 562, -1616, 1630, -526, 563, -1617, 1629, -530, 554, -1624, 1623, -538, 555, -1619, 1626, -534, 553, -1623, 1628, -533, 1646, -536, 1646, -532, 556, -1622, 527, -1629, 535, -1621, 533, -1623, 538, -1618, 536, -1620, 535]
        carrier_frequency: 38kHz
  - platform: template
    name: "Screen stop"
    turn_on_action:
      remote_transmitter.transmit_raw:
        repeat:
          times: 5
          wait_time: 16ms
        code: [560, -1617, 1630, -522, 570, -1613, 1630, -523, 561, -1621, 1632, -520, 568, -1616, 1625, -525, 571, -1615, 1633, -520, 563, -1620, 1633, -518, 572, -1613, 1630, -525, 568, -1614, 1634, -517, 569, -1617, 539, -1618, 1635, -518, 1663, -515, 567, -1619, 543, -1614, 537, -1620, 538, -1618, 536]
        carrier_frequency: 38kHz


web_server:
  auth:
    username: admin
    password: !secret api

In a next step I will add a second IR sender for the beamer, and try to use the UART to get the beamers messages.
Thanks a lot for your help!

3 Likes

Hi all, i read all the conversation, but i think my situation is a bit different:

[00:40:32][D][remote.raw:028]: Received Raw: -1299, 405, -1277, 442, -406, 1252, -337, 1346, -449, 1238, -455, 1228, -454, 1233, -1294, 437, -407, 1251, -336, 1348, -447, 1244, -452, 8010, -1298, 408, -1280, 402, -441, 1253, -433, 1250, -433, 1252, -376, 1307, -458, 1253, -1269, 440,
[00:40:33][D][remote.raw:028]: -408, 1249, -346, 1337, -453, 1261, -430, 8011, -1300, 405, -1282, 400, -443, 1252, -432, 1250, -432, 1253, -404, 1280, -459, 1254, -1270, 437, -407, 1250, -351, 1336, -428, 1284, -375, 8047, -1223, 509, -1255, 425, -352, 1311, -457, 1252, -431, 1253,
[00:40:33][D][remote.raw:028]: -431, 1232, -453, 1251, -1278, 430, -349, 1313, -456, 1253, -431, 1251, -433, 8010, -1304, 398, -1286, 435, -407, 1253, -432, 1230, -453, 1227, -453, 1234, -457, 1248, -1214, 497, -307, 1350, -417, 1271, -455, 1252, -432, 8009, -1305, 398, -1285, 400,
[00:40:33][D][remote.raw:041]: -444, 1251, -434

I have no idea on how to combine this code that i receive (it is a single command).

Unless I’m misunderstanding something fundamental (often the case), you simply edit out the bits you don’t need in a text editor. So the command you posted is:

-1299, 405, -1277, 442, -406, 1252, -337, 1346, -449, 1238, -455, 1228, -454, 1233, -1294, 437, -407, 1251, -336, 1348, -447, 1244, -452, 8010, -1298, 408, -1280, 402, -441, 1253, -433, 1250, -433, 1252, -376, 1307, -458, 1253, -1269, 440, -408, 1249, -346, 1337, -453, 1261, -430, 8011, -1300, 405, -1282, 400, -443, 1252, -432, 1250, -432, 1253, -404, 1280, -459, 1254, -1270, 437, -407, 1250, -351, 1336, -428, 1284, -375, 8047, -1223, 509, -1255, 425, -352, 1311, -457, 1252, -431, 1253, -431, 1232, -453, 1251, -1278, 430, -349, 1313, -456, 1253, -431, 1251, -433, 8010, -1304, 398, -1286, 435, -407, 1253, -432, 1230, -453, 1227, -453, 1234, -457, 1248, -1214, 497, -307, 1350, -417, 1271, -455, 1252, -432, 8009, -1305, 398, -1285, 400, -444, 1251, -434

That’s it.

It doesn’t work, i tried several pieces of the code :frowning: without success. I cloned that code with an xiaomi ir hub and it works perfectly (but it uses a different raw format of the code).

This being so, all I can suggest is that you go back to basics and take it step by step. I fully remember how frustrating it was to troubleshoot my IR transmitter project; it took weeks and drove me nuts.

But the first thing I would verify is that you are receiving the codes correctly. In my case, I ended up building two different devices, one to read, and one to transmit. I would copy the received codes over to the transmitter module, and transmit them again at the receiver module. This let me make sure that they were being received the same way, and also that they were being transmitted correctly.

On my receiver device, I also tested multiple different IR receiver modules, because they are not all made equally well, and they don’t all respond to the same frequencies. Related, I also tested a large number of different IR emitting LED, because the emitting LED needs to match the frequency of the original remote.

In my case, it turned out that I was receiving the initial codes wrong, and that my receiver YAML needed to have the receiving code inverted. Also, I needed to make sure the receiver was receiving RAW.

3 Likes

Thank you for posting this!
The code on ESPHome is fairly vague, and you helped get things recognized!

I spent a LOT of hours trying to make this work and for some reason that I still cannot explain, my IR TX will not work on any node MCU that I had. I tried using ESP-01 and it didn’t work either. Finally, I tried it on a D1 Mini and magically it worked but still it had to be very close to the IR RX

Sounds like something to do with the kind of pin you’re using. Not all pins are created equal - they’re actually sort of for different things. For example, some have input pullup and some don’t. I wonder if your issue was something like that. Out of interest, which pin on the D1 did you end up using?

Here are the pieces of my code. It works, but the D1 Mini has to be less than an inch away from the vacuum. I did the same to control a projector and I get the same behavior. Any feedback would be greatly appreciated.

substitutions:
  devicename: eufy_11_s
  devicename_friendly: Eufy 11s Vacuum
  ip_address: 192.168.X.X
  
esphome: 

  name: ${devicename}
  platform: ESP8266
  board: d1_mini_lite
  arduino_version: recommended

remote_transmitter:
  pin: D6
  carrier_duty_percent: 50% 

switch:

  - platform: template     
    name: ${devicename_friendly} Start     
    turn_on_action:       
      remote_transmitter.transmit_raw:
        code: [2843, -3137, 315, -680, 314, -1672, 319, -1670, 315, -678, 316, -1673, 315, -678, 316, -681, 314, -677, 317, -678, 316, -1672, 316, -678, 317, -1672, 316, -1672, 316, -1674, 435, -1552, 316, -678, 317, -677, 317, -678, 316, -678, 317, -677, 317, -1672, 317, -677, 321, -674, 317, -1672, 317, -680, 314, -678, 316, -1673, 315, -679, 316, -679, 316, -677, 318, -1672, 316, -1673, 316, -1673, 316, -1673, 320, -1669, 316, -1649, 349, -1664, 316, -1673, 314, -1674, 316, -1674, 315, -1674, 316, -1673, 316, -1674, 315, -1673, 317, -678, 316, -678, 317, -678, 317, -1673, 316] 
        carrier_frequency: 38kHz
        repeat:
          times: 3
          wait_time: 10ms

Hi @laca75tn, your code looks fine, but, if you are simply sending from the pin straight to the IR LED, you’re going to have a bad time. There just isn’t enough juice coming from the pin.

I solved this by building a transmitter circuit based on this circuit diagram: https://www.analysir.com/blog/2013/11/22/constant-current-infrared-led-circuit/

Don’t power it from the Wemos, let it get its juice straight from the source.