Skip to content

Upd Gateway.c -MQTT subscription not working #23#24

Open
davidabek1 wants to merge 1 commit intoabouillot:masterfrom
davidabek1:solving-MQTT-subscription
Open

Upd Gateway.c -MQTT subscription not working #23#24
davidabek1 wants to merge 1 commit intoabouillot:masterfrom
davidabek1:solving-MQTT-subscription

Conversation

@davidabek1
Copy link

in this issue comments by JojoS62 and myself, are now incorporated in this update.
comment by JojoS62:
Is this the actual version? I found the MQTT subscription is not working, the topic is not valid:
sprintf(subsciptionMask, "%s/%03d/#/down", MQTT_ROOT, theConfig.networkId);
The /down part is not allowed after the /#, but an /+ is ok. When the SensorID is appended then the correct topic name is: "%s/%03d/+/down/+"
and then by me:
another part i had to change in the code of Gateway.c, is where a recieved message from mosquitto is scanned with the missing part of the sensor ID, leading to sending a message to DeviceID=0, and not the correct one.
had to change 2 lines from:
sscanf(msg->topic, "RFM/%d/%d/%d", &network, &data.nodeID, &data.sensorID);
to:
sscanf(msg->topic, "RFM/%d/%d/down/%d", &network, &data.nodeID, &data.sensorID);

in this issue comments by JojoS62 and myself, are now incorporated in this update.
comment by JojoS62:
Is this the actual version? I found the MQTT subscription is not working, the topic is not valid:
sprintf(subsciptionMask, "%s/%03d/#/down", MQTT_ROOT, theConfig.networkId);
The /down part is not allowed after the /#, but an /+ is ok. When the SensorID is appended then the correct topic name is: "%s/%03d/+/down/+"
and then by me:
another part i had to change in the code of Gateway.c, is where a recieved message from mosquitto is scanned with the missing part of the sensor ID, leading to sending a message to DeviceID=0, and not the correct one.
had to change 2 lines from:
sscanf(msg->topic, "RFM/%d/%d/%d", &network, &data.nodeID, &data.sensorID);
to:
sscanf(msg->topic, "RFM/%d/%d/down/%d", &network, &data.nodeID, &data.sensorID);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant