Github Boards Devices Community Docs Blog

RF 433 transmitter can not work in HA

Hi, I’m a new user of OMG,

I am using Nodemcu ESP8266 and tried to use RF transmitter to control Etekcity outlets in HA but when I turn on the switch in HA there is no signal at all.

So I started to test the simple example (RCSwitch) and it works. I can see the signal of my receiver and transmitter in the serial monitor.
Here is the result in the serious monitor
{
N: Connected with saved credentials
N: WiFi ok with manual config credentials
N: RF_EMITTER_GPIO: 3
N: RF_RECEIVER_GPIO: 0
N: Setup OpenMQTTGateway end
W: MQTT connection…
N: Connected to broker
N: Subject: /SYStoMQTT
N: Received json : {“uptime”:8,“version”:“version_tag”,“freemem”:46104,“rssi”:-65,“SSID”:"",“ip”:"",“mac”:"",“wifiprt”:0,“modules”:“RF”}
N: Subject: /SYStoMQTT
N: Received json : {“uptime”:128,“version”:“version_tag”,“freemem”:46832,“rssi”:-51,“SSID”:"",“ip”:"",“mac”:"",“wifiprt”:0,“modules”:“RF”}
}

So I flashed the program again using Arduino IDE and looks like I successfully connect to the MQTT server. See the message below.
{
Message 28 received on homeassistant/sensor/8CAAB562F597gatewayRF/config at 5:10 PM:
{
“stat_t”: “home/OpenMQTTGateway_ESP8266_RF/433toMQTT”,
“name”: “gatewayRF”,
“uniq_id”: “8CAAB562F597gatewayRF”,
“val_tpl”: “{{ value_json.value | is_defined }}”,
“device”: {
“name”: “OpenMQTTGateway_ESP8266_RF”,
“manufacturer”: “OMG_community”,
“sw_version”: “v0.9.5”,
“identifiers”: [
“8CAAB562F597”
]
}
}

In my case, I uncommented the RF module.

/-------------DEFINE THE MODULES YOU WANT BELOW----------------/
//Addons and module management, uncomment the Z line corresponding to the module you want to use

#define ZgatewayRF “RF” //ESP8266, Arduino, ESP32
//#define ZgatewayIR “IR” //ESP8266, Arduino, Sonoff RF Bridge

I also changed the pulse length

{
if ((cmpToMainTopic(topicOri, subjectMQTTtoRF)) && (valuePRT == 0) && (valuePLSL == 0) && (valueBITS == 0)) {
Log.trace(F(“MQTTtoRF dflt” CR));
mySwitch.setProtocol(1, 188);
mySwitch.send(data, 24);
// Acknowledgement to the GTWRF topic
pub(subjectGTWRFtoMQTT, datacallback);
} else if ((valuePRT != 0) || (valuePLSL != 0) || (valueBITS != 0)) {
Log.trace(F(“MQTTtoRF usr par.” CR));
if (valuePRT == 0)
valuePRT = 1;
if (valuePLSL == 0)
valuePLSL = 188;
if (valueBITS == 0)
valueBITS = 24;
}

I checked the message received in the MQTT server, which shows my Nodemcu has been connected to the server.
Here is my yaml switch setting

switch:

  • platform: mqtt
    name: IR Power
    state_topic: “home/OpenMQTTGateway_ESP8266_RF/commands/MQTTto433”
    command_topic: “home/OpenMQTTGateway_ESP8266_RF/commands/MQTTto433”
    payload_on: ‘{“value”: 349491}’
    payload_off: ‘{“value”: 16625743}’
    qos: “0”

I have struggled for 2 weeks and couldn’t find the reason and solution.
Please let me know what I’ve overlooked or done wrong.

Thank you.

I also tried to flash the older version (0.9.3) but I see the message received from the MQTT server is still v0.9.5. Did I do something wrong?

{
“stat_t”: “home/OpenMQTTGateway_ESP8266_RF/433toMQTT”,
“name”: “gatewayRF”,
“uniq_id”: “8CAAB562F597gatewayRF”,
“val_tpl”: “{{ value_json.value | is_defined }}”,
“device”: {
“name”: “OpenMQTTGateway_ESP8266_RF”,
“manufacturer”: “OMG_community”,
“sw_version”: “v0.9.5”,
“identifiers”: [

Finally, I figured it out.
I don’t why but my previous topic is “home/OpenMQTTGateway_ESP8266_RF/commands/MQTTto433”
After I removed “_ESP8266_RF”, I can control my remote outlet in HA.

Here is the original one. I think I totally forgot that I changed the topic and that is the reason I couldn’t control in HA.
state_topic: “home/OpenMQTTGateway/433toMQTT” # defined by subjectGTWRFtoMQTT in User_config.h
command_topic: “home/OpenMQTTGateway/commands/MQTTto433/PLSL_180/433_1”

1 Like