Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

MQTT

Stefan2
2018-05-29
2019-01-09
  • Stefan2 - 2018-05-29

    Hi there!

    I did implementing an MQTT library, test it an have fun…

    Greatings

    Short info from short doku...:

    Zitat:
    Hello There,
    with this library you are able to send and recvice MQTT paket on all QoS levels 0-2.
    Use Pubish to publish data(Strings and binary),
    Use subscribe to recive MQTT data. On Subscribe you can tell the FB if you are expecting an String as data, so you will get one on the pointer output.
    How to use you can see n de TestMqtt FB. This is my Test Case an it does up to 100 send and recives per second on an raspberry PI 1+ connectet to an mosquitto broker on an
    windows 10 maschine.
    If you find errors, or anny instability, tell me, i will have a look.
    I started to implement TLS, but this will take a wile, so don't care about the TLS and crypto errors.
    This Projekt i using some parts of the grat OSCAT libs, so take a look at oscat.de

    Stefan

    MQTT.projectarchive [788.36 KiB]

     
  • aliazzz

    aliazzz - 2018-05-30

    Would you be so kind and repost the projectarchive again?

    but this time be sure to add "CmpCrypto" v3.5.11.0 compiledLibrary

    I can't seem to download this missing lib from the codesys store, so the projectarchive will not compile.

    Many thanx in advance!

     
  • Stefan2 - 2018-05-30

    Hi Aliazzz,

    This CmpCrypto Lib is missing on my System too. I can Add it in My Librarymanager, but it isn't resolved.

    So, how i write in the first post

    Zitat:
    I started to implement TLS, but this will take a while, so don't care about the TLS and crypto errors.

    This is a Problem i need to solve for the TLS implementation im working in.

    On my System ist working without.

    Greetings Stefan

     
  • Stefan2 - 2018-05-31

    Hi!

    Did some improvements and added some coments, CmpCrypto error is gone…

    have fun…

    Stefan

    MQTT.projectarchive [787.6 KiB]

     
  • aliazzz

    aliazzz - 2018-06-01

    Good work, thank you!

     
  • hanels - 2018-06-21

    Hi Stefan,

    i have the same Problem with my PLC Program, could you tell me please how you solved the Problem of the CmpCrypto?

    Thank you very much !

    Hani

    Stefan2 hat geschrieben:
    Hi!
    Did some improvements and added some coments, CmpCrypto error is gone…
    have fun…
    Stefan
    MQTT.projectarchive

     
  • Stefan2 - 2018-07-09

    Hello Hanels,

    i just deleted the TlcCmp Lib, i go Forward, TLS is now supporte by my lib, but still i have to do much.(Long Topics and payloads)

    The Error first disapears when the lib is link on an runtime System, i don't know why, i think the linking to OpenSSL works only if the Runtime System in known.

    Bye

    Stefan

     
  • Anonymous - 2018-07-10

    Originally created by: KevinR

    Hey Stefano,

    thanks for the publish.

    Could you please make it available on github? So we could help you with TLS integration. I think this would be a great community project.

    cheers,
    KevinR

     
  • Stefan2 - 2018-07-10

    Hello Kevin,

    TLS implementation is already done, works fine to test.mosquitto.org.

    but i still improving the lib to be able to use Topics up to 64kB an Payloads up to 200MB....

    i am glad about your offer to help, i am going to think about it.

    for this i Need to have a github account, but this shouldn't be the Problem.

    Bye

    Stefan

     
  • Anonymous - 2018-07-11

    Originally created by: KevinR

    Hello Stefan,

    If TLS is already implemented is it possible to use also own registered cert?

    Let me know if you need some help. I also can do some tests.

    BR,
    Kevin

     
  • Stefan2 - 2018-07-11

    Hello Kevin,

    no, certification is not implemented yet. But should be no problem.

    when i am further with the lib i tell you.

    And i have a gibhub account now...

    BR

    Stefan

     
  • aliazzz

    aliazzz - 2018-07-21

    Count me in if you post your code in github ..
    The newly posted Crypto Example should help out also

     
  • Stefan2 - 2018-07-31

    Hello,

    now all needed Projects are on GitHub. TLS and MQTT are now splittet, i am going on to work on MQTT further.

    If you like to ad certificates, you Need to work on CommonTypesAndFunctions, there is an FB IP_CONTROL. This on supports TLS without certificates, take al look on testmqtttls in MQTT.libraray, this works with test.mosquitto.org.

    Changing the interface is not longer needed, just extend TLS_CONFIG in CommonTypesAndFunctions.
    I would like to see an string were i can give an name of an certificate installed with the Security Manager of CODESYS which then is used by the Connection. Take a look and tell me what you think

    BR

    Stefan

     
  • Stefan2 - 2018-07-31

    Hello,

    i forgot, please start here:

    https://github.com/stefandreyer

    BR

    Stefan

     
  • Stefan2 - 2018-08-01

    Hello,

    Zitat:
    I would like to see an string were i can give an name of an certificate installed with the Security Manager of CODESYS which then is used by the Connection. Take a look and tell me what you think

    sorry, i meant that i would be happy if it can Beo solved this way…

    BR

    Stefan

     
  • TMT - 2019-01-07

    For being complete newbie to codesys and programming. I just cant get this to work.

    I have local broker running in raspberry and it works with examble within library.

    But I just cant understand that how I proceed with this.

    Waiting for tutorial for idiots...

    Im trying to use this library to communicate with domoticz so that I can control my lights from domoticz.

    Codesys raspberry controls lights thru beckhoff ethercat io.

     
  • Ton - 2019-01-09

    Hi,

    Here a snippet of my Domoticz Mqtt program.

    I use my own Mqtt client.

    This project include some controls for Domoticz like Lamp, Dimmer, Lux, Pir, Blinds, ..
    These are oop, not really for idiots or newbie but maybe you can use it.

    Groetjes Ton.

    Domoticz_Mqtt.projectarchive [560.22 KiB]

     
  • TMT - 2019-01-09

    Thanx, I have a look of that.

    Actually after hours of banging my head against the wall, I managed to get this working, problem is that library uses string(255) variable for incoming messages and domoticzs messages are longer.

    Filthy getaway was to parse messages in nodered first and handle rest of the messages in codesys. There should be way to control what domoticz sends in mqtt messages...

     

Log in to post a comment.