MQTT IR transmiter/receiver

Next version is available https://github.com/enc-X/mqtt-ir-transceiver , new features:

  • Code migrated to platformio
  • Support for Global Cache IR database codes
3 Likes

Nice :smile:

I have to check how I can build a similiar thing with the ESPs I have lying around in my workshop area.

Hi mix_at_pl

Thanks for this.

Just wanted to find out where do I input the data for wifi and mqtt ? is it in the main.cpp?

Thanks

Hi

I am getting this error in the code on platformio:

collect2: error: ld returned 1 exit status
*** [.pioenvs/esp01_1m/firmware.elf] Error 1

Can you please help?

Thanks.

Hi Phile

Do you know how to use platformio?

I am struggling with this.

Can you please help?

Thanks.

I just went through building and programming the IR MQTT tranceiver and want to thank mix_at_pl for the great work.

The building is straight forward following the schematic.
For the programming I installed the Platformio IDE following the instructions from http://docs.platformio.org/en/stable/ide/atom.html. You need to have Python 2.7.x installed for it to work correctly.
Once Platformio is loading with no errors, click on “Open Project” and select the folder mqtt-ir-transceiver-master (which is downloaded and unzipped from https://github.com/enc-X/mqtt-ir-transceiver/archive/master.zip).
From the list with files in the left tab open the platformio.ini and change the upload_port = com12 to the correct port with your ESP8266
Select “PlatformIO/Build” from the menu on top and wait for the build to finish. The needed libraries will be downloaded and installed automatically.
If no errors you will see “No issues” message on the bottom.
Next click “PlatformIO/upload” and keep an eye on the messages. If the COM port is not correct you’ll see errors ( error: Failed to open com12 etc).
Once successfully uploaded, reboot your ESP.

1 Like

After the reboot your new IR/MQTT ESP will broadcast an SSID that looks like this - IRTRANS-XXXXXX.
Connect to that SSID and a configuration page should open. If not find what is your gateway and paste that IP in your browser.
In that config page you need to configure the real WiFi network you want to connect to, the MQTT server IP and the prefix for your MQTT messages.

:slight_smile: Just noticed that mix_at_pl has updated the GitHub read.me with the instructions.
Again thank you for the great work:).

I already have mosquitto running TLS secured and really like to keep it that way.
Is there any chance to use your fine tool via mqtts (TLS)? I don’t mean certificate based authentication, but an encrypted connection to the broker would be great.

Hello,

I will try to do this, but I can’t guarantee that it will happen in 2 or 3 weeks :slight_smile:
As I know TLS support with MQTT on ESP it should work.

1 Like

It took more then 3 weeks :slight_smile: but I’ve just uploaded TLS-enabled version of code.

1 Like

I can send the NEC and SAMSUNG codes, but I could not send the raw codes through the broker. Could you give me an example of the topic and message to be published?

Take a look at esp easy has a IR option with sending raw code

1 Like

Either with @mix_at_pl implementation or OpenMQTTGateway you should take a look also to the sendGC function. Global cache database contains a lot of IR codes that you will be able to send with both gateways.

https://irdb.globalcache.com

I followed your short guide, but cannot compile the project. :frowning:

