esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 34 forks source link

Remote reciever returning garbage #6157

Closed Phoenix-64 closed 4 weeks ago

Phoenix-64 commented 4 weeks ago

The problem

The remote receiver class I configured is just outputting garbage. The signal of the TSOP1838 ir receiver is clean, verified with an osciloscope, and it works on a Arduino UNO board using the IRremote library.

But in ESPHome I just get what looks like noise. I have already tried switching inverted to true and false, setting the mode to input and the pullup to true without a change. Changing the pin and changing the rmt_channel also did not help.

I am using an Espressif ESP32-S3-DevKitC-1u flashed with the latest version of ESPHome. Inside the example, YML in the transmit class is an example of the expected output.

Which version of ESPHome has the issue?

Version: 2024.7.1

What type of installation are you using?

Docker

Which version of Home Assistant has the issue?

Core 2024.6.4 Frontend 20240610.1

What platform are you using?

ESP32

Board

Espressif ESP32-S3-DevKitC-1u

Component causing the issue

remote_receiver

Example YAML snippet

esphome:
  name: benis-room-sensors
  friendly_name: Benis Room Sensors

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

button:
  - platform: template
    name: "Raw Code Power Button"
    on_press:
      - remote_transmitter.transmit_pronto:
          data: "0000 006D 004A 0000 01CA 00C3 0016 0011 0018 004A 0016 0012 0016 004A 0016 0012 0018 0048 0016 0012 0018 0048 0018 004A 0016 0012 0014 0012 0014 0014 0014 0012 0016 0012 0018 0048 0018 0011 0016 0012 0014 0012 0014 0014 0014 0012 0014 0014 0014 0012 0016 0012 0014 0012 0016 0012 0016 0011 0018 0011 001A 0048 0014 0012 0016 0012 0014 0012 0016 0012 0014 0012 0016 0012 0016 0011 0016 0012 0016 0012 0014 0012 0016 0012 0014 0012 0014 0014 0014 0012 0016 0012 0014 0012 0016 0012 0016 0011 0016 0012 0014 0012 0016 0012 0016 0012 0016 004A 0018 004A 0016 0011 0016 0012 0016 0011 001A 0048 0018 004A 0014 0012 0016 0012 0014 0012 0018 004A 0016 0011 0016 0012 0016 0011 0018 004A 0016 0012 0016 004A 0016 0012 0016 0011 0016 0012 0016 0011 0016 0012 0014 06C3 "

remote_receiver:
  pin:
    number: GPIO18
    inverted: True
    mode:
      input: True
      pulldown: False
      pullup: False

  rmt_channel: 7
  dump: all

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

# Enable logging
logger:
  level: DEBUG

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

ota:
  - platform: esphome
    password: "-----"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "-----"
    password: "------"

  manual_ip:
    static_ip: 192.168.1.17
    gateway: 192.168.1.1
    subnet: 255.255.255.0

captive_portal:

Anything in the logs that might be useful for us?

INFO ESPHome 2024.7.1
INFO Reading configuration config\benis-room-sensors.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing benis-room-sensors (board: esp32-s3-devkitc-1; framework: arduino; platform: platformio/espressif32@5.4.0)
--------------------------------------------------------------------------------
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 
 - toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- AsyncTCP-esphome @ 2.1.3
