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

QuickApp with TCP loop issue


cashe

Question

Hi!

Trying to get info from TCP device using well-known functions combination:

 

:connect() -> :waitForResponce() -> :onDataReceived() 

 

But I've got an issue. While I'm editing QA code or just having the Edit window opened it is all ok. But when I closing it, the data from QA is stoped to fall after some time (~ 10 minutes). When I go to my QAs Edit window again, the QA seems to restart itself and data flow is back.

I've even recorded a video with this issue.

 

 

What I am doing wrong?

I am using HC3 Lite controller with the last firmware installed.

 

Thanks in advance.

 

Edited by cashe
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
35 minutes ago, cashe said:

When I go to my QAs Edit window again, the QA seems to restart itself


that is “normal” behavior. Start editing will restart the quickapp.
 

Perhaps the quickapp just crashes after 10 minutes. There you have to look for the reason. 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • 26 minutes ago, SmartHomeEddy said:


    that is “normal” behavior. Start editing will restart the quickapp.
     

    Perhaps the quickapp just crashes after 10 minutes. There you have to look for the reason. 

     

    If QA crashed, it should restart itself every 1 minute, isn't it? Moreover, no error message was received.

     

    Link to comment
    Share on other sites

    • 0

    It should restart first when you re-save it again.

    Is it just the log messages that isn't logged out to the console? When it starts again, it seems to be a time gap 22:56:.. 22:59:...  is it also a time gap in the expanded (full screen) log window?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 8 hours ago, jgab said:

    It should restart first when you re-save it again.

    Sure, but it restarts exactly just after I entering the QA Edit mode, not when Saving.

     

    Here the LOG. When I entered the Edit mode, onInit was triggered.

    Please login or register to see this code.

     

    Please login or register to see this code.

     

     

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Seems, I have fixed an issue.

     

    The problem was tcp socket sometimes can be closed or the destination was unreached causing QA to stuck.

     

    Moved

        self.sock = net.TCPSocket() -- creation of a TCPSocket instance

    from onInit() to the beggining of connect() routine and also replaced with

        self.sock = net.TCPSocket({timeout = 5000}) -- creation of a TCPSocket instance
     

    Thanks everybody.

     

     

    Link to comment
    Share on other sites

    • 0

    Yes, there is an issue that the socket is wasted and a new socket needs to be created if it's disconnected due to an error (read/write)

     

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