433mhz, infrared IR to and from MQTT on ESP8266

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

Can you please share a picture of 2n2222, the one you are using so that I could place online order same one?

Thanks,

1 Like

The 2n2222 is so incredibly generic, you really can’t go wrong with ordering one. Yours might look different but it’ll work the same way. Don’t hesitate, just go for it :slight_smile:

1 Like

It is indeed a standard transistor, here is a picture to see the packaging

1 Like

Thank you, I’ll buy this

I’ve been using this with great success so far, thank you very much for developing and releasing this.

One thing I’m stuck on has been programming some ‘cloning’ 433MHz remote controls I have. I’ve bought a whole heap of them to use as switches around the house and need to program the buttons on each to all have an individual (random is fine). They ‘clone’ by listening to the commands sent by another remote with the button held down for a few seconds so it repeats the command.

I’ve tried changing the pulse length parameter in the OpenMQTTGateway to a few seconds, and putting a loop in the send command section but either way it just causes it to crash.

Is there a better way for me to program these? Randomly generated strings would be great as I have 20 of them with 4 buttons each to do…

Hello,

Sorry but I don’t understand this part?
As your remote controls paced around the house only listening or also emitting?
What do they control?

Sorry i’ll explain that a bit better. The remotes clone a signal being transmitted by another source. If I hold down the button of another 433MHz remote/source while programming a button on my new remotes, they will receive that code, store it, then re-transmit when I press the button on the new remote.

My new remotes will be only transmitting, they’re basically just going to be wireless toggle commands for my lights. But to program them, they listen/receive temporarily so I need to transmit a repeated signal for a few seconds to allow this to happen.

These remotes here are what I’m referring to::

You could try to increase RF_EMITTER_REPEAT into user_config.h to 40 or more. It will repeat the RF signal 40 times. Try yo do it first with standard parameter ; don’t specify any pulselength or protocol. Just send your signal to home/commands/MQTTto433

I’ve given that a go, unfortunately setting it any higher than 40 (say even 50) causes the arduino to crash and restart. Haven’t been able to work out why so starting to strip the code down to bare essentials to see if I can get around the crashing.

@mynameisdaniel Ive made automations to repeat the signal for x amounts of minutes depending on witch state my light/switch is.

Example:

- id: unique38    
  alias: Repeat signal to 433mhz gateway
  trigger:
    platform: time
    minutes: '/5'
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: input_boolean.433herhalen
        state: 'on'
      - condition: state
        entity_id: light.keukenlamp
        state: 'on'
  action:
    - service: light.turn_on
      entity_id: light.keukenlamp

Thank you for the very nice project. Just want to ask, do you have sample yaml config for BT gateway?