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

Virtual device main loop not executing


stevenvd

Question

I am probably creating a loop that is failing somewhere and I am not seeing it. But I am having the following problem:

In the main loop of a virtual device I try to do a ping for a Lan device. If it fails the Device is offline. Else it is online. And I Turn on the receiver and change the Icon of the virtual device.

That all works great and the debug window is never showing any problems (not if the device is on or off). But when the Device actually changes state, The loop seems to stop running as the devices are not switched on or off. When I go to the virtual device, add or remove a space in the code and press "save". The code runs again.

Any Ideas?

Code below:

Please login or register to see this code.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

add and will work more then 1 time

Please login or register to see this code.

Link to comment
Share on other sites

  • 0
  • Inquirer
  • It does not seem to make any difference....

    I put the tcpSocket:disconnect(); before the if errorCode == 0 then. But still only works one time.

    [ Added: 2013-09-25, 09:39 ]

    I pug in a fibaro:log(errorCode); with a sleep.

    It runs until I shut down the device I am pinging. And I don't even get to see the errorcode...

    Link to comment
    Share on other sites

    • 0
    It does not seem to make any difference....

    I put the tcpSocket:disconnect(); before the if errorCode == 0 then. But still only works one time.

    [ Added: 2013-09-25, 09:39 ]

    I pug in a fibaro:log(errorCode); with a sleep.

    It runs until I shut down the device I am pinging. And I don't even get to see the errorcode...

    Hi Stevenvd

    Have a look to my post

    Please login or register to see this link.

    Try the method with the pressbutton and the virtual device

    Let me know if it works better

    Regards

    David

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I believe that that would work! But I don't like it as a permanent solution, I mean isn't the Main loop made for this?

    Please login or register to see this image.

    /emoticons/default_tongue.png" alt=":P" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    Still no luck though...

    Link to comment
    Share on other sites

    • 0
    I believe that that would work! But I don't like it as a permanent solution, I mean isn't the Main loop made for this?

    Please login or register to see this image.

    /emoticons/default_tongue.png" alt=":P" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    Still no luck though...

    I agree with you but it is the only way I found to solve my problem

    I don't have any error now with that solution..

    so when I will have good feedback for main loop, I will use it

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Cool, thanks! using it now and works good!

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