Community discussions

MikroTik App

MQTT functionality in routerOS to enable IoT like operation

Poll ended at Sat Jun 15, 2019 3:27 pm

yes
3 (50%)
yes, with the ability to have multiple instances that subscribe different brokers/topics
2 (33%)
no, i use scripting and/or blood magic to mimic the functionality
No votes
no, i got everything sorted out with API
No votes
no, i don't need anything like this
1 (17%)
 
Total votes: 6
 
User avatar
doneware
Trainer
Trainer
Topic Author
Posts: 644
Joined: Mon Oct 08, 2012 8:39 pm
Location: Hungary

MQTT client in routerOS

Thu May 16, 2019 3:27 pm

I created an environment in routerOS, that enables IoT-like (i.e. the server doesn't talk to the router, but the router talks to the server) operation. it works in a reasonable way, but i'd think i'd be better of with a proper MQTT client implementation in the device, that enables subscribing and posting to topics:
- performance data, state, logs, idk - so in general "a routerOS variable"
- trigger a script / feed the input of an event that is sent to a subscribed topic

i might say, this shouldn't be a big performance issue as teeny-tiny micros can accommodate one and live on, so i thought i might ask the scripting community whether it would spark some ideas/interest on someone else's side, and create a demand so the next minor release of RouterOS (or maybe #RouterOS7) will suddenly include this functionality.
my explanation for it is that i don't want to track devices, i might not will be able to talk to them (behind nat, behind firewall), but in many cases they could just talk to my server. this would also enable some sort of ZTP/ZTO environment as well.

imagine something like
/system script
add name=handler1 source=":log info message=\"received: $mqtt_input on $mqtt_topic\""
/mqtt brokers
add name=broker1 server=fqdn.of.the.broker port=6969
add name=broker2 server=this.is.another.broker port=1183
/mqtt topics
add name=topic1 broker=broker1 mode=publish topic=topicname
add name=topic2 broker=broker2 mode=subscriber topic=controller script=handler1
and you'll be able to use a script to write a routerOS variable or just a string to a publish-mode topic:
/mqtt post topic="topic1" message=$myvar
#TR0359
 
GregW
just joined
Posts: 7
Joined: Sat Dec 29, 2018 9:15 pm

Re: MQTT client in routerOS

Fri May 17, 2019 10:37 am

MQTT support would be great. A definite requirement would be SSL/TLS connections for each broker.
 
amouses
just joined
Posts: 2
Joined: Fri Apr 27, 2018 12:43 am

Re: MQTT client in routerOS

Mon May 11, 2020 9:37 pm

As a Smart Home user and possibly enthusiast and a multiple Mikrtik user this would be very useful. IE the ability to interact with my MQTT server running elsewhere and subscribe to topics that are being used in our Smart Home. Mikrotik anybody .... ?
 
Zebble
newbie
Posts: 46
Joined: Mon Oct 17, 2011 4:07 am

Re: MQTT client in routerOS

Tue May 12, 2020 6:37 am

+1 for this feature. Would love to be able to have Mikrotik devices subscribe to a central MQTT server over TLS/SSL to trigger scripts on topic updates. Perfect for doing lightweight automation and control and not need to poke any inbound holes through firewalls! We currently do this through some script magic but it only checks for updates once a day to keep traffic low...
 
User avatar
xvo
Forum Guru
Forum Guru
Posts: 1244
Joined: Sat Mar 03, 2018 1:12 am
Location: Moscow, Russia

Re: MQTT client in routerOS

Sat Jun 27, 2020 12:27 pm

+1 for MQTT client
 
imort
just joined
Posts: 7
Joined: Sat May 26, 2018 9:34 am

Re: MQTT client in routerOS

Sun Aug 09, 2020 11:51 am

+1

/tool fetch which supports TLS 1.2 and can provide CA, public and private key will work for me too.
 
Skunkworks
just joined
Posts: 1
Joined: Thu Jul 09, 2020 9:18 am

Re: MQTT client in routerOS

Thu Aug 13, 2020 10:15 pm

+1 for MQTT client
 
stefan23
just joined
Posts: 3
Joined: Thu Aug 04, 2016 7:39 pm

Re: MQTT client in routerOS

Wed Sep 23, 2020 10:30 pm

+1 for MQTT :-)
would also be interesting as transport protocol for LoRaWAN
 
Sajad2010
just joined
Posts: 5
Joined: Wed Oct 14, 2020 8:33 am

Re: MQTT client in routerOS

Sat Oct 24, 2020 7:50 am

+1 for MQTT client
 
ab130kd
newbie
Posts: 37
Joined: Thu Mar 02, 2006 8:11 pm
Location: Italy

Re: MQTT client in routerOS

Sat Oct 24, 2020 11:04 am

News about mqtt and mqtts?
Mikrotik could think develop a tool for iot and dedicating devices, exactly like years ago he started with the rb112 or rb532 when WiFi cards were only PCMCIA....
 
hawkn
just joined
Posts: 2
Joined: Fri Dec 23, 2016 8:43 pm

Re: MQTT client in routerOS

Sun Jan 10, 2021 8:04 pm

I do also have several Mikrotik units and more to come.
Also running MQTT servers and alot of "things" connected to openhab trough my WiFi.
Next on the list is LoRa for outdoor appliances, and if we get mqtt sub/pub on the unit, I can test several scenarios in my home.

Also HIGHLY supporting this request.
 
User avatar
pukkita
Trainer
Trainer
Posts: 3046
Joined: Wed Dec 04, 2013 11:09 am
Location: Spain

Re: MQTT client in routerOS

Mon Jan 11, 2021 4:17 pm

+1 for MQTT :-)
would also be interesting as transport protocol for LoRaWAN
Would be a perfect companion!
Simplicity is the Ultimate Sophistication - Da Vinci
Getting the most out of this forum
 
