CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Fri Dec 06, 2019 4:04 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 27 posts ]  Go to page 1 2 Next
Author Message
 Post subject: MQTT Support
PostPosted: Mon May 09, 2016 3:53 pm 
Offline

Joined: Tue Jan 26, 2016 2:20 pm
Posts: 28
Hi there
It would be nice to have native support for MQTT Client in Codesys or as Add-on. Using this protocol users could use Codesys-powered controllers for home automation.

So far there are only two realizations known
https://github.com/kmpm/OSC-MQTT
https://github.com/FieldFox/Codesys-Mqtt-lib

Both are neither good written, nor working. Is there anything planned in future?


Top
   
 Post subject: Re: MQTT Support
PostPosted: Fri Aug 19, 2016 10:42 am 
Offline

Joined: Thu Jul 21, 2016 2:48 pm
Posts: 7
Really looking Forward to it!!!


Top
   
 Post subject: Re: MQTT Support
PostPosted: Sat Aug 20, 2016 9:11 pm 
Offline

Joined: Thu Jan 08, 2015 12:21 pm
Posts: 65
I have one working version MQTT for Codesys 3, only publisjing is suppoted for now


Top
   
 Post subject: Re: MQTT Support
PostPosted: Mon Jan 02, 2017 7:29 pm 
Offline

Joined: Tue Jan 26, 2016 2:20 pm
Posts: 28
From my first post there is MQTT add-on available in Codesys Store
https://store.codesys.com/janz-tec-mqtt-library.html
But price is a bit too high.


Top
   
 Post subject: Re: MQTT Support
PostPosted: Mon Feb 13, 2017 2:42 pm 
Offline

Joined: Thu Jul 21, 2016 2:48 pm
Posts: 7
There is a very good alternative built in the image of Raspbian for the Raspberry - node-red.
I added the library node-red-contrib-modbus, created in codesys tcp slave several functions to convert a string-float-integer.
Code:
var newMsg = { payload:0.1+parseFloat( msg.payload) * 10 } ;
return newMsg;

Set up a local mqtt-mosquitto broker.
To publish data to mqtt broker using the opposite function of the digit to the string.
Code:
var strok = { payload:String( msg.payload/10)} ;
return strok;

10 in the formula is a coefficient for conversion int_to_real and real_to_int.
Works flawlessly, supports simultaneous work with multiple mqtt brokers!!!
With javascript you can create any functions. I poison in codesys function fc16, so pre-create a number array.
Write in Russian - translation of a program, sorry.

P.S. https://store.codesys.com/janz-tec-mqtt-library.html - €590.00 ????!!!
Then you just bring to mind this: http://www.owen.ru/forum/attachment.php?attachmentid=28723&d=1484413963.
Tried it, slightly tweaked, works.


You do not have the required permissions to view the files attached to this post.


Top
   
 Post subject: Re: MQTT Support
PostPosted: Fri Feb 17, 2017 12:56 pm 
Offline
User avatar

Joined: Tue Jun 28, 2016 2:45 pm
Posts: 65
@Sancho.

Thank you for sharing this!!

Just another question, does the mqtt-mosquitto Broker support SSL?

I need to communicate with Amazon AWS IoT which only allows MQTT with SSL support.

It would be a nice community project, to build a MQTT Lib with TLS/SSL support :D .
The new SysSocket2 Lib now supports secure connections, so we've all requirements to realise this.

Regards,
Kevin

_________________
Building & Process Automation with HVAC Library for CODESYS© - www.hvac-automation.com


Top
   
 Post subject: Re: MQTT Support
PostPosted: Tue Feb 28, 2017 3:57 pm 
Offline

Joined: Wed Feb 15, 2017 2:07 pm
Posts: 3
Can you please share again the MQTT client that is working ?
Thanks !!


Top
   
 Post subject: Re: MQTT Support
PostPosted: Thu Mar 02, 2017 7:16 pm 
Offline

Joined: Thu Jan 08, 2015 12:21 pm
Posts: 65
And where is version for Codesys V2 here http://www.owen.ru/forum/attachment.php ... 1479291988


Top
   
 Post subject: Re: MQTT Support
PostPosted: Fri Mar 03, 2017 8:39 am 
Offline

