433mhz, infrared IR to and from MQTT on ESP8266

Hi, you could try the following:

#Binary sensor
- platform: mqtt
  state_topic: 'home/433toMQTT'
  name: 'PIRx'
  payload_on: 'xxxxxx'
  payload_off: 'xxxxxxoff'
  device_class: motion

#Automation
- alias: Reset PIRx state
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: binary_sensor.pirx
      to: 'on'
      for: 
         seconds: 5
  action:
    - service: mqtt.publish
      data:
        topic: "home/433toMQTT"
        payload: "xxxxxxoff"
1 Like

Perfect - much better than what I had - thanks :slight_smile:

For the next enhancements of OpenMQTTGateway I would like to have your advices, here is a poll that will take 30 seconds to fill and that will give us usefull insights:

Is there a tutorial for dummies on this :joy: Iā€™ve got a nodemcu set up on a prototyping board with RF and IR receiver and transmitter according to the schematic. Iā€™ve got it connected to the mqtt broker and set up the gateway connectivity in home assistant, which works. The serial monitor in Arduino IDE shows the IR codes. But it doesnā€™t show anything when Iā€™ve tried with RF remotes (Nexa and Cotech). Also it doesnā€™t seem to respond to the switch Iā€™ve set up in Home Assistant with the IR code. Iā€™m having trouble finding out whatā€™s wrong. Anyone else who have struggled with this?

regarding RF are you sure your devices are compatible, to check that you can look to the compatibility list, you can go also to the troubleshooting section of the wiki.
There is also example of home assistant integration in the wiki.

Iā€™ve ordered a remote from the compatible list now to test with so will see when it arrives.

Hello to all,
IĀ“m implementing a arduino rf 433mhs receiver and transmitter to control my switches. I was able with the sketch bellow to push the buttons through serial monitor and itĀ“s working fine all switches are responding to the commands.

My big question is, is it possible to integrate this with hassio? I was looking into your project but IĀ“m no programmer and very noobie in all of this so my skill is very low.

IĀ“m running hassio in a rpi , and my arduino itĀ“s a uno with rf transmitter and receiver, I also have a spare nodemcu but I didnĀ“t test the sketch.

Here bellow find the sketch IĀ“m using. Apreaciate any help:

#include <livolo.h>

byte trport =8;              // port of 433-transmitter
Livolo livolo(trport);        // transmitter connected to pin trport
int onoff = 10;               // data from Serial 
unsigned int ID = 6400;       // ID of Remote - type your own ID/ f.e. 6400; 19303; 10550; 8500; 7400
unsigned int IDB = 0;         // Number of remote's button #1: 0, #2: 96, #3: 120, #4: 24, #5: 80, #6: 48, #7: 108, #8: 12, #9: 72; #10: 40, #OFF: 106
unsigned int SCENE1 = 90;     // Number of scene (available 90, 114, 10, 18)

void setup() {
Serial.begin(9600);  // serial init
}

void loop() {

// Serial reading
// 
if (Serial.available() > 0) 
{
onoff = Serial.read()-48;
Serial.println(onoff); 
}

if (onoff == 1)
{
  livolo.sendButton(ID, IDB);
  Serial.println("Button"); 
  delay (1000);
}

if (onoff == 2)
{
  livolo.sendButton(ID, SCENE1);
  Serial.println("Scene"); 
  delay (1000);
}

if (onoff == 0)
{
  
  livolo.sendButton(ID, 106);
  Serial.println("off"); 
  delay (1000);
}
}

To integrate with Home assistant one possibility is to use MQTT, this is where OpenMQTTGateway comes and can answer your need.
Nevertheless I see on your sketch that you use livolo switches and I donā€™t know if they are compatible with the RF libraries used by OpenMQTTGateway. Maybe some other users already tested that?

1 Like

Hello tks for the quick reply, how could be one way to connect everything to check if itĀ“s possible to work?

IĀ“ve only seen some people using toghther with mysensor and appdaemon but itĀ“s too much for my knowledge.

1 Like

The simple way maybe is to connect your emitter and receiver directly to the PI and find the associated component of HA

Tks for the reply, it seems that someone have already made something here: Livolo RF433 Switches . Quick question for the rpi with hassio comunicate to arduino should I connect them via usb cable? Or should I have transmitters 433mhz and receivers in both? I couldnt understand in the documents.

You donā€™t need an arduino, just connect your receiver and emitter to raspberry pi and use something like pilight.
Nevertheless I suggest you to go to a dedicated thread related to this solution as this is not related to OpenMQTTGateway

I am trying to decide RF 433 codes,
But unable to decode
I am using nodemcu V3 by wemos but itā€™s not lolin

Hmm, did you checked the troubleshooting session of the wiki

In all the case if you donā€™t succeed after reading it we will need more details to help you

Dear,
I have tried all pins,
but am keeping on trying.
Let me know what details do you require?
thanks for taking time.

I am using wemos nodemcu V3 and for RF 433 generic transmitter and receiver,
I would like to get some suggestion.
Is it ok to use generic RF 433 transmitter and receiver, which is not working.
I am trying to get codes from geekcreit 12v 4ch relay module, but got no success.
Do you suggest any other RF 433 transmitter and receiver to get it work with Geekcreit 12v 4ch module relay?

Please guide/suggest

Product which I have
Nodemcu V3

Esp32

Geekcreit 12v 4ch

RF 433mhz

Hello. Did you add antenna to your emitter and receiver ?
If you checked the troubleshooting section , what are your results from it ?
We need more infos about what is working and what is not working.

When I subscribed to home/OpenMQTTGateway on my mosquito,
It does shows me online,
But when I publish message to home/OpenMQTTGateway I canā€™t see anything on my nodemcu connected on serial port,
I have led attached to my receiver which blinks faster/reacts when I press button of my remote,
Donā€™t understand where am I wrong.

could you post what the serial monitor say and what you are publishing?

this are the result which i get through serial monitor
connected RX-3 to transmitter and D3-0 to receiver on nodemcu v3 as provided in configRF.h

WiFi ok with manual config credentials
OpenMQTTGateway mac:
68:C6:3A:9F:9C:01
OpenMQTTGateway ip:
2047584448
1883
Connecting to MQTT by IP adress
192.168.11.33
IR_EMITTER_PIN
16
IR_RECEIVER_PIN
2
ZgatewayIR setup done
RF_EMITTER_PIN
3
RF_RECEIVER_PIN
0
ZgatewayRF setup done
ZgatewayBT HM1X setup done
MQTT connectionā€¦
Connected to broker
Subscription OK to the subjects
Uptime (s)
120
Remaining memory
40552
RSSI
-38
SSID
Jay Ambe 1
Activated modules
RFIRBT

nd while mqtt sub
mosquitto_sub -u () -P () -t +/# -v

/home/nodemcu/OpenMQTTGateway/LWT Online
/home/nodemcu/OpenMQTTGateway/version 0.8beta

dear why my opengateway ip shows a constant number and not ip?

1 Like