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 Client implementation

alverman
2019-02-17
2019-02-28
  • alverman - 2019-02-17

    Good morning,
    I installed the free MQTT library by Stefan Robman and I managed to work it out.
    Manually I can check a basic sonoff.
    I always manage manually to enable and disable the output.
    Now I would like to implement it in my home automation but I can not figure out how to do it.
    Do I have to block each action?
    I think not, but I do not know how to make it happen.
    My aim would be to click on a lamp and if it is on, turn it off and if it goes off, turn it on and display the status graphically.

    Can you give me a hand?
    Thanks, Alberto

     
  • alverman - 2019-02-18

    I'm testing Stefan Rossmann's MQTT library.
    I have had some results, but as usual, I still need a piece to proceed.
    With the command stats/s1/result I can not get the status of the device !!
    While trying with mqtt-spy I see the status.
    How can I see the status of the library?

    Thanks, Alberto

     
  • elconfa - 2019-02-20

    This is very interesting for me. Could you post an example?

    Massimo

     
  • alverman - 2019-02-20

    Hi elconfa,
    with shame I attach my first small project.
    Now I would try to manage a sonof touch with three buttons, but here I need help, because I do not know if I have to use three blocks or other.

    MQTT_sonoff_basic.project [169.19 KiB]

     
  • alverman - 2019-02-28

    Hello,
    I have a total confusion about using the MQTT block and the various devices.
    If I use a device like the basic sonoff, I insert the block and based on the status of the relay, activate it and deactivate it with a codesys button.
    It works, and I can also see the status of the relay in codesys.

    Questions:
    But if in addition to this device I want to add more I have to add as many blocks MQTT how many devices?

    I have a touch sonoff button with three buttons.
    Do I have to add three MQTT blocks?

    Thanks, Alberto

     

Log in to post a comment.