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

[LUA script] autostart not fetch data from HTTPClient request https


Question

Posted

I have a script that graps rain data from the Dutch Buienrader website. When I start it by hand it works perfectly but when autostart runs it, no error no data.

 

Please login or register to see this code.

Debug log shows on autostart only:

Please login or register to see this code.

I cant find whats wrong.

4 answers to this question

Recommended Posts

  • 0
Posted

I bet you did not expect this... Otherwise you would not post here... but here is your problem:

 

Please login or register to see this code.

 

Because of that infinite loop, the main part of the scene "never ends". And httpClient can only run when main finishes. Which it never does so neither "error" nor "success" parts of your code get called.

 

When you run the scene manually, there is no infinite loop, htpp call proceeds and the "success" function runs.

 

Solution: move the sleep and checkRain() call to the end of the function assigned to the "success" part of the http call. And probably also to the "error" part of the call or you'll never retry after one error.

 

It is similar to setTimeout

 

  • 0
  • Inquirer
  • Posted

    Is there no one who can help me?

    • 0
    Posted

    Hi @RoyOps, did you check the Buienradar topic?

     

    There is a working VD and script for the HC2

     

     

    • 0
  • Inquirer
  • Posted

    Thanks SmartHomeEddy, that did the trick!

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