User guide IR

Florian edited this page Aug 3, 2018 · 31 revisions

IR gateway

Level of complexity: middle

There is two methods for finding the IR codes you want to replicate:

  1. Point the remote control to an IR receiver see Receiving data from IR signal & Send data by MQTT to convert it on IR signal
  2. Find the code corresponding to your devices with IR global cache database https://irdb.globalcache.com/ see Send data by MQTT from Global cache database to convert it on IR signal

Here is the List of protocols supported by OMG, even if your device brand is not in the list you can still use raw IR data or GlobalCache database.

Receiving data from IR signal

If you already subscribed to mosquitto_sub -t +/# -v And press your IR remote control in front of the receiver led you should see the following messages for example:

home/IRtoMQTT/protocol 7

home/IRtoMQTT/bits 32

home/IRtoMQTT/raw 4500,4500,600,600,550,600,550,1700,600,1700,550,600,600,1700,600,600,600,550,600,600,600,600,600,1700,550,1700,600,600,600,1700,600,600,600,600,550,650,550,1700,600,1700,550,600,600,1700,550,600,600,600,550,600,550,1700,600,600,550,650,600,1700,600,600,550,1700,600,1700,550,1700,550

home/IRtoMQTT 875849879

To receive raw data you need first to modify the library pubsubclient.h by replacing #define MQTT_MAX_PACKET_SIZE 128 by #define MQTT_MAX_PACKET_SIZE 512 To enable sending larger MQTT packet.

To know the name of the protocol corresponding to the number X (X=7 in our case), go to IRRemote header file definition and go to the protocol number X, RC5 = 1, RC6 = 2... For ESP8266 For Arduino For number 7 it is samsung protocol

Unknown protocols are filtered by default, if you want to see the unknown protocols set into config_IR.h #define pubIRunknownPrtcl true instead of false

You can take this code and try to reproduce it with the gateway either by using decimal value or the raw value.

Send data by MQTT to convert it on IR signal

With the IR gateway you need to put on the topic the protocol you want to use to send the signal, the different protocols implemented are the following, the MQTT keyword to include is between "":

  • IR_GC
  • IR_Sony
  • IR_COOLIX
  • IR_Whynter
  • IR_NEC
  • IR_DISH
  • IR_Sharp
  • IR_SAMSUNG
  • IR_RC5
  • IR_RC6 (ESP8266 only)
  • IR_MITSUBISHI (ESP8266 only)
  • IR_GICABLE (ESP8266 only)
  • IR_MITSUBISHI2 (ESP8266 only)
  • IR_LASERTAG (ESP8266 only)
  • IR_CARRIER_AC (ESP8266 only)
  • IR_MIDEA (ESP8266 only)
  • IR_NIKAI (ESP8266 only)
  • IR_SHERWOOD (ESP8266 only)
  • IR_DENON (ESP8266 only)
  • IR_AIWA_RC_T501 (ESP8266 only)
  • IR_JVC (ESP8266 only)

For example if I want to send a command to a sony TV you can use the following command:

mosquitto_pub -t home/OpenMQTTGateway/commands/IR_Sony -m 3609272523

The code after the -m represent the value you want to send.

If you don’t want to use special parameters for IR just publish your data into “home/commands/MQTTtoIR”

NOTE: on arduino most of the protocols are not enable per default due to memory constraints, to enable them go to user_config.h and uncomment the #define corresponding the protocols you want:

//#define IR_COOLIX

//#define IR_Whynter

//#define IR_LG

//#define IR_Sony

//#define IR_DISH

//#define IR_RC5

//#define IR_Sharp

#define IR_SAMSUNG

Send data by MQTT from Global Caché database to convert it on IR signal

First you need to modify the library pubsubclient.h by replacing #define MQTT_MAX_PACKET_SIZE 128 by #define MQTT_MAX_PACKET_SIZE 512 To enable sending larger MQTT packet.

The website https://irdb.globalcache.com/ contains an important database of IR codes of various devices brand. By registering and asking the code you will receive a code as the example below:

code1: sendir,1:1,1,38000,1,69,340,169,20,20,20,20,20,64,20,20,20,20,20,20,20,20,20,20,20,64,20,64,20,20,20,64,20,64,20,64,20,64,20,64,20,64,20,64,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,64,20,64,20,64,20,64,20,64,20,64,20,1544,340,85,20,3663

Extract this part of the code 38000,1,69,340,169,20,20,20,20,20,64,20,20,20,20,20,20,20,20,20,20,20,64,20,64,20,20,20,64,20,64,20,64,20,64,20,64,20,64,20,64,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,64,20,64,20,64,20,64,20,64,20,64,20,1544,340,85,20,3663

and publish it to mqtt with the a subject containing IR_GC: sudo mosquitto_pub -t home/OpenMQTTGateway/commands/IR_GC -m "38000,1,1,171,171,21,64,21,21,21,21,21,21,21,21,21,21,21,21,21,64,21,64,21,21,21,21,21,21,21,21,21,21,21,21,21,64,21,21,21,21,21,21,21,64,21,21,21,21,21,21,21,21,21,64,21,64,21,64,21,21,21,64,21,64,21,64,21,64,21,1114"

You should be able to command your devices without having listened with the IR receiver or if your protocol is unknown by the IRremote library

Send data by MQTT with advanced IR parameters

IR sending support two advanced parameters; bits length and repeat number

The example below will send the following advanced parameters bits: 14 and repeat:4 times for a sony protocol:

sudo mosquitto_pub -t home/OpenMQTTGateway/commands/IR_Sony/IRBITS_14/RPT_4 -m 551534655

Send raw IR data by MQTT

  1. First you need to modify the library pubsubclient.h by replacing #define MQTT_MAX_PACKET_SIZE 128 by #define MQTT_MAX_PACKET_SIZE 512 To enable sending larger MQTT packet.

  2. If you use an arduino enable IR_Raw by uncommenting the line 129 in user_config.h #define IR_Raw If you are using the uno you will have to comment other gateway like ZgatewayBT(l60) or ZgatewayIR(l61) to keep enough memory

  3. publish your code like below mosquitto_pub -t home/OpenMQTTGateway/commands/IR_Raw -m "8950,4400,600,1650,600,600,550,600,550,550,600,550,550,600,550,600,550,600,550,550,600,1700,550,1650,600,1650,600,1650,600,1650,600,1650,600,1700,550,1700,550,1700,550,600,550,600,550,600,550,550,600,550,550,600,550,600,550,600,550,1650,600,1650,600,1650,600,1650,600,1700,550,1700,550,1700,600,1650,600,550,550,600,550,600,550,600,550,550,600,550,600,550,550,600,550,1650,600,1650,600,1700,550,1700,550,1700,600,1650,600"

Repeat the IR signal OpenMQTTGateway receive

So as to repeat the IR signal received by the gateway once set the following parameter to true in user_config.h #define repeatIRwMQTT true

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.