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


  • 0

Receiving simple UDP on HC2


Tim__

Question

Has anyone successfully received a UDP message on an HC2? There has been some previous discussion on here, but I could not locate any success.

 

I have this code running in a Virtual Device's main loop:

Please login or register to see this code.

 

I then send some test messages using ncat.exe from my PC (which is at 192.168.30.26) to HC2 (at 192.168.60.220)

 

C:\ncat -u 192.168.60.220 40002

 

Once I press enter to send the message, I get a response from ncat "Ncat: An existing connection was forcibly closed by the remote host.", and the HC2 code    fibaro:debug('Buffer: '..buffer);   returns nothing in the debug screen.  Is my UDP receive code incorrect, or does HC2 just not support UDP?

 

I plan to send a message from an Arduino I control (so I can select the message and selected port etc), and when the HC2 receives it, I will store the message in a global variable.  The message is a simple "1", indicating that the smoke alarm has been activated. I chose UDP because I thought it was a simple interface.  If UDP doesn't work, is there is another way to achieve this without setting up a middle man (like MQTT)?

 

 

 

 

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Hi @Tim_

 

Did you get this sorted? I am trying a similar process to get the HC2 to receive messages from another controller. Like you it is just simple string e.g. "12+" to indicate motion sensor 12 has been tripped. 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • 4 hours ago, Innervations said:

    Did you get this sorted?

    Nope.  I concluded that UDP isn't supported.  Instead, I resorted to connecting a sensor wire from the smoke alarms (via a relay), to the second channel of a Fibaro Switch 2,

    Link to comment
    Share on other sites

    • 0
    On 1/25/2021 at 1:24 PM, Tim__ said:

    is there is another way to achieve this without setting up a middle man (like MQTT)?

    search by forum VD for HC2 with MQTT by 10der

    Link to comment
    Share on other sites

    • 0
    On 3/6/2021 at 4:48 PM, Tim__ said:

    Nope.  I concluded that UDP isn't supported.  Instead, I resorted to connecting a sensor wire from the smoke alarms (via a relay), to the second channel of a Fibaro Switch 2,

    Thanks anyway. ?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I did just come across this in the Fibaro LUA developer document, haven't investigated it though.  Maybe it means that to use UDP you have to include this code library.

     

    The FUdpSocket class provides a UDP socket.
    To use this class you should require it in pluginName.lua
    require('net.UDPSocket')

    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
    Answer this question...

    ×   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...