|-- WiFi @ 2.0.0
|-- FS @ 2.0.0
|-- Update @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.2.2
|-- DNSServer @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- noise-c @ 0.1.4
Compiling .pioenvs\benis-room-sensors\src\main.cpp.o
Linking .pioenvs\benis-room-sensors\firmware.elf
RAM:   [=         ]  12.7% (used 41524 bytes from 327680 bytes)
Flash: [=====     ]  50.0% (used 916973 bytes from 1835008 bytes)
Building .pioenvs\benis-room-sensors\firmware.bin
Creating esp32s3 image...
Successfully created esp32s3 image.
esp32_create_combined_bin([".pioenvs\benis-room-sensors\firmware.bin"], [".pioenvs\benis-room-sensors\firmware.elf"])
Wrote 0xeff70 bytes to file D:\Programming\ESPHome\config\.esphome\build\benis-room-sensors\.pioenvs\benis-room-sensors/firmware.factory.bin, ready to flash to offset 0x0
esp32_copy_ota_bin([".pioenvs\benis-room-sensors\firmware.bin"], [".pioenvs\benis-room-sensors\firmware.elf"])
========================= [SUCCESS] Took 11.18 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.1.17
INFO Uploading config\.esphome\build\benis-room-sensors\.pioenvs\benis-room-sensors\firmware.bin (917360 bytes)
Uploading: [=                                                           ] 0% Uploading: [=                                                           ] 1% Uploading: [==                                                          ] 2% Uploading: [==                                                          ] 3% Uploading: [===                                                         ] 4% Uploading: [===                                                         ] 5% Uploading: [====                                                        ] 6% Uploading: [====                                                        ] 7% Uploading: [=====                                                       ] 8% Uploading: [======                                                      ] 9% Uploading: [======                                                      ] 10% Uploading: [=======                                                     ] 11% Uploading: [========                                                    ] 12% Uploading: [========                                                    ] 13% Uploading: [=========                                                   ] 14% Uploading: [=========                                                   ] 15% Uploading: [==========                                                  ] 16% Uploading: [===========                                                 ] 17% Uploading: [===========                                                 ] 18% Uploading: [============                                                ] 19% Uploading: [============                                                ] 20% Uploading: [=============                                               ] 21% Uploading: [=============                                               ] 22% Uploading: [==============                                              ] 23% Uploading: [==============                                              ] 24% Uploading: [===============                                             ] 25% Uploading: [================                                            ] 26% Uploading: [=================                                           ] 27% Uploading: [=================                                           ] 28% Uploading: [==================                                          ] 29% Uploading: [==================                                          ] 30% Uploading: [===================                                         ] 31% Uploading: [===================                                         ] 32% Uploading: [====================                                        ] 33% Uploading: [=====================                                       ] 34% Uploading: [=====================                                       ] 35% Uploading: [======================                                      ] 36% Uploading: [=======================                                     ] 37% Uploading: [=======================                                     ] 38% Uploading: [========================                                    ] 39% Uploading: [========================                                    ] 40% Uploading: [=========================                                   ] 41% Uploading: [==========================                                  ] 42% Uploading: [==========================                                  ] 43% Uploading: [===========================                                 ] 44% Uploading: [===========================                                 ] 45% Uploading: [============================                                ] 46% Uploading: [============================                                ] 47% Uploading: [=============================                               ] 48% Uploading: [=============================                               ] 49% Uploading: [==============================                              ] 50% Uploading: [===============================                             ] 51% Uploading: [================================                            ] 52% Uploading: [================================                            ] 53% Uploading: [=================================                           ] 54% Uploading: [=================================                           ] 55% Uploading: [==================================                          ] 56% Uploading: [==================================                          ] 57% Uploading: [===================================                         ] 58% Uploading: [====================================                        ] 59% Uploading: [====================================                        ] 60% Uploading: [=====================================                       ] 61% Uploading: [======================================                      ] 62% Uploading: [======================================                      ] 63% Uploading: [=======================================                     ] 64% Uploading: [=======================================                     ] 65% Uploading: [========================================                    ] 66% Uploading: [=========================================                   ] 67% Uploading: [=========================================                   ] 68% Uploading: [==========================================                  ] 69% Uploading: [==========================================                  ] 70% Uploading: [===========================================                 ] 71% Uploading: [===========================================                 ] 72% Uploading: [============================================                ] 73% Uploading: [============================================                ] 74% Uploading: [=============================================               ] 75% Uploading: [==============================================              ] 76% Uploading: [===============================================             ] 77% Uploading: [===============================================             ] 78% Uploading: [================================================            ] 79% Uploading: [================================================            ] 80% Uploading: [=================================================           ] 81% Uploading: [=================================================           ] 82% Uploading: [==================================================          ] 83% Uploading: [===================================================         ] 84% Uploading: [===================================================         ] 85% Uploading: [====================================================        ] 86% Uploading: [=====================================================       ] 87% Uploading: [=====================================================       ] 88% Uploading: [======================================================      ] 89% Uploading: [======================================================      ] 90% Uploading: [=======================================================     ] 91% Uploading: [========================================================    ] 92% Uploading: [========================================================    ] 93% Uploading: [=========================================================   ] 94% Uploading: [=========================================================   ] 95% Uploading: [==========================================================  ] 96% Uploading: [==========================================================  ] 97% Uploading: [=========================================================== ] 98% Uploading: [=========================================================== ] 99% Uploading: [============================================================] 100% Done...