hatching
just joined
Posts: 1
Joined: Tue Feb 02, 2021 10:41 pm

Re: MQTT client in routerOS

Tue Feb 02, 2021 10:44 pm

+1 for MQTT client
 
Msosa
just joined
Posts: 10
Joined: Sat Jun 17, 2017 3:39 am

Re: MQTT client in routerOS

Wed Feb 17, 2021 5:12 am

+1 Publish/Subscribe with encryption feature will be great!!
 
MichaelWard
just joined
Posts: 4
Joined: Tue May 24, 2016 11:24 am

Re: MQTT client in routerOS

Fri Feb 26, 2021 5:27 pm

I do also have several Mikrotik units and more to come.
Also running MQTT servers and alot of "things" connected to openhab trough my WiFi.
Next on the list is LoRa for outdoor appliances, and if we get mqtt sub/pub on the unit, I can test several scenarios in my home.

Also HIGHLY supporting this request.
@hawkn
Have you seen the wAP LR8 kit? Its a lora base station but I think it does not do MQTT. Sadly.
https://mikrotik.com/product/wap_lr8_kit
 
User avatar
doneware
Trainer
Trainer
Topic Author
Posts: 644
Joined: Mon Oct 08, 2012 8:39 pm
Location: Hungary

Re: MQTT client in routerOS

Sat Mar 20, 2021 12:59 pm

there's now an IoT package available in 7b5.
[me@audience] > /system/package/print 
Columns: NAME, VERSION
  #  NAME       VERSION 
  0  iot        7.1beta5 <--
  1  routeros   7.1beta5
  2  wifiwave2  7.1beta5
and it is available on all platforms:
[me@audience] /iot/mqtt> 

.. -- go up to iot
brokers -- 
export -- Print or save an export script that can be used to restore configuration
get -- Gets value of item's property
print -- Print values of item properties
publish -- 
https://help.mikrotik.com/docs/pages/vi ... d=41680915
#TR0359
 
ab130kd
newbie
Posts: 37
Joined: Thu Mar 02, 2006 8:11 pm
Location: Italy

Re: MQTT client in routerOS

Fri Apr 16, 2021 10:46 am

Hi,
In version 7.1b5 there isn't LORA package... How could test mqtt with lora ?
Ciao Carlo
 
exitcomestothis
just joined
Posts: 1
Joined: Sat Apr 17, 2021 6:42 pm
Location: Vancouver, WA

Re: MQTT client in routerOS

Sat Apr 17, 2021 7:32 pm

The IoT package is in the “extra packages” for 7.1b5.

I hope this IoT package makes it’s way into the 6.48 series with the release of the KNOT. The MQTT and Modbus functions are quite useful!
 
ab130kd
newbie
Posts: 37
Joined: Thu Mar 02, 2006 8:11 pm
Location: Italy

Re: MQTT client in routerOS

Mon Apr 19, 2021 10:42 pm

Yes I know.

I hope there is the functionality to handle payload and then to use mqtt ....
AES decrypting would be appreciated
You do not have the required permissions to view the files attached to this post.
 
mag1024
just joined
Posts: 2
Joined: Fri May 28, 2021 11:11 pm

Re: MQTT client in routerOS

Fri May 28, 2021 11:30 pm

FYI, the iot package is now in "extra" packages of 6.48.3. From the change log:
*) package - added new "iot" package with Bluetooth (KNOT only) and MQTT publisher support;

For those that might be tripped up by this like I was, it seems that using the /iot mqtt publish command in scripts oddly requires the "test" permission.
Also, the toJson function from viewtopic.php?t=120441#p790680 combos with mqtt publish nicely.
 
jindranix
just joined
Posts: 12
Joined: Mon Jun 09, 2014 11:41 am

Re: MQTT client in routerOS

Wed Jun 02, 2021 2:09 pm

Hi wonderful feature, but I tried it and doesn't work for me.

[admin@jindra] > iot export
/iot mqtt brokers
add address=192.168.12.2 client-id=test name=kancl password=***** username=user

[admin@jindra] > iot mqtt publish broker=kancl message="test" topic=mikrotik

No traffic in sniffer to address 192.168.12.2...

Any advice? Thanks!
 
denissMT
MikroTik Support
MikroTik Support
Posts: 2
Joined: Wed May 26, 2021 12:00 pm

Re: MQTT client in routerOS

Mon Jun 07, 2021 2:53 pm

Hi wonderful feature, but I tried it and doesn't work for me.

[admin@jindra] > iot export
/iot mqtt brokers
add address=192.168.12.2 client-id=test name=kancl password=***** username=user

[admin@jindra] > iot mqtt publish broker=kancl message="test" topic=mikrotik

No traffic in sniffer to address 192.168.12.2...

Any advice? Thanks!
Please create a ticket (https://mikrotik.com/support) and provide supout.rif file with the packet capture for analysis.
 
Beliy
just joined
Posts: 3
Joined: Sat Apr 07, 2018 10:05 am

Re: MQTT client in routerOS

Wed Aug 18, 2021 10:29 am

+1 for MQTT client

Who is online

Users browsing this forum: No registered users and 14 guests