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

Get a 404 error with the Somfy API on HC3 only (are they blocking FIBARO?)


Question

Posted

At the moment I'm working on trying to integrate the Somfy Tahoma/Switch IO system. At my local system (with

Please login or register to see this link.

) I can connect to the API to get a access token. When I run exactly the same code on the HC3 I get a HTTP 404 error (Page Not Found). The code isn't that complicated:
 

Please login or register to see this code.

 

The HC3 doesn't show me the body or headers when an error occurs. In the message variable only the error code is shown (404).

 

Has someone experience with this? I tried everything, it looks like they are blocking traffic from the HC3. I tried to add another User-Agent string, but no luck.

Recommended Posts

  • 0
Posted

Hey Fibaro guru's, please give your opinion on this issue.

  • 0
Posted

The first thing that comes to my mind when someone tries a cloud API is... Are you 100 percent sure you are following their rules? For example, are you hitting a rate limit or forgetting about a security measure (eg confirm access on the cloud)? I guess rate limit will show as 500 instead of 404. My 1 cent worth of ideas ;)

  • Like 1
  • 0
Posted (edited)

I'm not sure at all, but somfy is well known to block API calls from users that acces it to much.

 

Could it be, that it is blocked at (not sure how it is called(user agent level)).

So, maybe it's blocking everything from fibaro ?

 

I am using a KLF with a local API, to work with my somfy screens.

Edited by ppeterr
  • Like 2
  • 0
  • Inquirer
  • Posted
    16 minutes ago, petergebruers said:

    The first thing that comes to my mind when someone tries a cloud API is... Are you 100 percent sure you are following their rules? For example, are you hitting a rate limit or forgetting about a security measure (eg confirm access on the cloud)? I guess rate limit will show as 500 instead of 404. My 1 cent worth of ideas ;)

     

    Hi Peter, good to hear from you. I follow their rules (I think). On my workstation with the web browser, wget (Linux) and from Lua code (from ZeroBrane Studio) it works. Exact code doesn't work on HC3. That is strange. I tried max 25 times, so I don't think the rate limit is the problem. When the HC3 fails and I run it again from my workstation it works.

    • 0
    Posted (edited)

    Okay. Doesn't the HC3 have different versions of TLS enabled? Can't remember what people were talking about but I have memorised it as "not all https works on hc3". Sorry for being vague. Trying to think in different directions of what you have already checked...

    Edited by petergebruers
    • 0
    Posted

    Please login or register to see this code.

    Make sens ?

    • Like 1
    • 0
  • Inquirer
  • Posted
    28 minutes ago, Tony270570 said:

    Please login or register to see this code.

    Make sens ?

    Tested also. Didn't work. Connecting from HC3 to https://accounts.somfy.com works (I get the webpage in the debug console). When I add /oauth I get a 404.

    • 0
    Posted

    I think you are missing some "secret sauce" like a cookie or a header, when I try your URL on my mac

     

    Please login or register to see this code.

     

    So 302 means "redirect" to the login page (as expected, that is what you see in a browser: a login form)

     

    Does the http client on a HC3 follow a 302? I am not sure.

     

    I have to admit ... It is not a 404 either but I wonder what happens if you paste the URL in a "private window" aka "incognito window". Does it behave as expected?

    • 0
  • Inquirer
  • Posted
    14 minutes ago, petergebruers said:

    I think you are missing some "secret sauce" like a cookie or a header, when I try your URL on my mac

     

    Please login or register to see this code.

     

    So 302 means "redirect" to the login page (as expected, that is what you see in a browser: a login form)

     

    Does the http client on a HC3 follow a 302? I am not sure.

     

    I have to admit ... It is not a 404 either but I wonder what happens if you paste the URL in a "private window" aka "incognito window". Does it behave as expected?


    A private window works. ?

    Lua on the HC3 doesn’t follow a 302 I think. With TQAE I get one page further. Fill in the login form with code and get the 302 and get stuck there. But that was my next question. 
     

    I start to see why there isn’t a integration already. 

    • 0
    Posted

    Maybe you can steal copy some ideas from the HASS integration:

     

    Please login or register to see this link.

     

    Specifically token stuff in 

    Please login or register to see this link.

     

    But then you'd probably have to understand the oauthlib used.

     

    Please login or register to see this link.

     

    It is not a rabbit hole, it is a black hole of code ;)

    • Like 2
    • 0
    Posted

    Have a look here:

     

    Please login or register to see this link.

    Please login or register to see this link.

     

    They have changed the API !!!!

     

    Please login or register to see this attachment.

    • 0
  • Inquirer
  • Posted

    Thank you, I got it working and I'm releasing end of the month. :)

     

    • Like 1
    • 0
    Posted

    awesome !!! can you share your script to get the token on the HC3? 

    • 0
  • Inquirer
  • Posted
    1 hour ago, Brunanchon said:

    awesome !!! can you share your script to get the token on the HC3? 

    Yes, end of this month I publish a blog about it and the full QA code.

    • Like 1
    • 0
    Posted
    23 hours ago, Joep said:

    Yes, end of this month I publish a blog about it and the full QA code.

     

    Excellent, last year i started with some code for the KLF hub to work with SomfyIO.

     

    It should work, and it did...but i am really interrested in your project since the KLF is kinda buggy ( or my *abuse* coding skills ) :P

     

    Thanks in advance!

    • 0
    Posted
    On 4/11/2022 at 10:11 AM, Joep said:

    Yes, end of this month I publish a blog about it and the full QA code.

    looking forward to the release! 

    • 0
  • Inquirer
  • Posted

    I released it past tuesday ->

    Please login or register to see this link.

    • Like 1
    • 0
    Posted
    8 hours ago, Joep said:

    I released it past tuesday ->

    Please login or register to see this link.

     

    Thats really nice, great blog you made there. Excellent work.

     

    Maybe someday i will get myself a Tahoma Switch. But its another 200 euro and i have

    some sort of other working solution. (KLF velux) But its by far not so nice as this sollution.

     

    Thanks!

    • 0
    Posted
    W dniu 28.04.2022 o 07:53, Joep napisał:

    I released it past tuesday ->

    Please login or register to see this link.

    Hi

    Great job. Did You tested it witch Somfy Connectivity Kit? I bought one yesterday to check, but it doesnt work. I dont know if i made mistake, or it wont work witch it - only tahoma switch

    • 0
  • Inquirer
  • Posted

     

    5 hours ago, MACZinstalacje said:

    Did You tested it witch Somfy Connectivity Kit

     

    No, I didn't, so I can't say if it works. :( 

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