This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
wiki:wiki3:faq_mqtt [2020/12/21 17:36] tda |
wiki:wiki3:faq_mqtt [2021/10/07 09:08] (current) tda |
||
---|---|---|---|
Line 52: | Line 52: | ||
This option is currently not supported in the current Server Software release. This improvement will be delivered in a future release. | This option is currently not supported in the current Server Software release. This improvement will be delivered in a future release. | ||
- | \\ | ||
Most of information in this page has been retrieved from Wikipedia [[https://en.wikipedia.org/wiki/MQTT]]. | Most of information in this page has been retrieved from Wikipedia [[https://en.wikipedia.org/wiki/MQTT]]. | ||
+ | |||
+ | |||
+ | ===== How can I filter messages from a particular device with MQTT ? ===== | ||
+ | |||
+ | ==== Filtering on devEUI ==== | ||
+ | |||
+ | You can use the following filter on devEUI in your push configuration to enable filtering on a particular device : | ||
+ | |||
+ | {{:wiki3:mqtt_filtering_deveui.png?600|}} | ||
+ | |||
+ | The MQTT client can subscribe to a particular device over its devEUI to get messages from this device: | ||
+ | |||
+ | <code> | ||
+ | UBUNTU:~$ mosquitto_sub -t "/DataUp/474ABD9100220034" | ||
+ | |||
+ | {"id":"615d7043c7169a0001c5859c","endDevice":{"devEui":"474ABD9100220034","devAddr":"24001199","cluster":{"id":46}},"fPort":8,"fCntDown":257,"fCntUp":254,"adr":true,"confirmed":true,"encrypted":false,"payload":"30","encodingType":"HEXA","recvTime":1633513539007,"gwRecvTime":1633513539007,"classB":false,"delayed":false} | ||
+ | {"id":"615d7050c7169a0001c5859e","endDevice":{"devEui":"474ABD9100220034","devAddr":"24001199","cluster":{"id":46}},"fPort":8,"fCntDown":258,"fCntUp":255,"adr":true,"confirmed":true,"encrypted":false,"payload":"31","encodingType":"HEXA","recvTime":1633513552397,"gwRecvTime":1633513552397,"classB":false,"delayed":false} | ||
+ | {"id":"615d705ec7169a0001c585a4","endDevice":{"devEui":"474ABD9100220034","devAddr":"24001199","cluster":{"id":46}},"fPort":8,"fCntDown":259,"fCntUp":256,"adr":true,"confirmed":true,"encrypted":false,"payload":"32","encodingType":"HEXA","recvTime":1633513566050,"gwRecvTime":1633513566050,"classB":false,"delayed":false} | ||
+ | </code> | ||
+ | |||
+ | ==== Filtering on devAddr ==== | ||
+ | |||
+ | You can use the following filter on devAddr in your push configuration to enable filtering on a particular device : | ||
+ | |||
+ | The MQTT client can subscribe to a particular device over its devAddr to get messages from this device: | ||
+ | |||
+ | <code> | ||
+ | UBUNTU:~$ mosquitto_sub -t "/DataUp/24001199" | ||
+ | |||
+ | {"id":"615d783ec7169a0001c58785","endDevice":{"devEui":"474ABD9100220034","devAddr":"24001199","cluster":{"id":46}},"fPort":8,"fCntDown":358,"fCntUp":355,"adr":true,"confirmed":true,"encrypted":false,"payload":"30","encodingType":"HEXA","recvTime":1633515581916,"gwRecvTime":1633515581916,"classB":false,"delayed":false} | ||
+ | {"id":"615d784bc7169a0001c58787","endDevice":{"devEui":"474ABD9100220034","devAddr":"24001199","cluster":{"id":46}},"fPort":8,"fCntDown":359,"fCntUp":356,"adr":true,"confirmed":true,"encrypted":false,"payload":"31","encodingType":"HEXA","recvTime":1633515595223,"gwRecvTime":1633515595223,"classB":false,"delayed":false} | ||
+ | {"id":"615d7859c7169a0001c5878c","endDevice":{"devEui":"474ABD9100220034","devAddr":"24001199","cluster":{"id":46}},"fPort":8,"fCntDown":360,"fCntUp":357,"adr":true,"confirmed":true,"encrypted":false,"payload":"32","encodingType":"HEXA","recvTime":1633515608824,"gwRecvTime":1633515608824,"classB":false,"delayed":false} | ||
+ | {"id":"615d7866c7169a0001c5878e","endDevice":{"devEui":"474ABD9100220034","devAddr":"24001199","cluster":{"id":46}},"fPort":8,"fCntDown":361,"fCntUp":358,"adr":true,"confirmed":true,"encrypted":false,"payload":"33","encodingType":"HEXA","recvTime":1633515622329,"gwRecvTime":1633515622329,"classB":false,"delayed":false} | ||
+ | </code> | ||
+ | |||
+ | ===== How can I filter messages from a particular cluster with MQTT ? ===== | ||
+ | |||
+ | You can use the following filter in your push configuration to enable filtering on all devices that belong to a particular cluster: | ||
+ | |||
+ | {{:wiki3:mqtt_filtering_clusterid.png?600|}} | ||
+ | |||
+ | The MQTT client can subscribe to a particular cluster to get messages from all devices that belong to this cluster: | ||
+ | |||
+ | <code> | ||
+ | UBUNTU:~$ mosquitto_sub -t "/DataUp/46" | ||
+ | |||
+ | {"id":"615d7266c7169a0001c58627","endDevice":{"devEui":"474ABD9100220034","devAddr":"24001199","cluster":{"id":46}},"fPort":8,"fCntDown":298,"fCntUp":295,"adr":true,"confirmed":true,"encrypted":false,"payload":"3431","encodingType":"HEXA","recvTime":1633514086611,"gwRecvTime":1633514086611,"classB":false,"delayed":false} | ||
+ | {"id":"615d7274c7169a0001c5862a","endDevice":{"devEui":"474ABD9100220034","devAddr":"24001199","cluster":{"id":46}},"fPort":8,"fCntDown":299,"fCntUp":296,"adr":true,"confirmed":true,"encrypted":false,"payload":"3432","encodingType":"HEXA","recvTime":1633514100126,"gwRecvTime":1633514100126,"classB":false,"delayed":false} | ||
+ | {"id":"615d7282c7169a0001c5862d","endDevice":{"devEui":"474ABD9100220034","devAddr":"24001199","cluster":{"id":46}},"fPort":8,"fCntDown":300,"fCntUp":297,"adr":true,"confirmed":true,"encrypted":false,"payload":"3433","encodingType":"HEXA","recvTime":1633514113643,"gwRecvTime":1633514113643,"classB":false,"delayed":false} | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ===== How can I filter messages from a particular fPort with MQTT ? ===== | ||
+ | |||
+ | You can use the following filter in your push configuration to enable filtering from a particular fPort: | ||
+ | |||
+ | {{:wiki3:mqtt_filtering_fport.png?600|}} | ||
+ | |||
+ | The MQTT client can subscribe to a particular fPort to get all messages transmitted over this port number: | ||
+ | |||
+ | <code> | ||
+ | UBUNTU:~$ mosquitto_sub -t "/DataUp/8" | ||
+ | |||
+ | {"id":"615d7951c7169a0001c587cd","endDevice":{"devEui":"474ABD9100220034","devAddr":"24001199","cluster":{"id":46}},"fPort":8,"fCntDown":380,"fCntUp":375,"adr":true,"confirmed":true,"encrypted":false,"payload":"3230","encodingType":"HEXA","recvTime":1633515856723,"gwRecvTime":1633515856723,"classB":false,"delayed":false} | ||
+ | {"id":"615d795ec7169a0001c587d4","endDevice":{"devEui":"474ABD9100220034","devAddr":"24001199","cluster":{"id":46}},"fPort":8,"fCntDown":381,"fCntUp":376,"adr":true,"confirmed":true,"encrypted":false,"payload":"3231","encodingType":"HEXA","recvTime":1633515870282,"gwRecvTime":1633515870282,"classB":false,"delayed":false} | ||
+ | {"id":"615d796cc7169a0001c587d7","endDevice":{"devEui":"474ABD9100220034","devAddr":"24001199","cluster":{"id":46}},"fPort":8,"fCntDown":382,"fCntUp":377,"adr":true,"confirmed":true,"encrypted":false,"payload":"3232","encodingType":"HEXA","recvTime":1633515883806,"gwRecvTime":1633515883806,"classB":false,"delayed":false} | ||
+ | {"id":"615d79a1c7169a0001c587e6","endDevice":{"devEui":"474ABD9100220034","devAddr":"24001199","cluster":{"id":46}},"fPort":8,"fCntDown":386,"fCntUp":381,"adr":true,"confirmed":true,"encrypted":false,"payload":"3236","encodingType":"HEXA","recvTime":1633515937582,"gwRecvTime":1633515937582,"classB":false,"delayed":false} | ||
+ | </code> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||