[06/19/17 20:49:34] Processing esp01_1m (build_flags: -DMQTT_MAX_PACKET_SIZE=1500; lib_install: 89, 567, 64; platform: espressif8266; board: d1_mini;
framework: arduino; upload_port: com5; lib_deps: https://github.com/markszabo/IRremoteESP8266/archive/master.zip)
 
Detected non-PlatformIO `lib_install` option in `[env:]` section
Verbose mode can be enabled via `-v, --verbose` option
Collected 28 compatible libraries
Looking for dependencies...

Library Dependency Graph
|-- <IRremoteESP8266> v2.0.3
|-- <EEPROM> v1.0
|-- <DNSServer> v1.1.0
|   |-- <ESP8266WiFi> v1.0
|-- <PubSubClient> v2.6
|-- <WifiManager> v0.12
|   |-- <DNSServer> v1.1.0
|   |   |-- <ESP8266WiFi> v1.0
|   |-- <ESP8266WiFi> v1.0
|   |-- <ESP8266WebServer> v1.0
|   |   |-- <ESP8266WiFi> v1.0
|-- <ArduinoJson> v5.10.1
|-- <ESP8266httpUpdate> v1.1
|   |-- <ESP8266HTTPClient> v1.1
|   |   |-- <ESP8266WiFi> v1.0
|   |-- <ESP8266WiFi> v1.0
|-- <ESP8266WiFi> v1.0
|-- <ESP8266WebServer> v1.0
|   |-- <ESP8266WiFi> v1.0
Compiling .pioenvs\esp01_1m\src\common.o
Compiling .pioenvs\esp01_1m\src\debug.o
Compiling .pioenvs\esp01_1m\src\globals.o
Compiling .pioenvs\esp01_1m\src\main.o
In file included from src\common.cpp:1:0:
src\globals.h:99:9: error: 'IRrecv' does not name a type
extern IRrecv irrecv;
^
src\globals.h:100:9: error: 'IRsend' does not name a type
extern IRsend irsend;
^
src\globals.h:114:22: error: variable or field 'getIrEncoding' declared void
void  getIrEncoding (decode_results *results, char * result_encoding);

src\globals.h:114:22: error: 'decode_results' was not declared in this scope
src\globals.h:114:38: error: 'results' was not declared in this scope
void  getIrEncoding (decode_results *results, char * result_encoding);
^
src\globals.h:114:47: error: expected primary-expression before 'char'

void  getIrEncoding (decode_results *results, char * result_encoding);
^
src\common.cpp:139:22: error: variable or field 'getIrEncoding' declared void
void  getIrEncoding (decode_results *results, char * result_encoding)
^
src\common.cpp:139:22: error: 'decode_results' was not declared in this scope
src\common.cpp:139:38: error: 'results' was not declared in this scope
void  getIrEncoding (decode_results *results, char * result_encoding)
^
src\common.cpp:139:47: error: expected primary-expression before 'char'
void  getIrEncoding (decode_results *results, char * result_encoding)
^
In file included from src\globals.cpp:1:0:
src\globals.h:99:9: error: 'IRrecv' does not name a type
extern IRrecv irrecv;
^
src\globals.h:100:9: error: 'IRsend' does not name a type
extern IRsend irsend;
^
src\globals.h:114:22: error: variable or field 'getIrEncoding' declared void
void  getIrEncoding (decode_results *results, char * result_encoding);
^
src\globals.h:114:22: error: 'decode_results' was not declared in this scope
src\globals.h:114:38: error: 'results' was not declared in this scope
void  getIrEncoding (decode_results *results, char * result_encoding);
^
src\globals.h:114:47: error: expected primary-expression before 'char'
void  getIrEncoding (decode_results *results, char * result_encoding);
^
src\globals.cpp:41:1: error: 'IRrecv' does not name a type
IRrecv irrecv(RECV_PIN);

[..]


src\main.cpp:270:37: error: 'getIrEncoding' was not declared in this scope
getIrEncoding (&results, myTmp);
^
src\main.cpp:292:43: error: 'USECPERTICK' was not declared in this scope
myString+= (results.rawbuf[i] * USECPERTICK);
^
src\main.cpp:330:7: error: 'irsend' was not declared in this scope
irsend.sendRaw(rawIR1, rawIR1size, TRANSMITTER_FREQ);
^
src\main.cpp:346:7: error: 'irsend' was not declared in this scope
irsend.sendRaw(rawIR2, rawIR2size, TRANSMITTER_FREQ);
^
src\main.cpp:361:9: error: 'irsend' was not declared in this scope
irsend.sendRaw(rawIR2, rawIR2size, TRANSMITTER_FREQ);
^
src\main.cpp:377:9: error: 'irsend' was not declared in this scope
irsend.sendRaw(rawIR1, rawIR1size, TRANSMITTER_FREQ);
^
*** [.pioenvs\esp01_1m\src\common.o] Error 1
*** [.pioenvs\esp01_1m\src\debug.o] Error 1
*** [.pioenvs\esp01_1m\src\globals.o] Error 1
*** [.pioenvs\esp01_1m\src\main.o] Error 1
 [ERROR] Took 1.60 seconds

I have no experiance with PlatformIO, yet
What am I doing wrong?

markszabo released a new version of IRremoteESP8266 in June. v2.0 is a complete rewrite hence all the compile errors. You will need to reference the old IRremoteESP8266 code in the PlatformIO.ini file. Change
lib_deps = https://github.com/markszabo/IRremoteESP8266/archive/master.zip
to
lib_deps = https://github.com/markszabo/IRremoteESP8266/archive/v1.2.0.zip

You will of course not be able to take advantage of all markszabo’s continuing improvements.
The alternative is follow markszabo’s notes on how to update (mix_at_pl’s) code - beyond my skills but perhaps mix_at_pl would like to take a look at it…

Yes - thats reason of problem. Temporarly I’ll update repo and start work on mingration to the new version of IRemote. Thanks toggsiii.

Module now works with current version of IRremoteESP8266 library.

1 Like

I cannot compile the project:



Project
mqttir001
.vscode
docs
lib
src
.gitignore
.travis.yml
platformio.ini
README.md
You can split a pane with pane:split-right
16.7 s
platformio run
[01/24/18 10:37:51] Processing esp01_1m (platform: espressif8266; lib_deps: 89, 567, 64, https://github.com/markszabo/
IRremoteESP8266.git; build_flags: -DMQTT_MAX_PACKET_SIZE=1500; board: esp01_1m; framework: arduino)
 
Verbose mode can be enabled via `-v, --verbose` option
Collected 35 compatible libraries
Scanning dependencies...

Library Dependency Graph ( http://bit.ly/configure-pio-ldf )
|-- <PubSubClient> v2.6
|-- <WifiManager> v0.12
|   |-- <ESP8266WiFi> v1.0
|   |-- <ESP8266WebServer> v1.0
|   |   |-- <WiFi> v1.2.7
|   |   |   |-- <SPI> v1.0
|   |   |-- <ESP8266WiFi> v1.0
|   |-- <DNSServer> v1.1.0
|   |   |-- <WiFi> v1.2.7
|   |   |   |-- <SPI> v1.0
|-- <ArduinoJson> v5.13.0
|-- <IRremoteESP8266> v2.3.1 #fce4ccf
Linter
Severity 	Provider 	Description	Line 

interesting
sadly got an IRrecv does not name a type, have to do some further digging