INFO Upload took 7.79 seconds, waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.1.17 using esphome API
INFO Successfully connected to benis-room-sensors @ 192.168.1.17 in 7.037s
INFO Successful handshake with benis-room-sensors @ 192.168.1.17 in 0.643s
[20:14:30][I][app:100]: ESPHome version 2024.7.1 compiled on Aug 14 2024, 20:14:05
[20:14:30][C][wifi:599]: WiFi:
[20:14:30][C][wifi:427]:   Local MAC: 80:65:99:C3:75:64
[20:14:30][C][wifi:432]:   SSID: [redacted]
[20:14:30][C][wifi:435]:   IP Address: 192.168.1.17
[20:14:30][C][wifi:439]:   BSSID: [redacted]
[20:14:30][C][wifi:440]:   Hostname: 'benis-room-sensors'
[20:14:30][C][wifi:442]:   Signal strength: -59 dB ▂▄▆█
[20:14:30][C][wifi:446]:   Channel: 13
[20:14:30][C][wifi:447]:   Subnet: 255.255.255.0
[20:14:30][C][wifi:448]:   Gateway: 192.168.1.1
[20:14:30][C][wifi:449]:   DNS1: 0.0.0.0
[20:14:30][C][wifi:450]:   DNS2: 0.0.0.0
[20:14:30][C][logger:185]: Logger:
[20:14:30][C][logger:186]:   Level: DEBUG
[20:14:30][C][logger:188]:   Log Baud Rate: 115200
[20:14:30][C][logger:189]:   Hardware UART: USB_CDC
[20:14:30][C][dht:017]: DHT:
[20:14:30][C][dht:018]:   Pin: GPIO14
[20:14:30][C][dht:020]:   Auto-detected model: DHT11
[20:14:30][C][dht:027]:   Update Interval: 30.0s
[20:14:30][C][dht:029]:   Temperature 'Benis Room Temperature'
[20:14:30][C][dht:029]:     Device Class: 'temperature'
[20:14:30][C][dht:029]:     State Class: 'measurement'
[20:14:30][C][dht:029]:     Unit of Measurement: '°C'
[20:14:30][C][dht:029]:     Accuracy Decimals: 1
[20:14:30][C][dht:030]:   Humidity 'Benis Room Humidity'
[20:14:30][C][dht:030]:     Device Class: 'humidity'
[20:14:30][C][dht:030]:     State Class: 'measurement'
[20:14:30][C][dht:030]:     Unit of Measurement: '%'
[20:14:30][C][dht:030]:     Accuracy Decimals: 0
[20:14:30][C][adc:097]: ADC Sensor 'Benis Room Brightness'
[20:14:30][C][adc:097]:   Device Class: 'voltage'
[20:14:30][C][adc:097]:   State Class: 'measurement'
[20:14:30][C][adc:097]:   Unit of Measurement: '%'
[20:14:30][C][adc:097]:   Accuracy Decimals: 2
[20:14:30][C][adc:107]:   Pin: GPIO2
[20:14:30][C][adc:109]:   Attenuation: auto
[20:14:30][C][adc:141]:   Samples: 1
[20:14:30][C][adc:142]:   Update Interval: 5.0s
[20:14:30][C][remote_transmitter:015]: Remote Transmitter...
[20:14:30][C][remote_transmitter:016]:   Channel: 0
[20:14:30][C][remote_transmitter:017]:   RMT memory blocks: 1
[20:14:30][C][remote_transmitter:018]:   Clock divider: 80
[20:14:30][C][remote_transmitter:019]:   Pin: GPIO4
[20:14:30][C][remote_transmitter:022]:     Carrier Duty: 50%
[20:14:30][C][remote_receiver.esp32:064]: Remote Receiver:
[20:14:30][C][remote_receiver.esp32:065]:   Pin: GPIO18
[20:14:30][C][remote_receiver.esp32:070]:   Channel: 7
[20:14:30][C][remote_receiver.esp32:071]:   RMT memory blocks: 1
[20:14:30][C][remote_receiver.esp32:072]:   Clock divider: 80
[20:14:30][C][remote_receiver.esp32:074]:   Tolerance: 25%
[20:14:30][C][remote_receiver.esp32:075]:   Filter out pulses shorter than: 50 us
[20:14:30][C][remote_receiver.esp32:076]:   Signal is done after 10000 us of no changes
[20:14:30][C][captive_portal:088]: Captive Portal:
[20:14:30][C][mdns:116]: mDNS:
[20:14:30][C][mdns:117]:   Hostname: benis-room-sensors
[20:14:30][C][esphome.ota:073]: Over-The-Air updates:
[20:14:30][C][esphome.ota:074]:   Address: 192.168.1.17:3232
[20:14:30][C][esphome.ota:075]:   Version: 2
[20:14:30][C][esphome.ota:078]:   Password configured
[20:14:30][C][safe_mode:018]: Safe Mode:
[20:14:30][C][safe_mode:020]:   Boot considered successful after 60 seconds
[20:14:30][C][safe_mode:021]:   Invoke after 10 boot attempts
[20:14:30][C][safe_mode:023]:   Remain in safe mode for 300 seconds
[20:14:30][C][api:139]: API Server:
[20:14:30][C][api:140]:   Address: 192.168.1.17:6053
[20:14:30][C][api:142]:   Using noise encryption: YES
[20:14:37][D][dht:048]: Got Temperature=26.4°C Humidity=48.0%
[20:14:37][D][sensor:094]: 'Benis Room Temperature': Sending state 26.40000 °C with 1 decimals of accuracy
[20:14:37][D][sensor:094]: 'Benis Room Humidity': Sending state 48.00000 % with 0 decimals of accuracy
[20:14:40][D][sensor:094]: 'Benis Room Brightness': Sending state 97.38686 % with 2 decimals of accuracy
[20:15:07][D][dht:048]: Got Temperature=26.5°C Humidity=48.0%
[20:15:07][D][sensor:094]: 'Benis Room Temperature': Sending state 26.50000 °C with 1 decimals of accuracy
[20:15:07][D][sensor:094]: 'Benis Room Humidity': Sending state 48.00000 % with 0 decimals of accuracy
[20:15:10][D][sensor:094]: 'Benis Room Brightness': Sending state 97.17204 % with 2 decimals of accuracy
[20:15:21][I][safe_mode:041]: Boot seems successful; resetting boot loop counter
[20:15:21][D][esp32.preferences:114]: Saving 1 preferences to flash...
[20:15:21][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[20:15:38][D][dht:048]: Got Temperature=26.4°C Humidity=48.0%
[20:15:38][D][sensor:094]: 'Benis Room Temperature': Sending state 26.40000 °C with 1 decimals of accuracy
[20:15:38][D][sensor:094]: 'Benis Room Humidity': Sending state 48.00000 % with 0 decimals of accuracy
[20:15:38][I][remote.pronto:234]: Received Pronto: data=
[20:15:38][I][remote.pronto:236]: 0000 006D 004A 0000 00C6 0014 0014 0017 004B 0014 0014 0016 004C 0013 0015 0016 004C 0014 0014 0017 004B 0017 004B 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0013 0015 0013 
[20:15:38][I][remote.pronto:236]: 0015 0013 0015 0013 0015 0014 0014 0014 0014 0014 0014 0014 0014 0017 004B 0013 0015 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0013 0015 0014 0014 0014 0014 0013 0015 0013 0015 0014 0014 0014 0014 0014 0014 0013 
[20:15:42][I][remote.pronto:236]: 0015 0013 0015 0013 0015 0013 0015 0013 0015 0014 0014 0014 0014 0016 004C 0017 004B 0013 0015 0014 0014 0013 0015 0016 004C 0017 004B 0014 0014 0013 0015 0013 0015 0017 004B 0014 0014 0013 0015 0014 0014 0017 004B 0014 0014 0014 
[20:15:42][I][remote.pronto:236]: 0014 0016 004C 0016 004C 0016 004C 0017 004B 0013 0015 0014 0181 06C3
[20:15:43][D][sensor:094]: 'Benis Room Brightness': Sending state 97.25439 % with 2 decimals of accuracy
[20:15:43][I][remote.pronto:234]: Received Pronto: data=
[20:15:43][I][remote.pronto:236]: 0000 006D 004A 0000 00C6 0014 0014 0017 004B 0014 0014 0017 004B 0014 0014 0017 004B 0014 0014 0017 004B 0017 004B 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0017 004B 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 
[20:15:43][I][remote.pronto:236]: 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0017 004B 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 
[20:15:43][I][remote.pronto:236]: 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0017 004B 0017 004B 0014 0014 0014 0014 0014 0014 0017 004B 0017 004B 0014 0014 0014 0014 0014 0014 0017 004B 0014 0014 0014 0014 0014 0014 0017 004B 0014 0014 0017 
[20:15:43][I][remote.pronto:236]: 004B 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0181 06C3

Additional information

No response

ssieb commented 4 weeks ago

Why do you say it looks like noise? The received signal looks very close to the example one.

Phoenix-64 commented 4 weeks ago

That is true though a few key bits, the fifth package, do not fit. And it outputs more or less always the same independent of the input signal. And the output does not work with the target device. That's why I presume that what is shown is noise. And the sensor working on the Arduino is hinting towards a mistake in the readout process by ESPHome

ssieb commented 4 weeks ago

You'll need to provide more info. Maybe come ask on the esphome discord server.

Phoenix-64 commented 4 weeks ago

If that is the preferred method I will ask there to thank you

Phoenix-64 commented 4 weeks ago

The problem was that the default idle time was too short for the initial sync pulse. Meaning it got ignored and not added to the data. This can be solved by adding idle: 30ms to the receiver. But then there is a problem with the lead-out sequence. The decoder just reads the last low as the length it takes for it to reach its time out. And then adds a proper lead-out sequence on top of that, which results in the message being longer than specified in the preamble and causing an error.

So in future, the second last sequence should be striped and replaced by 06C3 . Instead of 06C3 being added on top of it.

ssieb commented 4 weeks ago

06C3 is an arbitrary value. You don't need that. It would only affect how soon you could send another transmission and there are better ways to control that.