1technophile / OpenMQTTGateway

MQTT gateway for ESP8266 or ESP32 with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, Bluetooth, beacons detection, mi flora, mi jia, LYWSD02, LYWSD03MMC, Mi Scale, TPMS, BBQ thermometer compatibility & LoRa.
https://docs.openmqttgateway.com
GNU General Public License v3.0
3.55k stars 784 forks source link

MQTTtoRFM69 not working when receiver included #375

Closed aussieW closed 5 years ago

aussieW commented 5 years ago

Hi

I am trying to send an MQTTtoRFM69 message to a receiver that is not the defaultRFM69ReceiverId. e.g. mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTtoRFM69/RCV_98" -m "Test"

I am finding that it is not working and I suspect that the message is not sent because the following condition is not met if (topic == subjectMQTTtoRFM69) {

As far as I can tell this results because subjectMQTTtoRFM69 = home/OpenMQTTGateway/commands/MQTTtoRFM69 and topic = home/OpenMQTTGateway/commands/MQTTtoRFM69/RCV_99

It appears to be a problem for both simpleReceiving and jsonReceiving. Although in the case of jsonReceiving the test is expressed as if (strcmp(topicOri,subjectMQTTtoRFM69) == 0){

I am not sure why the test is different in the two functions. Would it be better/more consistent if they were the same?

Note: I am using the latest version i.e. v0.9.1beta on an NodeMCU v1.0.

Cheers

1technophile commented 5 years ago

Hi,

Indeed we should not have this test: if (topic == subjectMQTTtoRFM69) { in case of simple receiving. I will correct it.

Nevertheless you should be able to pass a "receiverid" in json format.

mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoRFM69 -m '{"data":1315156,"receiverid":34}'

aussieW commented 5 years ago

Okay, thanks. I wasn't aware that I could pass the receiverid in the JSON payload. Tested it and it seems to work.

1technophile commented 5 years ago

This was the opportunity to update the wiki, thanks for pointing this