This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.
Official

[APP] Simple HTTP Connector For Flows (2.0.0)

145791014

Comments

  • Phuturist said:
    And the bearer-token gets refreshed with every login?
    No, it's a personal token for your account. The author of Better Logic already implemented this on my request. It would be good to have this for the HTTP app as well.
    Can it be implemented in simple http commands from webpages though (i.e. making a home-brew website with different commands with easy html/css)? If so, how?
  • ErikVanDongenErikVanDongen Member
    edited April 2016
    Ok guys, version 1.0.0 is now submitted in the App store. 
    This is a breaking release for anyone using the API calls to trigger flows.
    The Authorization header with bearer token is now obligated for security reasons.
  • Ok guys, version 1.0.0 is now submitted in the App store. 
    This is a breaking release for anyone using the API calls to trigger flows.
    The Authorization header with bearer token is now obligated for security reasons.
    And published!
  • RikPostRikPost Member
    edited April 2016
    Sounds great!
    I use this app a lot and it always worked flawless. Great addition to Homey!

    Today I've updated the app to 1.0.0 but the GET triggers aren't working for me.
    Tried the http://<YourHomeyIP>/api/app/com.internet/<event>; on the same network what didn't trigger my flow.
    When trying to get it triggered from out of the network (with the right token) this message is popping up:


    Any idea what may cause the GET function not triggering any flows?

    -edit-

    I reinstalled all flows after instalation
  • RikPost said:
    Today I've updated the app to 1.0.0 but the GET triggers aren't working for me.
    Tried the http://<YourHomeyIP>/api/app/com.internet/<event>; on the same network what didn't trigger my flow.
    When trying to get it triggered from out of the network (with the right token) this message is popping up:


    Any idea what may cause the GET function not triggering any flows?

    Hi Rik. I'm sorry for the inconvenience, but since today the API calls to trigger flows need the Authorization Header with the right bearer token. Check the note about it in description in the App Store.
  • Hi Erik, thanks for the prompt reply!
    The bearer token is only needed for external access isn't it?
  • RikPost said:
    Hi Erik, thanks for the prompt reply!
    The bearer token is only needed for external access isn't it?

    Nope. It's required on all calls.
  • RikPost said:
    Hi Erik, thanks for the prompt reply!
    The bearer token is only needed for external access isn't it?

    Nope. It's required on all calls.
    I grabbed a link with htpp://<Homey-ip>/?/bearer_token=1a2b3c4d5e...
    I use the the url: htpp://<Homey-ip>/api/app/com.internet/micaan
    Where do I have the put the Bearer Token in the url?
  • HansieNL said:
    RikPost said:
    Hi Erik, thanks for the prompt reply!
    The bearer token is only needed for external access isn't it?

    Nope. It's required on all calls.
    I grabbed a link with htpp://<Homey-ip>/?/bearer_token=1a2b3c4d5e...
    I use the the url: htpp://<Homey-ip>/api/app/com.internet/micaan
    Where do I have the put the Bearer Token in the url?
    You must put it in a header 'Authorization' with value 'Bearer <token>'. Like this example in postman:



  • https://tools.ietf.org/html/rfc6750#section-2.3
    It's not recommended to put the bearer-token in the url, a provider may support this however. I tried with access-token, access_token, auth_token, auth-token bearer-token and bearer_token but none of these are supported by Homey...
  • Thx, but I can't get it working. I hope someone from Athom comes up with a solution so we can Incomming GET requests again.
  • You can but you have to send an extra header, i.e. with the postman addon. Though I fully understand your use-case and I can't manage my homey the same way I did, I understand why this is necessary...

  • It's working from my laptop. Unfortunately I'm not able to get it working from the Home Remote app.
    I asked the guys of this app for some assistance to get it working as well. 
    For now it looks like only POST and PUT with bearer tokens is supported in the app.

    Nevertheless, great work again Erik!
  • What about an opt out setting to disable authorization on the API?
  • What about an opt out setting to disable authorization on the API?
    On its way:

  • @Erik: going to nitpick: If you're doing this I think it would be best to create two different settings, one for WAN-ip's and one for LAN-ip's. I know wifi isn't that secure but still, I trust the devices on my lan but don't trust the wan :)
  • Usually for situations like this one first creates a VPN-connection to home and then connects from a local IP or uses the bearer-token as you implemented...
  • ErikVanDongenErikVanDongen Member
    edited April 2016
    Usually for situations like this one first creates a VPN-connection to home and then connects from a local IP or uses the bearer-token as you implemented...
    Unfortunately there is no distinct in API configurations in the SDK for external or internal authorization settings at this moment. 
  • HansieNL said:
    Thx, but I can't get it working. I hope someone from Athom comes up with a solution so we can Incomming GET requests again.
    Version 1.1.0 is now pending Athom's approval. With this version you can disable/enable authorization on the apps API.  I expect it to be published by the end of this week.
    Don't forget to restart the app (you can do this on the apps overview screen) after changing the settings.
    By default it will require authorization.
  • @ErikVanDongen ;

    You know you can register an callback when settings change?
    There you can stop/restart/unregister etc your listeners/things.

    Example (from my, yet unpublished, app)
    // Listen for changes in settings
            Homey.manager('settings').on('set', function(settingname) {
                Homey.log("");
                Homey.log('Setting has changed: ' + settingname);
    // If key has changed
    if (settingname == 'updateFrequenty') {
                    // If the frequenty is change we have to cancel the current interval and schedule a new
                    self.checkSettings();
                    Homey.log('Clearing current interval: ' + interval);
                    clearInterval(interval);
                    Homey.log('Scheduling weather update every: ' + update_frequenty);
                    self.scheduleWeather(update_frequenty);
                    Homey.log('Fetching weather right now');
                    self.updateWeather();
    } else {
                    self.checkSettings();
                }
    });
  • ErikVanDongenErikVanDongen Member
    edited April 2016
    @RobinVanKekem I know, but in this case it's not helping. The api.js file - where the setting is read - is only interpreted once when the app starts. It's not possible to change an apps API runtime.
  • @RobinVanKekem I know, but in this case it's not helping. The api.js file - where the setting is read - is only interpreted once when the app starts. It's not possible to change an apps API runtime.
    Ah, I see.
    I see an upcoming feature request  B)
  • HansieNL said:
    Thx, but I can't get it working. I hope someone from Athom comes up with a solution so we can Incomming GET requests again.
    Version 1.1.0 is now pending Athom's approval. With this version you can disable/enable authorization on the apps API.  I expect it to be published by the end of this week.
    Don't forget to restart the app (you can do this on the apps overview screen) after changing the settings.
    By default it will require authorization.
    Got it installed and everything works o.k. now.
  • HansieNL said:
    HansieNL said:
    Thx, but I can't get it working. I hope someone from Athom comes up with a solution so we can Incomming GET requests again.
    Version 1.1.0 is now pending Athom's approval. With this version you can disable/enable authorization on the apps API.  I expect it to be published by the end of this week.
    Don't forget to restart the app (you can do this on the apps overview screen) after changing the settings.
    By default it will require authorization.
    Got it installed and everything works o.k. now.
    How did you install 1.1.0? 
  • HansieNLHansieNL Member
    edited April 2016
    HansieNL said:
    HansieNL said:
    Thx, but I can't get it working. I hope someone from Athom comes up with a solution so we can Incomming GET requests again.
    Version 1.1.0 is now pending Athom's approval. With this version you can disable/enable authorization on the apps API.  I expect it to be published by the end of this week.
    Don't forget to restart the app (you can do this on the apps overview screen) after changing the settings.
    By default it will require authorization.
    Got it installed and everything works o.k. now.
    How did you install 1.1.0? 
    Check Node.js version on Homey:
    Settings - System - Show Stuff for geeks - node_version

    Install Node.js:
    Download Node.js (Homey's version) from https://nodejs.org/en/ and install it on your PC.

    Download App.ZIP from GitHub (https://github.com/...)  to your PC:
    Click "Download ZIP"

    Unpack ZIP:
    Unpack App.ZIP on your PC

    Open Node.js command prompt, and install the athom-cli tools:
    npm install -g athom-cli

    On the command prompt, log in to your Homey:
    athom login

    Navigate to the 'root' folder of the App on your PC

    For running project:
    athom project --run

    For installing project:
    athom project --run



  • i think that was a trick question :)
  • Anyone knows if the GET method also supports parsing of xml data? I'm trying to build a flow using 'HTTP request' to get the status xml from my Denon receiver (http://192.168.1.13/goform/formMainZone_MainZoneXml.xml) and I want to check if the receiver is turned on (check if "<Power><value>ON</value></Power>" is present in the xml response) so I can set this as a global variable. I'm afraid this cannot be achieved (yet), any ideas?
  • Is it possible to create a link such as : http : // < homeyip > / <flow name>
    
    Once the link is opened that will run a flow.
    
    I want to put these shortcuts as links in my phone so that it becomes a kind of remote .
    
    The standard app with all machine I do not work fine . I prefer that I can serve my flows.
  • T-mo-T said:
    Anyone knows if the GET method also supports parsing of xml data? I'm trying to build a flow using 'HTTP request' to get the status xml from my Denon receiver (http://192.168.1.13/goform/formMainZone_MainZoneXml.xml) and I want to check if the receiver is turned on (check if "<Power><value>ON</value></Power>" is present in the xml response) so I can set this as a global variable. I'm afraid this cannot be achieved (yet), any ideas?
    No, xml parsing is not supported for now. Are there more use cases out there that needs a xml variant of the json value getter?

  • 0burner0 said:
    Is it possible to create a link such as : http : // < homeyip > / <flow name>
    
    Once the link is opened that will run a flow.
    
    I want to put these shortcuts as links in my phone so that it becomes a kind of remote .
    
    The standard app with all machine I do not work fine . I prefer that I can serve my flows.

    Yes. You can read the instructions in the app store.
Sign In or Register to comment.