does anyone have some example of subscribing of custom MQTT mesage? I suppose it is necessary to set radio module to listening bc_radio_init(BC_RADIO_MODE_NODE_LISTENING); but I am not sure what to do after that. I am also not sure if it is also possible to send MQTT messages in listening mode.
I know that there is some example for power module, but it is not used for listening custom message. I would like to receive some values (intervals how frequently measure some values) and use these values instead of constants.
My guess is that you have to keep the MQTT topic topic “tree-depth”:
So the format should be
I think that bcg gateway is using some wildcards ? in the MQTT topics. We did this probably so it is similar to existing style of topics.
let me know the result, send me application.c if you could not get it work.
Also try to update the dongle firmware. I think that anything above 1.8.0 is fine, but please test the latest version as the last option.
OK, I will try it at home at the evening. If I understand correctly, it is needed to keep same structure as using other devices in opposite way (publishing). In my case for getting pressure it is: “greenhouse_climate/barometer/0:0/pressure”. I will try to publish “greenhouse_climate/barometer/0:0/update_interval”
But I am not sure if it is correct that is not possible to subscribe message without this tree. For example when I would like to use some attribute of whole climate kit (core module) It should not be necessary to use this structure. Similar case is, when I would like to subscribe all topics “#”…
In this time, the structure of the subject is solid. Wildcard as # or + doesn’t supported.
You register a/b/c/d for example denkovi-relay/q4/state/set and node added gateway and id added dongle. Result subscibe topic is node//denkovi-relay/q4/state/set .
But we are planning to support a different structure of the topic. However, it should not be forgotten that 868Mhz is not wifi, there is a limited number of messages.
Thank you, for your help, but I it is still not working. I tried to subscribe topic in recommended format. But it doesn’t help. I also tried to update dongle firmware with this command: bcf flash --device /dev/ttyUSB0 bigclownlabs/bcf-gateway-usb-dongle:latest but it still doesn’t work. I am attaching link to file with my code with my examples. Can you please check, what I am doing wrong? Thank you very much.
I tried these payload messages:
There’s also other thing.
The module itself pairs as a climate-monitor:0, I guess that you renamed the module alias to the “greenhouse_climate”, but this name cannot be in the C code. This alias is appended automatically by gateway.
So if your code would work (there’s that topic length bug maybe) then you would need to add another greenhouse_climate to the topic:
node/greenhouse_climate/greenhouse_climate/barometer/update/interval NODE ALIAS
I’ll try to debug the code and let you know later today.
Hi, I have one more question about payloads types. Which types of payload are supported? I tried to use same as for publishing, but UINT32 looks that doesn’t work. Or is it needed to use some different format then “BC_RADIO_SUB_PT_UINT32”?
I have written this code and ran into the same problem with topic subscription. With topic “barometer/-/interval/set” it works great and for example with topic a/b/c/d, or owar/lcd/temperature/set it does not.