AdamKGoddard / XiaomiIR_ESPHome

Custom ESPHome Firmware for the Xiaomi IR Controller
GNU General Public License v3.0
21 stars 7 forks source link

Only the first IR Transmitter is work #10

Open yauyauwind opened 7 months ago

yauyauwind commented 7 months ago

Hello AdamKGoddard,

I use with HA and ESPhome latest version, and I use to remote my Panasonic LED Lamp I use Receive RAW code to capture 3 button Power off, Night Mode, Light Mode

Here is my ESPHome Config file

remote_receiver: pin: number: GPIO27 inverted: True
dump: raw idle: 40ms

remote_transmitter: pin: number: GPIO26 inverted: True carrier_duty_percent: 50% id: xiaomi

switch:

I found that, the Transmit button can be work only the once If I press the button on off then the Night and Light is not work after I reboot the XiaomiIR, then I can work only once on any button like: I press Night mode, then work, after that press Power off button is not work mean the IR can be only work once on the first times booted

I confirm the capture code is work, how can I fix this issue??

Many Thanks~

AdamKGoddard commented 6 months ago

Sorry, I was away on holidays. I just checked using your examples, not rebooting? Is your device getting hot? Did you add the correct files as per the guide?

Here's my log output while pressing random buttons:

18:28:31 [D] [switch:012]
'BedRoom LED OFF' Turning ON. 18:28:31 [I] [remote.raw:041]
Received Raw: 223, -1597, 117, -3241, 178, -4170, 72, -5066, 148, -4946, 127, -2075, 197, -6194, 164, -1466, 89, -2964, 128, -3754, 80, -4135, 71, -441, 427, -6721, 85, -7548, 102, -13276, 199 18:28:32 [D] [switch:012]
'BedRoom LED Night' Turning ON. 18:28:32 [I] [remote.raw:041]
Received Raw: 353, -3002, 96, -222, 100, -3102, 166, -6025, 187, -669, 302, -6494, 170, -307, 82, -1846, 318, -12583, 351, -2978, 338, -761, 109, -435, 78, -3409, 281 18:28:32 [D] [switch:012]
'BedRoom LED Night' Turning ON. 18:28:32 [I] [remote.raw:041]
Received Raw: 135, -1402, 72, -2474, 102, -3396, 364, -309, 229, -2413, 156, -2422, 168, -2356, 160, -2601, 286, -1300, 84, -16925, 206, -4946, 158, -12652, 117 18:28:33 [D] [switch:012]
'BedRoom LED Light' Turning ON. 18:28:34 [I] [remote.raw:041]
Received Raw: 171, -489, 462, -1212, 68, -992, 274, -13114, 170, -31302, 268, -13557, 179 18:28:34 [D] [switch:012]
'BedRoom LED Light' Turning ON. 18:28:34 [I] [remote.raw:041]
Received Raw: 547, -283, 742, -1734, 233, -5333, 194, -6909, 129, -2446, 117, -11354, 246, -4480, 219, -6558, 251, -382, 464, -5831, 84, -1637, 77, -2452, 134, -1322, 168 18:28:35 [D] [switch:012]
'BedRoom LED Night' Turning ON. 18:28:35 [I] [remote.raw:041]
Received Raw: 110, -22949, 164, -4925, 224, -407, 70 18:28:35 [D] [switch:012]
'BedRoom LED Night' Turning ON. 18:28:35 [I] [remote.raw:041]
Received Raw: 170, -4973, 160, -4141, 220, -9986, 177, -5907, 90, -2485, 76, -2041, 76, -2633, 117, -15504, 68, -10066, 71, -5765, 85 18:28:36 [D] [switch:012]
'BedRoom LED OFF' Turning ON. 18:28:36 [I] [remote.raw:041]
Received Raw: 166, -8334, 84, -4602, 101, -9300, 128, -4894, 189, -4500, 117, -7328, 80, -9140, 196, -494, 89, -9527, 83 18:28:36 [D] [switch:012]
'BedRoom LED OFF' Turning ON. 18:28:36 [I] [remote.raw:041]
Received Raw: 78, -25233, 437, -10841, 262, -3278, 104, -527, 319, -395, 401, -1470, 79, -6562, 150, -8733, 88

yauyauwind commented 6 months ago

Hello AdamKGoddard,

Happy Holiday, and I have verified my config once, I confirm both pre_extra_script.py and remote_transmitter_esp32.cpp in config/esphome folder

image

and I just modify the xiaomi_ir.yaml for the token and leave the GPIO setting to default

I have no idea why the only 1st times shoot the transmit is work

Thanks~

madspeed commented 4 months ago

I have the same issue. I manage to get switch working only one time after reboot. Did you manage to fix it?

madspeed commented 4 months ago

This is what I get:

1``` 5:21:36 [D] [switch:012] 'Power' Turning ON.
15:21:36 [W] [component:214] Component web_server took a long time for an operation (0.07 s).
15:21:36 [W] [component:215] Components should block for at most 20-30ms.
15:21:36 [I] [remote.jvc:049] Received JVC: data=0x20DF
15:21:36 [I] [remote.lg:054] Received LG: data=0x20DF10EF, nbits=32
15:21:36 [I] [remote.nec:098] Received NEC: address=0xFB04, command=0xF708 command_repeats=1
15:21:36 [I] [remote.pioneer:149] Received Pioneer: rc_code_X=0x2008
15:21:36 [I] [remote.pronto:233] Received Pronto: data=
15:21:36 [I] [remote.pronto:235] 0000 006D 0022 0000 0133 009B 0016 0016 0014 0018 0016 003F 0016 0016 0014 0018 0016 0017 0016 0016 0016 0016 0016 003F 0016 003F 0014 0018 0016 003F 0016 003F 0014 0041 0016 003F 0016 003F 0016 0017 0016 0016 0016 0016 0016 003F
15:21:36 [I] [remote.pronto:235] 0016 0017 0015 0016 0016 0016 0016 0017 0016 003F 0014 0041 0016 003F 0016 0016 0016 003F 0016 003F 0016 003F 0016 003F 001A 0181 06C3
15:21:40 [D] [switch:012] 'Power' Turning ON.
15:21:41 [W] [component:214] Component web_server took a long time for an operation (0.07 s).
15:21:41 [W] [component:215] Components should block for at most 20-30ms.
15:21:41 [I] [remote.pronto:233] Received Pronto: data=
15:21:41 [I] [remote.pronto:235] 0000 006D 0029 0000 000C 0008 0019 000A 0060 000D 000F 000D 0022 0011 002F 0009 000A 009F 0012 0023 0009 001E 000F 003D 0008 0024 0017 0042 0015 0017 0016 0023 0009 0047 000D 0041 0015 001B 0010 0043 0013 003D 0017 003E 0007 000A
15:21:41 [I] [remote.pronto:235] 0006 003E 0017 003E 0017 0016 0014 001F 0006 0025 0010 003E 0016 0016 0017 0015 0017 0019 0004 000A 0007 0014 000E 0047 0017 003E 0017 003F 0015 0024 0008 003E 0018 003D 0016 003F 000C 0048 001F 0181 06C3


So remote.lg is used only once when first time pressed
AdamKGoddard commented 4 months ago

Can you send the config? I couldn't replicate the other issue

madspeed commented 4 months ago
esphome:
  name: esphome-xiaomi-ir
  friendly_name: ESPHome Xiaomi IR
  platformio_options:
    extra_scripts: 
      - pre:/config/esphome/pre_extra_script.py

esp32:
  board: esp32doit-devkit-v1
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_FREERTOS_UNICORE: y
    advanced:
      ignore_efuse_mac_crc: true

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: 

ota:
  password: "46d0d39267fe6ec26c27d5e1aeb19b4a"

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

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

captive_portal:

web_server:
  port: 80

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO32
      inverted: False
    name: ${friendly_name} Button A

  - platform: gpio
    pin:
      number: GPIO33
      inverted: False
    name: ${friendly_name} Button B

  - platform: gpio
    pin:
      number: GPIO34
      inverted: False
    name: ${friendly_name} Button C

  - platform: gpio
    pin:
      number: GPIO35
      inverted: False
    name: ${friendly_name} Button D

status_led:
  pin:
    number: GPIO18  #Orange LED - flashes for status events
    inverted: True

output:
  - platform: gpio
    pin: GPIO23     #Blue LED - Powered on always
    id: PowerLED
    inverted: False #Change to True to disable the power LED

sensor:
  - platform: wifi_signal
    name: ${friendly_name} WiFi Signal

  - platform: uptime
    name: ${friendly_name} Uptime

switch:
  - platform: restart
    name: ${friendly_name} Restart

  - platform: template
    name: "Power"
    turn_on_action:
      - remote_transmitter.transmit_lg:
          data: 0x20DF10EF
          nbits: 32

remote_receiver:
  pin:
    number: GPIO27
    inverted: True
  dump: all

remote_transmitter:
  pin:
    number: GPIO26
    inverted: True
  carrier_duty_percent: 50%
  id: xiaomi
AdamKGoddard commented 4 months ago
19:53:18 | [I] | [remote.nec:098] | Received NEC: address=0xFB04, command=0xF708 command_repeats=1 19:53:18 | [I] | [remote.pronto:233] | Received Pronto: data= 19:53:18 | [I] | [remote.pronto:235] | 0000 006D 0022 0000 0134 009A 0017 0015 0016 0016 0014 0041 0017 0015 0017 0015 0014 0018 0017 0015 0017 0016 0015 003F 0017 003E 0017 0015 0016 003F 0018 003D 0016 003F 0018 003D 0017 003D 0016 0016 0018 0014 0017 0016 0015 003F 19:53:18 | [I] | [remote.pronto:235] | 0017 0015 0017 0015 0016 0016 0014 0018 0017 003E 0016 003F 0017 003E 0017 0016 0015 003F 0017 003E 0017 003D 0016 003F 001D 0181 06C3 19:53:19 | [D] | [switch:012] | 'Power' Turning ON. 19:53:19 | [I] | [remote.pronto:233] | Received Pronto: data= 19:53:19 | [I] | [remote.pronto:235] | 0000 006D 0017 0000 0002 0081 0007 002E 000C 0040 000E 00D8 0005 0077 000A 0016 0006 0054 0002 0059 0002 0136 0003 0093 0002 0011 0003 00A6 0004 004C 0003 00A1 0009 0036 0004 0021 000A 006D 0016 00D2 0004 003F 0005 004F 0005 000D 19:53:19 | [I] | [remote.pronto:235] | 0004 00A2 000E 0181 06C3 19:53:22 | [D] | [switch:012] | 'Power' Turning ON. 19:53:22 | [I] | [remote.pronto:233] | Received Pronto: data= 19:53:22 | [I] | [remote.pronto:235] | 0000 006D 0013 0000 0007 001B 0004 0011 000B 010D 0005 0032 0002 00B3 0003 002A 0003 0180 0002 00A5 0004 003E 000C 0049 0009 00D0 0003 0007 000C 002A 0003 0080 0005 0093 0009 005D 0005 0020 000C 00A5 0004 0181 06C3 19:53:23 | [D] | [switch:012] | 'Power' Turning ON. 19:53:23 | [I] | [remote.pronto:233] | Received Pronto: data= 19:53:23 | [I] | [remote.pronto:235] | 0000 006D 0008 0000 0006 000C 0003 0086 0006 017A 0002 0097 000E 004F 0005 0009 0003 0079 0008 0181 06C3 19:53:23 | [I] | [remote.pronto:233] | Received Pronto: data= 19:53:23 | [I] | [remote.pronto:235] | 0000 006D 0007 0000 0006 00CD 000A 0054 0004 007C 0005 0040 000A 0049 0006 0009 0008 0181 06C3 19:53:24 | [D] | [switch:012] | 'Power' Turning ON. 19:53:24 | [I] | [remote.pronto:233] | Received Pronto: data= 19:53:24 | [I] | [remote.pronto:235] | 0000 006D 0019 0000 0006 0036 0007 000B 000A 0031 0007 0034 0004 0012 0005 0015 000E 0007 0002 00BB 0008 000C 0003 00D6 0003 00AE 0003 003E 0007 000D 0002 004C 0009 007D 0003 0052 0006 0091 0003 00B3 000C 00AA 0003 0024 0008 0027 19:53:24 | [I] | [remote.pronto:235] | 0007 0150 0006 00E7 0003 0057 0006 0181 06C3 19:53:24 | [D] | [switch:012] | 'Power' Turning ON. 19:53:24 | [I] | [remote.pronto:233] | Received Pronto: data= 19:53:24 | [I] | [remote.pronto:235] | 0000 006D 0001 0000 0007 0181 06C3 19:53:24 | [I] | [remote.pronto:233] | Received Pronto: data= 19:53:24 | [I] | [remote.pronto:235] | 0000 006D 0015 0000 0004 006E 0004 00D2 0006 002F 000F 00A6 0003 0041 0005 004E 0016 004D 0008 0016 0006 000D 0003 0027 0006 007A 0007 0020 000C 001B 0007 0008 0003 0028 0004 0022 000B 003E 0008 00B4 0004 0027 0005 00F6 0008 0181 19:53:25 | [I] | [remote.pronto:235] | 06C3 19:53:25 | [D] | [switch:012] | 'Power' Turning ON. 19:53:25 | [I] | [remote.pronto:233] | Received Pronto: data= 19:53:25 | [I] | [remote.pronto:235] | 0000 006D 0006 0000 0011 0012 0003 0023 0016 002D 000C 000F 0007 0032 0004 0181 06C3 19:53:25 | [I] | [remote.pronto:233] | Received Pronto: data= 19:53:25 | [I] | [remote.pronto:235] | 0000 006D 0011 0000 0002 00AE 0004 0016 0008 004D 0006 0052 0006 0078 0007 004E 0007 0150 0005 003A 0004 00AA 0003 001F 000D 006B 000C 0049 0007 004E 0016 001B 0009 004C 0012 0041 0014 0181 06C3 19:53:26 | [D] | [switch:012] | 'Power' Turning ON. 19:53:26 | [I] | [remote.pronto:233] | Received Pronto: data= 19:53:26 | [I] | [remote.pronto:235] | 0000 006D 0015 0000 0008 0074 0007 0154 000E 00A7 0006 0027 0005 001A 0006 0029 0007 002D 0009 0028 0006 0125 0004 003E 0006 005D 0008 00D2 0003 001D 0005 0034 0003 006B 0005 000E 0003 00C3 0007 00B3 0006 00C3 0006 004E 0007 0181 19:53:26 | [I] | [remote.pronto:235] | 06C3 19:53:29 | [D] | [esp-idf:000] | W (36711) MQTT_CLIENT: Connection refused, not authorized 19:53:29 | [D] | [esp-idf:000] | E (36715) MQTT_CLIENT: MQTT connect failed 19:53:29 | [E] | [mqtt.idf:160] |  

Works fine for me?

AdamKGoddard commented 4 months ago

Or are you expecting to see exactly what you transmit on the receive? I wouldn't always consider that a reliable signal input whilst transmitting is occuring. I would consider receive as best effort and there are so many reflections and other IR noise to consider. It may bring it out of a guaranteed LG receive and Pronto or Raw would be close enough within a few ms timings to be fair.

madspeed commented 4 months ago

Should there be any information in the log about what I transmit?