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


  • 1

Net.FTcpSocket?


Question

Posted

I used Net.FTcpSocket extensively to communicate with devices that use ModbusTCP, Modbus RTU, LON, etc. I no longer see the FTcpSocket method available in HC3. Is there an alternative to pushing raw data to TCP port or is this feature not available on HC3?

 

 

17 answers to this question

Recommended Posts

  • 1
Posted
7 hours ago, Rait said:

I used Net.FTcpSocket extensively to communicate with devices that use ModbusTCP, Modbus RTU, LON, etc. I no longer see the FTcpSocket method available in HC3. Is there an alternative to pushing raw data to TCP port or is this feature not available on HC3?

 

 

 

In QDs (QuickApp devices) there is net.TCPSocket() available.

  • 0
  • Inquirer
  • Posted
    On 2/16/2020 at 11:32 AM, jgab said:

     

    In QDs (QuickApp devices) there is net.TCPSocket() available.

     

    Are you sure about that? There is no code completion/hint about that, only the net.HTTPClient(); method. And when I try to use it, the code just stops.

     

    Please login or register to see this code.

    The above produces the following output:

     

    Please login or register to see this code.

     

    The second debug does not fire.

    • 1
    Posted
    2 minutes ago, Rait said:

     

    Are you sure about that? There is no code completion/hint about that, only the net.HTTPClient(); method. And when I try to use it, the code just stops.

     

    Please login or register to see this code.

    The above produces the following output:

     

    Please login or register to see this code.

     

    The second debug does not fire.

     

    try

    Please login or register to see this code.

     

    • 0
  • Inquirer
  • Posted

    Hmm, ok it seems it does exist, I'm just not using it correctly:

     

    Please login or register to see this code.

     

    • 0
  • Inquirer
  • Posted

    This is what I've managed to deduct:

     

    Please login or register to see this code.

    Unfortunately everything returns nil:

     

    Please login or register to see this code.

     

    • 1
    Posted (edited)

    There is pretty nice documentation regarding net.TCPSocket class. 

    Please login or register to see this link.

     

    I have created Modbus On/Off based on FIBARO example. Now i am missing thermostat/recuperation device type.

     

    Toggle values 0/1 of Register 101 (40101):  

    Please login or register to see this attachment.

    Tested with PLC Simulator: 

    Please login or register to see this link.

    Edited by jakub.jezek
    • 1
    Guest
    Posted

    Trying to create a remote controller for my TV..

     

    What device type or other to choose to be able to see all buttons ands labels on the QuickApp??

    I just get one line orone on/off switch or a color controller... I woudl need the old style with many buttons and labels, just as it is designed in the quick app..

    • 0
  • Inquirer
  • Posted

    @jakub.jezek Thank you! I can not believe I had not found that documentation yet!

     

    As a bonus I just discovered HC3's Lua supports bit operations natively! 

     

    x&y = AND

    x|y = OR

    x~y = XOR

    ~x = NOT

    x>>y = RSHIFT

    x<<y = LSHIFT

     

    • 0
    Posted

    Hi guys,

     

    I'm strugling now with Modbus reading. Have you encountered following? If you send 2 commands in one button, then you do not get response for 2nd command in HC?

     

    I'm sending 2 strings 2 seconds apart to get data from registers 101 and 207. I'm using PLC Simulator(

    Please login or register to see this link.

    ) till i get to live recuperation unit (getting there in Fall :D). I must say PLC Simulator is nice handy tool

     

    Command i'm sending:

    Please login or register to see this code.

     

    Sending part:

    Please login or register to see this code.

    Actually HC3 should receive the data. Both responses have correct value.

     

    Screenshot from Wireshark:

    Please login or register to see this spoiler.

     

    Modbus device: 

    Please login or register to see this attachment.

    • 0
    Posted

    Greetings, i am trying to connect my fireplace with fibaro through modbus tcp. I useb modbus switch qa in a post above, in debug i can see that i have succesfull connection via websocket. But i cant understand how to send data to modbus . Can anyone help me, i only need to turn on main burner and turn off. 

    Please login or register to see this attachment.

    • 0
    Posted
    2 hours ago, VedranS said:

    But i cant understand how to send data to modbus . Can anyone help me, i only need to turn on main burner and turn off. 

     

     

    for you the best solution would be the Fibaro Premium Service, more.fibaro.com 

    • 0
    Posted

    @VedranS, I would start with

    Please login or register to see this link.

    and get write and read command from there.

     

    Then with it you would add to strings 0x, so it would look like this:

    Please login or register to see this code.

     

    • Thanks 1
    • 0
  • Inquirer
  • Posted (edited)
    On 3/4/2020 at 5:54 PM, jakub.jezek said:

    Hi guys,

     

    I'm strugling now with Modbus reading. Have you encountered following? If you send 2 commands in one button, then you do not get response for 2nd command in HC?

     

     

    Hi @jakub.jezek 

     

    Did you manage to solve the issue with not being able to capture more than one response from the device? I'm currently struggling with the same problem and not making much progress.

     

    EDIT: Well, as soon as I had posted this, I had an idea... and it worked.

     

    So the problem seems to be that using any sort of looping or delays do not let the self:waitForResponseFunction() to trigger. It triggers only once after sending out all the different queries. The solution seems to be putting your individual queries into setTimeout loops. Like this:

     

     

    Please login or register to see this code.

     

    This way I end up with a list of setTimeout loops starting from 30 second interval and with 1 second in between queries. All responses get captured correctly.

    Edited by Rait
    • 0
    Posted
    4 hours ago, Rait said:

    Did you manage to solve the issue with not being able to capture more than one response from the device? I'm currently struggling with the same problem and not making much progress.

    Hi @Rait,

     

    Yes, I did. There was need to use setTimeout() function instead of sleep(). Now my Systemair is working as it should.

    • 0
    Posted (edited)

    Hello @jakub.jezek,

     

    I have problem to make the same behavior as yours but I failed.

    Can you share your QuickApp with the setTimeout() fonction instead of sleep() ?

     

    Thanks in advance.

     

    Edited by KanaChan1977
    • 0
    Posted

    Hi @KanaChan1977,

     

    I will not share whole QA yet. But part below should help.

     

    Please login or register to see this spoiler.

     

     

     

    • 0
    Posted
    21 hours ago, jakub.jezek said:

    Hi @KanaChan1977,

     

    I will not share whole QA yet. But part below should help.

     

    Please login or register to see this spoiler.

     

    It's quite common in protocols to send byte sequences with specific time intervals. It can make sense to define a function that calls other functions with given time intervals - a fibaro.setTimeoutSeries... The function takes a even variable number of arguments; <function1>,<time1>,<function2>,<time2>,...

    like the regular setTimeout, the next time will count from the previous one so we "serialise" the execution - so times becomes delays between function calls.

    It also tries to compensate for eventual time drift...

     

    Please login or register to see this code.

     

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