IR Light Switch + MQTT + ESP8266

That sounds great but I have already ordered the esp8266 board and the IR emitter which is why I thought I could link it to HA via MQTT.

Here is my configuration

Thanks.

I am not intending to use Broadlink unfortunately simply because I have ordered the ESP8266 board and the IR Emitters.

Use esp8266+MQTT+Emitter, decoding IR remote-code is a HARD working!

Trust me! I do have spended many many hard working. Finally, I gave up!

Use Broadlink, several minutes, mission accomplished. :grin:

I have decoded the IR Remote all I need now is to put the codes in the ESP8266 board and link it to HA via MQTT.

If I do fail however I will consider Broadlink.

Thanks.

how about this - just omit the RF

Thanks phileep.

I am looking into it now and wondering how to modify the IR file as it contains codes for various brands of TVs. I need to insert the codes for my IR Remote to control the IR light switch. Do you have any idea or have you done a similar project like this before?

Thanks again.

Hello,

What do you mean by IR file?
Regarding the gateway that @phileep pointed you just need to add your wifi and mqtt broker parameters, no needs to modify the IR commands.
-Set the parameters of wifi and mqtt
-upload the sketch into your esp8266
-put the IR diode with a transistor if you have
-subscribe with your borker to the topic home/sensors/ir
-press your remote control in front of the diode during several seconds
-record the code
-publish with your broker the code to the topic “home/commands/sendNEC”
-if not working try different send topics

Next step is the HA connection on which there is several subjects dealing with it.

IR File : I meant the one that contains the IR codes in my case I am not using a TV instead I have the IR codes for my switch light remote which I thought I would have to put in the file/sketch?

no you don’t need to put the codes in the file/sketch. The gateway is only a bridge between your MQTT broker and the IR signal (in both directions)
You publish a remote code from your file (by a command) to your broker and the gateway will translate it into an IR signal.

If you have mosquitto an example will be:
mosquitto_pub -t home/commands/sendSony -m 3609272523
3609272523 is the code coming from your file (copy/paste)

Cliking enter and pointing the IR diode to the right direction close enough to the device you want to control should command it.

This first step is for testing your setup.

ok I have a few questions for you:
1). I could use any IR remote i.e. not a TV Remote?
2). Can I use your setup without an IR receiver? because I have already decoded my IR remote control and have the codes.

  1. you could use other thing than a tv remote, Hifi, light, robot vaccuum …
  2. yes you can but I don’t advise because it depends on which format you stored your code, I’m not confident on this

I just tested the gateway with a cheap chinese IR led strip remote control and it worked, here is what I get in receiption

home/sensors/ir 4294967295

ok perfect !

when I publish the code to my broker to the topic “home/commands/sendNEC” will these codes be stored permanently or would I have to send it everytime?

and finally if I do not want to use rf how shall I remove it from your setup? I only want to use IR.

You will have to send it everytime but this task will be done at final by HA, and you will store the code into the HA configuration.

Regarding RF let it like that it should work the same

no I mean I am NOT going to use RF will this still work? or do I have to remove RF from the sketch etc?

yes it will work

Perfect!

Thank you very much. I will it setup and let you know if it worked for me.

Thanks once again!

Hi

I am having difficulties with the MQTT on Arduino. On Serial Monitor it says :

-2
try again in 5 seconds
Attempting MQTT connection…
failed, rc=
-2
try again in 5 seconds
Attempting MQTT connection…

and keeps on looping. I have uploaded the code successfully and the board is 2.3.0 it is a Wemos D1.

Can you please help?

Hi,

check that:
-your broker is installed and running
-the sketch is modified to connect to your broker,parameters below modified
#define wifi_ssid “wifi ssid”
#define wifi_password “wifi pwd”
#define mqtt_server “mqtt server ip adress”

-if you broker need authentication set this:
#define mqtt_user “your_username”
#define mqtt_password “your_password”
and uncomment line 165 and comment line 168

play again,

PS: please avoid posting the same question on several places

Hi thanks for the reply and apologies for posting it many times.

I wanted to ask you what do you mean by “broker is installed and running?”

Thanks.