Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


HC2: MQTT client, Fibaro I love you! (not!)


10der

Recommended Posts

Please login or register to see this image.

/monthly_2020_01/image.png.256a2290f63eac6557f98b74d4537ac3.png" />

 

 

image.png.2e81a7f0aeb0fe6af48f3085318e790b.png

 

 

source (VD)

 

Please login or register to see this code.

 

 

Edited by 10der
  • Like 4
Link to comment
Share on other sites

  • Topic Author
  • simpel VD.

    can send all fibaro evenets to MQTT server

     

    limitation loop 2 sec

    Please login or register to see this attachment.

    • Like 2
    Link to comment
    Share on other sites

    For past command to mqtt from hc2 (before your nodes didn;t support via FIbaroSensor scenes triggers from ex. pilots, keyfob etc) I used "http-in" endpoint 

    Please login or register to see this image.

    /monthly_2020_01/image.png.b91c90af392df9a0af372607432da857.png" /> and in fibaro scene the code like this: 

    Please login or register to see this code.

    Off-course  after small modif fot http call it work from VD.

    It not professional like  @10der code but works too ;-)

     

    Edited by drboss
    • Like 1
    Link to comment
    Share on other sites

  • Topic Author
  • can receive MQTT messages 

    Please login or register to see this attachment.

    • Thanks 1
    Link to comment
    Share on other sites

    • 2 months later...
    On 1/16/2020 at 8:30 PM, 10der said:

    can receive MQTT messages 

    Please login or register to see this attachment.

    Could you explain the VD code with an example?
    Many thanks

    Link to comment
    Share on other sites

    • 1 month later...

    @10der, great - thnx! you saved me a lot of time!

    Only global value to add and it works superb!

     

    One question, how to use user/pass? I can see in flags, but how to pass it?

     

    t

    Link to comment
    Share on other sites

  • Topic Author
  • alas. no auth in HC2 MQTT

    Link to comment
    Share on other sites

    • 1 month later...

    Thank you soooo much 

    Please login or register to see this link.

     

    Please login or register to see this link.

      !!!
    With the help of your handler I am now able to receive MQTT messages.

    Thank YOU so much :-)

    I use it to receive messages from a WeatherFlow weatherstation on the local network!! 
    NO more internet connection needed!!!


    After months of struggling to receive something from the Weatherflow via local UDP broadcast ( which I could not get to work and might even be disabled in HC!!! )
    I can now receive the messages via MQTT ??  

    I used an already running Raspberry Pi ( running Dietpi) and copied a the Python script " 

    Please login or register to see this link.

      " from here:

    Please login or register to see this link.

    and followed the instruction on that site!!

    ??

    • Thanks 1
    Link to comment
    Share on other sites

    • 4 months later...
    W dniu 15.01.2020 o 21:44, 10der napisał:

    simpel VD.

    can send all fibaro evenets to MQTT server

     

    limitation loop 2 sec

    Please login or register to see this attachment.

     

    Small update to MQTTSend.

    Without this update MQTTSend throws error when MQTT broker goes down (so finally does not reconnect after MQTT goes up).

     

    function MQTTSend(msg)
    -- fibaro:debug(msg)
    if not connection then
    connection = connect(fibaro:get(fibaro:getSelfId(), "IPAddress"), fibaro:get(fibaro:getSelfId(), "TCPPort"))
    if connection then
    bytes, errorCode = publish(connection, MQTT_TOPIC .. "/connection", "Connected")
    end
    end
    bytes, errorCode = publish(connection, MQTT_TOPIC, msg)
    if errorCode > 0 then
    connect_close(connection)
    connection = nil
    end
    -- connect_close(connection)
    end
    • Thanks 1
    Link to comment
    Share on other sites

    • 10der changed the title to HC2: MQTT client, Fibaro I love you! (not!)
    • 1 year later...

    Hi, would need some guiding how to use HC2 and this MQTT_Handler to get data from an Solar inverter Ferroamp.

    Please login or register to see this link.

     

    Really hope someone could bring some light for me in this topic :-) 

    Link to comment
    Share on other sites

    • 5 months later...

    I´m trying to recive an quite large MQTT message via this script shared in this topic.

    But I have no succes with that.

    Via this command in script:   local response, errorCode = connection:read()

    The message ends up in the response variable but that variable get limitet at 1024 byte so whole message wont fit.

    Is it and limitation in HC2 about varible size or is it any way to declare it larger?

    In the MQTT message a get at remaining lenght the value 2056. 

     

     

    Link to comment
    Share on other sites

    Where to find documentation for use of tcpSocket = Net.FTcpSocket(hostname, port)?

     

    What are all available commands/methods and could it be one for set of maximum buffer size?

    tcpSocket:setReadTimeout(###)

    tcpSocket:write(msg);

    tcpSocket:read(msg);

    tcpSocket:disconnect();

    Link to comment
    Share on other sites

    • 2 months later...
    On 6/21/2020 at 8:08 PM, pflugj said:

    With the help of your handler I am now able to receive MQTT messages.

    @pflugj Can you please explain the basics of how you got the MQTT receiver working?
    Is there a Global Variable that is needed?

    Do you have to set the IP address field in the VD?

     

    Thanks for your help,

    G.

    Edited by clowg
    Link to comment
    Share on other sites

    • 1 month later...

    Hi
    I just followed the instructions on:

    Please login or register to see this link.


    ...and you have to set the IP address in the VD

    Best regards
    Jurgen

    Link to comment
    Share on other sites

    • 4 months later...

    I am able to establish a connection :) using your VD. Now, how the get individual values from MQTT?

    thank you

     

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...