Github Boards Devices Community Docs Blog

Sonoff RF-Bridge R2 v1

Hi there

Today i applied the hardware mod to my sonoff RF-Bridge.

I updated the code to the master branch, commented out the RF Module, and set the MAX_PACKET_SIZE to 1024 in PubSubClient.h.

I can see on the serial connection, that the bridge receives various 433 data.

The bridge also seems to connect to the MQTT-Broker just fine, since the restart and erase commands published to the appropriate topic do work.

However, the gateway’s topic 433toMQTT does not get updated at all.
Tracing incoming packets shows the packets actually arrive on the broker’s network interface. Setting its debug level doesn’t have an effect.

What the hell am i doing wrong?

Hi,

Which RF module did you activated in replacement (RF, RF2,or Pilight)?

I activated the first one (RF)

You don’t need to do this anymore. It is now choosen dynamically following the board.

How do you see this if you applied the mod? Are you checking on the EFM directly?

Are you sure your emitter device can be decoded with RCSwitch?

The device i use is the Sonoff RF-Bridge R2 v1.0 which i modified accodring to this guide

I can see that it’s working by monitoring the serial connection to the ESP8285 i used for flashing.
It displays the JSON-data of the received commands and shows, for example, when i send a command like restart to the MQTTtoSYS topic

When you use your emitter device, do you see a red light flashing?

No, i applied the direct mod, so i’m working around the chip that controls those leds.

From what I recall the led continue to light ON when a signal is received. Even with the mod. (Not sure 100 % )
Do you have other emitter to exclude an issue with your RF emitter device ?

As i’ve stated before, the correct JSON of the received RF Codes shows on the serial interface and the LED doesn’t light up. I think you might recall it wrongly here. (nonetheless, before applying the hardware-mod, the led did light up upon receiving RF-Data)

Yes, I have a second receiver and emitter that i used before i had the sonoff which i can confirm these codes with).

A piece of the serial log showing that mqtt-subscription and decoding of RF seems to work:

"mqtt_server":"192.168.x.x","mqtt_port":"1883","mqtt_user":"rfgateway","mqtt_pass":"xxxx","mqtt_topic":"home/","gateway_name":"RF-Gateway"}N: RF_EMITTER_GPIO: 5 
N: RF_RECEIVER_GPIO: 4 
N: Setup OpenMQTTGateway end
W: MQTT connection...
N: Connected to broker
N: Subject: /SYStoMQTT
N: Received json : {"uptime":3,"version":"version_tag","freemem":40744,"rssi":-60,"SSID":"ssid","ip":"192.168.y.x","mac":"2C:F4:xx:xx:xx:xx","wifiprt":0,"modules":"RF"}

{"mqtt_server":"192.168.x.x","mqtt_port":"1883","mqtt_user":"rfgateway","mqtt_pass":"xxxx","mqtt_topic":"home/","gateway_name":"RF-Gateway"}N: RF_EMITTER_GPIO: 5 
N: RF_RECEIVER_GPIO: 4 
N: Setup OpenMQTTGateway end
W: MQTT connection...
N: Connected to broker
N: Subject: /SYStoMQTT
N: Received json : {"uptime":7,"version":"version_tag","freemem":40744,"rssi":-61,"SSID":"ssid","ip":"192.168.y.x","mac":"2C:F4:xx:xx:xx:xx","wifiprt":0,"modules":"RF"}
N: Received json : {"value":4280657,"protocol":1,"length":24,"delay":307}
N: Received json : {"value":4280660,"protocol":1,"length":24,"delay":308}
N: Received json : {"value":4280671,"protocol":1,"length":24,"delay":308}
N: Received json : {"cmd":"restart"}
N: Command: restart�
 ets Jan  8 2013,rst cause:1, boot mode:(3,7)
load 0x4010f000, len 1392, room 16 
tail 0
chksum 0xd0
csum 0xd0
v3d128e5c
~ld
N:�{"mqtt_server":"192.168.x.x","mqtt_port":"1883","mqtt_user":"rfgateway","mqtt_pass":"xxxx","mqtt_topic":"home/","gateway_name":"RF-Gateway"}*WM: [3] allocating params bytes0
*WM: [2] Added Parameter: server
*WM: [2] Added Parameter: port
*WM: [2] Added Parameter: user
*WM: [2] Added Parameter: pass
*WM: [2] Added Parameter: name
*WM: [3] Updated _max_params: 10
*WM: [3] re-allocating params bytes: 40
*WM: [2] Added Parameter: topic
{"mqtt_server":"192.168.x.x","mqtt_port":"1883","mqtt_user":"rfgateway","mqtt_pass":"xxxx","mqtt_topic":"home/","gateway_name":"RF-Gateway"}N: RF_EMITTER_GPIO: 5 
N: RF_RECEIVER_GPIO: 4 
N: Setup OpenMQTTGateway end
W: MQTT connection...
N: Connected to broker
N: Subject: /SYStoMQTT
N: Received json : {"uptime":3,"version":"version_tag","freemem":40744,"rssi":-58,"SSID":"ssid","ip":"192.168.y.x","mac":"2C:F4:xx:xx:xx:xx","wifiprt":0,"modules":"RF"}

Florian,

do you have more ideas regarding my issue?

And you dont see this on the broker ?

To have a view of all topics you can use mqtt explorer client.

Yes, exactly.
I don’t see these values on the broker. i have already used MQTT Explorer to make sure i’m not missing anything. It’s not there.

Interesting: the JSON that the sonoff bridge receives

N: Received json : {"value":4280671,"protocol":1,"length":24,"delay":308}

is not actually generated by the bridge. It seems, that the receiver of the sonoff bridge indeed isn’t receiving anything.
That JSON gets sent to the the bridge via mqtt because for some reason, the sonoff bridge is subscribed to this topic (home/OpenMQTTGateway/433toMQTT) even though the device should subscribe to /home/RF-Gateway.

I’ll double check my soldering and report back.

The solder joints are fine. LEDs are still not lighting up.

Florian, can you test, whether your sonoff RF-Bridge receives this kind of protocol?

{"value":4280671,"protocol":1,"length":24,"delay":308}

Can you give me a JSON that you are sure the bridge is able to receive? then i can send it out with my other bridge and see.

Do you have the “commands” word into the topic, like below?
https://docs.openmqttgateway.com/use/rf.html#rcswitch-based-gateway

mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTto433" -m '{"value":1315156}'

yes, i have the word ‘command in my topic’. Sending commands like that works from both devices that i have. Receiving, however only works on one of them. The sonoff rf bridge doesn’t seem to register any input.

I was asking you for a known-good protocol, or json, that i can publish on the command topic to see if sonoff bridge reacts.

As you are using the direct mod the commands in the doc should work RF gateways (433mhz/315mhz) | OpenMQTTGateway v0.9.5

OK. There does not appear to be any working code registering on the sonoff bridge.

Could you post the exact command you are sending to MQTT and the topic please?