Joined: Thu Jul 21, 2016 2:48 pm
Posts: 7
KevinR, Node-Red mqtt supports SSL.


You do not have the required permissions to view the files attached to this post.


Top
   
 Post subject: Re: MQTT Support
PostPosted: Tue Jul 04, 2017 9:17 pm 
Offline

Joined: Wed Dec 28, 2016 11:00 pm
Posts: 72
I spent some euro's on the Janz Tec implementation, it's very solid!
But beware: no TLS/SSL support, no last will implemented.


Top
   
 Post subject: Re: MQTT Support
PostPosted: Wed Aug 23, 2017 4:24 pm 
Offline

Joined: Tue Jan 26, 2016 2:20 pm
Posts: 28
I see that node-red can be used to convert MQTT to modbus TCP - that's great and I'm using it, but would be nice to have native support in Codesys. I even start thinking of Logi.CAD 3 for RPi, where MQTT Support is implemented. It's sad, that Codesys doesn't have good alternative.
I attach archive with MQTT client from russian link above, as I'm registered there as well. Not sure how to use it though

Sancho is it possible for you to share MQTT Owen library, tweaked by you for RPi?

But...
Quote:
I spent some euro's on the Janz Tec implementation, it's very solid!

Oh, wtf? It seems those guys recently reduced their wish-list from 590€ to just 49€! Definitely need to try.
Did it work problem-free on RPi? Do they have evaluation license?
What I don't like reading the datasheet is that publishing is done on some trigger, but it would be easier if it would be done by changing the payload.


You do not have the required permissions to view the files attached to this post.


Top
   
 Post subject: Re: MQTT Support
PostPosted: Wed Oct 18, 2017 3:14 pm 
Offline

Joined: Wed Dec 28, 2016 11:00 pm
Posts: 72
On the janz-tec library, see store/read the pdf for details;
Did it work problem-free on RPi? -> yes, i think it's solid, however it misses some features which I personally do not miss.
Do they have evaluation license? -> yes, without a license it runs 30 min in demo mode.

Be ware that this is a "SL", just like your Pi license you need a license per CPU.

PS.
Be aware that PLC's in general are by design *not* very well suited to do loads of string handling.
In general, string handling causes the CPU lots of overhead.
One should therefore try minimize the use of string handling in a plc or use it in smart way's via initialising etc etc.
This is why the trigger in the MQTT library is not implemented in the way you would like it to be, on a payload difference.
However, if you wish to implement the payload string detection mechanism, you are free to do so;

I.E. pseudocode
Code:
rPayloadTrigger.Q( sLastPayLoad <> sCurPayload );

Then connect rPayloadTrigger.Q to the .xPublish parameter of the appropriate publish functionblock.


Good luck


Top
   
 Post subject: Re: MQTT Support
PostPosted: Thu Oct 19, 2017 9:41 am 
Offline

Joined: Tue Nov 04, 2014 3:45 pm
Posts: 22
I would be great if there would be native support for MQTT in Codesys. MQTT is a lightweight messaging protocol for small sensors so that would be a improvement if this would be implemented (with TLS ) in Codesys


Top
   
 Post subject: Re: MQTT Support
PostPosted: Thu Jan 04, 2018 10:13 am 
Offline

Joined: Sat Jan 30, 2016 12:46 pm
Posts: 3
Did anybody ever found and tried the "new" free MQTT-Library found on Sourceforge?
[url]codesys-mqtt-library.sourceforge.net[/url]

I just found it last weekend and did not have any time to try it out.
But i had e-mail contact with the Author of the library.
Acc to the Author:
You can publish multiple topics by change the pubtopic before publishing.
To subscribe to multiple topics you have to use the wildcard.

This library also supports last will mesage. (to see if the device is online or offline)

I still think CODESYS should support MQTT native without any library (maybe some topic to variable mapping list....)


Top
   
 Post subject: Re: MQTT Support
PostPosted: Fri Jan 19, 2018 4:39 pm 
Offline

Joined: Wed Dec 28, 2016 11:00 pm
Posts: 72
The new version of JanzTec now supports SSL too ;-)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 27 posts ]  Go to page 1 2 Next

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited