433mhz, infrared IR to and from MQTT on ESP8266

Here is my HA sensor config for a DHT temp/humidity sensor

- platform: mqtt
  name: "MQTT RF Temperature"
  state_topic: "home/433toMQTT/dht1/temp"
  unit_of_measurement: "°C"
  value_template: '{{ value | round(2)  }}'

- platform: mqtt
  name: "MQTT RF Humidity"
  state_topic: "home/433toMQTT/dht1/hum"
  unit_of_measurement: "%"
  value_template: '{{ value | round(2)  }}'

Added to the wiki thanks

Just published a new release V0.3 with the following content:

  • Add BLE beacons detection thanks to HM10 keyes module
  • Add the possibility to pass raw data to and from mqtt from and to IR
  • Add the ability to handle RF codes with different bit length than 24
  • Add RF and IR repeater function
  • Add the possibility to filter unknown protocols for IR
  • Add the possibility to take into account Sony IR protocol special parameters
  • Correct DHT wrong pin assignement
  • Add an option to don’t resend dht temperature and humidity when there is no value change
  • Change to GPL V3 license to prepare future libraries add
1 Like

Hey,

i tried to flash the code to my NodeMCU (ESP8266). But everytime i try to compile the code i get this errors:
ZgatewayIR:32: error: 'IRrecv' does not name a type
ZgatewayIR:33: error: 'IRsend' does not name a type

I have the following libs installed:
IRRemote
IRRemoteEsp8266
PubSubClient
rc-switch

Does anybody have a solution for this problem?

Hello,

Yes your receive this message because you took the last version of irremoteesp8266 library instead of the linked one.
The library linked into the openmqttgateway is the 1.2.0.
Here is the link that you have into the libraries folder:

Nah, my mistake… Do you plan to update your scripts to work with the 2.0

Yes of course @crankyoldgit is making good improvements, i will integrate them as far as i can.

1 Like

IS it possible to use Esp8266 01 board?

Hello,

No you will not have enough pins

If I only want to use the RF receive module?

Yes seems to have enough pins but I remenber a user tested it and didn’t succeed. You can try but It s not the board i recommend.

I was trying now. I got a memory error while uploading. I give up :slight_smile:

Hi,
Do you use Energenie plug with the OpenMQTTGateway ?
If yes, what are the RF codes pleases ?

Thanks.

Not directly, I actually use the energenie two way pi-mote with my own driver.

I do however, have a gateway listening to the codes the energenie remote sends, which you should be able to use to transmit from the openmqttgateway.

        switch (MQTTvalue) {
          case 4000398:  // rc button 1 off 

          case 4000399:  // rc button 1 on

          case 4000390:  // rc button 2 off 

          case 4000391:  // rc button 2 on

          case 4000394:  // rc button 3 off 


          case 4000395:  // rc button 3 on

            break;
          case 4000386:  // rc button 4 off 
            break;
          case 4000387:  // rc button 4 on
            break;
          case 4000396:  // rc button all off 

          case 4000397:  // rc button 4 on

@1technophile

After uploading the sketch getting following message in serial monitor:

SmartLink

OpenMQTTGateway ip adress:

0.0.0.0


WiFi connected

Attempting MQTT connection…

connected to broker

subscription OK to the subjects defined

Is it normal that when nodemcu connect with wifi it shows “OpenMQTTGateway ip adress:
0.0.0.0”

shouldn’t it shows a IP address instead of 0.0.0.0?

I didn’t change following lines in the sketch:

#else // for arduino + W5100

const byte mac[] = { 0xDE, 0xED, 0xAB, 0xFE, 0x23, 0x21 }; //W5100 ethernet shield mac adress

#endif

The values below are optional if you want to use these parameters uncomment line 158 of OpenMQTTGateway.ino

const byte ip[] = { 192, 168, 1, 99 }; // ip adress

const byte gateway[] = { 192, 168, 1, 1 }; //ip adress

const byte dns[] = { 192, 168, 1, 1 }; //ip adress

const byte subnet[] = { 255, 255, 255, 0 }; //ip adress

should I replace mac address of my nodemcu?
My wifi router ip address is: 192.168.1.1

but when I run “sudo mosquitto_sub -t home/# -v” in putty it says “Connection Refused: not authorised.”

Hello,

Please avoid posting the same message on different topics. This will not bring more reactivity or more qualitative answers, it will only pollute the topics on which the answer will not be given.

This means that you have a problem with your broker authentication and this is not related with OpenMQTTGateway.
If your broker is installed locally I suggest to remove authentication on it for your first tests.

1 Like

I’ll make sure not to post on different topics again, really sorry for that.

I got it working, needed to put -u and -P like below:
mosquitto_sub -u username -P password -t home/# -v

@1technophile Thank you for your hard work, keep it up…

1 Like

No problem, great to heard it worked, enjoy!

1 Like

Hi,
I am receiving IR code on Serial Monitor and putty as well and I declare it on HA, when I turn on light through HA it sends command as I can see in Serial Monitor “Hey I got a callback
16503341”

IR code is “16503341”

but light is not turning on, I also have put simple LED instead of IR LED but simple led is not turning on when I send command through HA/MQTT even I press button on the remote nothing happening.

Led light blink when I re-plug NodeMCU or open serial monitor.

I am using following transistor:

Hello,

If the normal led doesn’t light on this is mostly an issue related to your hardware setup. I will advise to go to the preconized transistor 2N2222.

1 Like