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
AutoFrank

Looking for help to decode http success message

Question

Hi,

I am looking for help in decode a http success message

 

If I issue the following through a browser it works....

Please login or register to see this code.

and the response in the browser is

Please login or register to see this code.

 

now, if I run this in a scene

Please login or register to see this code.

It also works but I cannot find way to display the success message ( I want to trigger another action if not successful)

I tried removing the " ==200 " if-then loop as I can't see any 200 or 201 result.

 

Could somebody explain what the

Please login or register to see this code.

is doing and I may be able to figure out why I may not be seeing the success message

 

Thanks

-f

 

 

Share this post


Link to post
Share on other sites

15 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • okay, I have verified the format of http GET request is correct

     

    If I run a request against the HC1 api and use a print table/nested table function from @petergebruers I can see the kv pairs

     

    scene code as follows...

     

    Please login or register to see this code.

    If I replace the url with the call to the sonos-http-api

    Please login or register to see this code.

    the http GET request completes successfully (as I can hear the sonos player saying hello)

     

    .. but I get an ERROR - Operation canceled in the debug window

     

    Please login or register to see this image.

    /monthly_2017_02/Capture12.PNG.06d5c6f12537e95e5c47b159aecce7a5.PNG" alt="Capture12.PNG" />

     

    I also can't decode the http response.

    In wireshark I can't see the 200 code, but if I drop into a browser I get a success message back in the browser window as shown above.

     

    Any ideas or suggestions welcome

    Thanks

    -f

     

    Share this post


    Link to post
    Share on other sites
    • 0

    Long shot... does the second command take longer than 2 seconds? Now in the request you have "timeout = 2000" (ms). I'd try 10000 or so.

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • 7 minutes ago, petergebruers said:

    Long shot... does the second command take longer than 2 seconds? Now in the request you have "timeout = 2000" (ms). I'd try 10000 or so.

    thanks @petergebruers

     

    in a browser the 'success response' is pretty quick

    I'll tried 10 and 20 seconds and no luck

     

    I'll try and find out more about the http response from the api developer

     

     

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • a little more info

     

    a wireshark trace reveals that both the Status Code and status are present when I run it through the browser

    Please login or register to see this attachment.

     

    if I run it from the HC2 in a scene, its not that easy to pick out on the WS trace.

    The request does execute but I'm still getting the debug error

     

    Please login or register to see this attachment.

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • a little more digging and I think it maybe related to the response for that command

     

    A normal api command (volume/+2) gives a 200

    Please login or register to see this attachment.

     

    Add a syntax error to the url and I get a 500

    Please login or register to see this attachment.

     

    but change to the say command and I get the error

    Please login or register to see this attachment.

     

    I'm passing this info to the api developer to see what he thinks

     

     

     

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • 22 minutes ago, AutoFrank said:

    a little more digging and I think it maybe related to the response for that command

     

    A normal api command (volume/+2) gives a 200

    Please login or register to see this attachment.

     

    Add a syntax error to the url and I get a 500

    Please login or register to see this attachment.

     

    but change to the say command and I get the error

    Please login or register to see this attachment.

     

    I'm passing this info to the api developer to see what he thinks

     

     

     

     

    sorted - it was a timing issue

    For a small phase like "Hello" it took almost 50 seconds to pass back a success code and message

     

    thanks for all the suggestions....

    -f

     

     

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • 36 minutes ago, AutoFrank said:

     

    sorted - it was a timing issue

    For a small phase like "Hello" it took almost 50 seconds to pass back a success code and message

     

    thanks for all the suggestions....

    -f

     

     

     

    last post..

    there seems to e a minimum response time and encoding the message reduces the time more

    Now I can send a 10-14 message and have the response back around the same time.

     

    if the message gets longer I'll need to adjust the timeout and I just checked and I can do that on the fly ..

     

    so all sorted.. the puzzle pieces are starting to come together :-)

    thanks again 

     

     

     

     

     

     

    Share this post


    Link to post
    Share on other sites
    • 0

    Hi,

     

    Today I also got an error: Operation cancelled.

    I'm not such a great programmer like @AutoFrankand @petergebruers but nevertheless I never got a warning like this.

    Something new inside our Fibaro-system?

     

    TRicky

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • 5 minutes ago, TRicky said:

    Hi,

     

    Today I also got an error: Operation cancelled.

    I'm not such a great programmer like @AutoFrankand @petergebruers but nevertheless I never got a warning like this.

    Something new inside our Fibaro-system?

     

    TRicky

     

    @TRicky

     

    where did you get the error ?

     

    BTW - This is the scene code I ended up with that will help me with my next project

     

    Please login or register to see this code.

     

     

     

    Share this post


    Link to post
    Share on other sites
    • 0

    @AutoFrank,

     

    That's the part I didn't get. I saw this notification this evening and it was reported around 13:00 hours today.

    At that time I was playing around with my (very simple) auto lights on/off scene so I guess it has to be caused by that scene.

    Strange......

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • Just now, TRicky said:

    @AutoFrank,

     

    That's the part I didn't get. I saw this notification this evening and it was reported around 13:00 hours today.

    At that time I was playing around with my (very simple) auto lights on/off scene so I guess it has to be caused by that scene.

    Strange......

     

    @TRicky

     

    Sounds odd indeed.. my work was new development so it was more my lack of information on the sonos api that a change in HC2

     

    It was ultimately caused by me not providing a large enough timeout value in a http request.

    I was trying to process the http response status before it was received.

     

    Are you trying to do something similar with a http request or were you changing the scene when the error happened ?

     

    Share this post


    Link to post
    Share on other sites
    • 0

    @AutoFrank, no absolutely not.

    Just playing around with a very simple lights on/off scene that didn't work (cause of a Dimmer2 with bad reception of the Z-Wave network, as I just found out).

    So absolutely no high end programming.....

     

    But nevertheless the first time I saw this error, strange!

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • Just now, TRicky said:

    @AutoFrank, no absolutely not.

    Just playing around with a very simple lights on/off scene that didn't work (cause of a Dimmer2 with bad reception of the Z-Wave network, as I just found out).

    So absolutely no high end programming.....

     

    But nevertheless the first time I saw this error, strange!

    @TRicky

     

    perhaps you could try and recreate the scene or if that doesn't work, maybe a  backup and reboot to see if it clears the anomaly ?

    -f

    Share this post


    Link to post
    Share on other sites
    • 0

    Re: timeout

     

    is there a way to test for valid response from http request i.e. call has processed and error code / status is valid?  I assume http request is non-blocking after the defined timeout limit ?  So rather than adjust timeout value,  "loop" until status is valid value and http processing has completed?

     

    does that make any sense?

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • 3 minutes ago, ipsofacto said:

    Re: timeout

     

    is there a way to test for valid response from http request i.e. call has processed and error code / status is valid?  I assume http request is non-blocking after the defined timeout limit ?  So rather than adjust timeout value,  "loop" until status is valid value and http processing has completed?

     

    does that make any sense?

     

    Hi @ipsofacto

    That's an interesting approach. I'd still need to set an upper limit that I can check to see if it has failed or the api is down.

    My apologies - I should have explained what I am planning .

     

    I'm looking to create a generic Message Hub with the usual notification options like pushover, HC2 email, popup and others but also including TTS. If a TTS fails or another notification method fails  I'll want to send it over analternative notification method and if the internet is down I will send it to HC2 popup.

    .. so this means that I need to provide enough time for a TTS to succeed but also be able to detect if the api is down or if a TTS call is likely to fail.

     

    .. well that's the plan :-)

     

     

     

     

     

    Share this post


    Link to post
    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...