1technophile / OpenMQTTGateway

MQTT gateway for ESP8266 or ESP32 with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, Bluetooth, beacons detection, mi flora, mi jia, LYWSD02, LYWSD03MMC, Mi Scale, TPMS, BBQ thermometer compatibility & LoRa.
https://docs.openmqttgateway.com
GNU General Public License v3.0
3.56k stars 785 forks source link

IR signals sent by OMG with RawDirectForward not recognized by devices #1299

Closed nerk closed 8 months ago

nerk commented 1 year ago

Before submitting a problem please check the troubleshooting section https://docs.openmqttgateway.com/upload/troubleshoot.html

Describe the bug My ESP8266-based gateway is receiving IR signals just fine. It also sends (and repeats through RawDirectForward) messages, but the forwarded IR signals are simply not being recognized by the appliances. I tried NEC and SONY protocols. Sending IR commands through MQTT is working, though.

Because I suspected a hardware problem with my setup at first, I also flashed the SmartIRRepeater example. This is working flawlessly.

Next, I replaced the RawDirectForward code in ZgatewayIR.ino by

// resultToRawArray() allocates the memory we need for the array.
uint16_t *raw_array = resultToRawArray(&results);
irsend.sendRaw(raw_array, results.rawlen, 38);
delete [] raw_array;

With this change, my appliances (Sony TV and Yamaha receiver) recognize the IR signals repeated by OMG.

To Reproduce Steps to reproduce the behavior:

  1. Flash development version of OMG to ESP 8266 based gateway.
  2. Enable 'RawDirectForward'
  3. Try to redirect signals sent by an IR remote to an appliance.

Expected behavior Appliances should recognize repeated IR signals

Environment (please complete the following information):

Additional context Unless anybody can confirm that this is working and not a bug, I suspect that this has something to do with the conversion of the decoded value into the raw signal to be forwarded.

nerk commented 1 year ago

To be correct, code above should actually be

 // resultToRawArray() allocates the memory we need for the array.
 uint16_t *raw_array = resultToRawArray(&results);
 // Find out how many elements are in the array.
 uint16_t size = getCorrectedRawLength(&results);
 irsend.sendRaw(raw_array, size, 38);
 delete [] raw_array;

However, the adjusted 'size' of the raw data did not matter in my particular test.

nerk commented 1 year ago

I changed the original description of my issue, because sending IR signals via MQTT actually works with my setup, I explicitly had to specify 'bits' in JSON message. Only RawDirectForward has the problem described above.

github-actions[bot] commented 12 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 8 months ago

This issue is stale because it has been open for 90 days with no activity.

github-actions[bot] commented 8 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.