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)

189101113

Comments

  • @Vonkenboer can you share the url endpoint you are using?
  • If someone needs a solution for case like this, @ErikVanDongen found it:
    Use card A22
    First parameter: {"method": "POST", "uri": "http://192.168.0.25", "json": {"801":{"170":null}}}
    Second parameter: $.801.170.116
    Third parameter: select a Better Logic variable
    viktor said:
    Hi @ErikVanDongen
    Sorry, but your app is really universal and i'm trying now to connect to my Solarlog and read the PV Data.
    Maybe you can help me to save the data to a BL variable.
     POST Adress is http://192.168.0.25/getjp
    RAW POST is {\"801\":{\"170\":null}}.

    The Output is:
    {   "801":{      "170":{         "100":"13.02.17 21:21:15",         "101":0,         "102":0,         "103":0,         "104":0,         "105":26500,         "106":25600,         "107":200600,         "108":242200,         "109":49391200,         "110":0,         "111":0,         "112":0,         "113":0,         "114":0,         "115":0,         "116":11025      }   }}

     How can i save the Value for example from "116"? Here "11025"?

    Thanks
    Viktor

  • @ErikVanDongen
    First of all thank you for this very usefull app.

    I am using the T20 trigger card to send data from my Arduino to Homey with a HTTP GET. The data I include is only available as a string. However I would like to transfer it to a betterlogic number variable. As far as I can see there is no equivalent to the A80 card which you can use only for JSON expression? Is there any possibility to do this? Do you plan such a feature in future?
  • @G4nd41f
    You can use the API interface of Better Logic directly (requires a PUT request, type conversion will be done by Better Logic). Another approach is to use a MathJs Expression action from the Better Logic app:


  • bvbbvb Member
    edited April 2017

    I try to use this App to get my Bose Sountouch running and do not get this scenario running:

    Can someone tell me where I need to enter what in a flowcard?

    "So in short to set the Preset to Preset 1, you would send the following XML payload:
    Recipient : http://speakerIP:8090/key
    Data : <key state ="press" sender="Gabbo">PRESET_1</key>"

    Source: https://community.bose.com/t5/SoundTouch-Speakers/API-Code-use/m-p/23804#M23577

    Receipint is the URL I think, but when I enter the "data" into the second field there is only PRESET_1 remaining and when I test the flow I get error 400.

    Thanks for your help.

    Comment after some try and errors:

    OK, I got it to work to Switch the Bose Sountough on/off, like when you press the power button:

    - Used the POST XML Flow Card
    - Insert in the first field: "http://"insert_IP_adress_of_the_Bose_ST_here":8090/key"
    - in the second field "<key state="press" sender="Gabbo">POWER</key>"

    This turns the Sountouch on/off when I Trigger the flow. But: When I copy and paste the second command in the flow, then there is only displayed "POWER". To make this working, you need to type the whole comment by hand in the field to accept the whole command line as it is displayed.

    What I did not discover, how to use the PRESET_1 commant, as it overrides the existing presets in ST.

    I'm also wondering if there is no one using the Bose ST. In other Forums there are a lot of sample scripts and apps for this device. Isn't here someone using Bose Soudtough? I'm not a coder :-(, but it seems simple to write an app for this or some Workflows with this HTTP app.


  • undergroundunderground Member
    edited April 2017
    bvb said:

    I'm also wondering if there is no one using the Bose ST. In other Forums there are a lot of sample scripts and apps for this device. Isn't here someone using Bose Soudtough? I'm not a coder :-(, but it seems simple to write an app for this or some Workflows with this HTTP app.


    I have Bose SoundTouch and the required API V1.1.0 documentation. I also changed the http request app to send XML data to simulate the power button for the SoundTouch.
    Later on, the app implemented the XML option, but since I quit programming for Homey, I haven't tested the XML card. However, I got the same issue as you have with the XML changing to POWER only. I guess the XML tags are removed somehow. But the author said he fixed it. (but maybe not)

    But yes, the Bose SoundTouch API is very simple, you are ight. But programming for homey is cumbersome taking you back to the 80's
  • JeroenvanoJeroenvano Member
    edited May 2017
    Hi I need some help please ...

    I am starting to learn to use this app and making use of API to trigger actions on devices but I am kind of stuck at the moment. Maybe someone can get me in the right direction ;)

    I was able to execute these with the app on my Axis camera:
    http://user:pass@ipaddress/axis-cgi/io/lightcontrol.cgi?action=L1:-0

    But I am having trouble executing these on my Axis camera:
    http://myserver/axis-cgi/io/virtualinput.cgi?action=1:/
    http://myserver/axis-cgi/io/virtualinput.cgi?action=1:\

    It looks to me that the problem is in the "/" and "\" characters but I am not sure.

    Anybody any clue?
    Do you have some logging available of these requests? You can get logging by running the app from CLI or with my realtime logpage , available on Github. 

    It's probably the / and \ characters. You can try \\ instead of \ .
    Another approach is to use the advanced HTTP options. It allows to put the URI between quotes. You can read about that in the readme (app store description).
    Ok - I still am having trouble to execute virtual input commands to my axis camera. I used @ErikVanDongen
    suggestion to log and it looks to be an authentication issue:


    For the record, for testing/logging purpose I created a new user account on my axis camera called "user" with password "pass" like shown in the log. So this is not an error but done on purpose to give you a full view on the log.

    Also using advanced http options gives the same error:
    {"protocol":"http:","hostname":"ipaddress","port":80,"path":"/axis-cgi/io/virtualinput.cgi?action=1:/","headers":{"authorization":"Basic dXNlcjpwYXNz"}}

    I am able to execute these with the app on my Axis camera:
    http://user:pass@ipaddress/axis-cgi/io/lightcontrol.cgi?action=L1:-0

    Not sure what the issue is but it looks that authentication is not working .... someone any clue?
  • fomfurfomfur Member
    Hi everybody!

    I've tried to search the forum but I haven't find a clear answer. The question is; is it possible to GET a Ajax call and get some information in the return. For example I call a flow and within the flow a variable is set to true, so the return would be something like { status:OK, variable: true, etc.. }

    Thanks!
  • @ErikVanDongen Thanks a lot for this awesome app! 

    I'm using it to shutdown or reboot my HTPC using a piece of software called 'Airytec Switch Off'. It creates a link to shutdown or reboot my HTPC. Really awesome and usefull.

    But I like to do more with it, like starting programs on my HTPC and change settings in windows 10. Do you know some windows apps that can be used for this?

  • bvbbvb Member
    I try to make a validation if the Bose Soundtouch is ON or OFF.

    I want to use the GET JSONpath function to check if the system is on "STANDBY": 

    1. URL: http://192.168.0.20:8090/now_playing
    2. No parameter needed, but I can't save the flow without a value... any ideas?
    3. JSONpath: $.nowPlaying.source
    4. Value: STANDBY 

    The following is returend when I enter the URL in my browser:

    <nowPlaying deviceID="8030DC576803" source="STANDBY">
    <ContentItem unusedField="0" source="STANDBY" isPresetable="true"/>
    </nowPlaying>

    Can someone help me?

  • Hello,
    Sorry but i can't get it working. Can somebody give me a simple example how to trigger a flow by a http request?

    Thanks
  • @koeniebert

    If I open this url in my browser: 192.168.1.210/api/app/com.internet/kantoorventilator
    (the ip is of my Homey, set it to match yours!)

    It triggers this flow:



    And the ventilator in my Office switches on or off :-)

    Is this what you were looking for?
  • Thank you. I will try this.
  • This is what i get:
    {"status":401,"result":"no_auth_method_found"}

  • EternityEternity Member
    edited September 2017
    In my browser I get this response (with the example shown above):

    {"status":200,"result":"OK"}

    Are you in the same Network? Perhaps you are sending this via G3/4 (external network) and Homey is on a different one...

    Both Homey and your pc/phone should be connected to the same wifi network. 
  • casedacaseda Member
    edited September 2017
    Http app has by default security on, so the bearer token needs to be send in the header (not possible in url)
    You can disable it in the app's settings (on your own risk), or use one of the ways to add bearer token as header along with the GET
  • Hi all. I've updated the app to SDK v2. No functional changes, only some bugfixes based on crash reports i received.
  • Thanks! 
  • howto install v2.0.0 ???

  • PhuturistPhuturist Member
    edited September 2017
    satbopper said:
    howto install v2.0.0 ???

    It looks like this version of the HTTP app depends on Homey firmware 1.5.3 or later. This version is only in developer preview at the moment so you will have to be patient until that hits the stable channel.
  • What @phuturist says. I found a bug in the sdk v2 on version 1.5.0 and Athom swiftly fixed this the next day in 1.5.3.
  • B3rtB3rt Member
    edited September 2017
    since the last (auto) update to v 2.0.1 of the app my cards suddenly dont work anymore (i am on homey 1.5.3).

    Also  after disabling the auth method i keep getting:
    ["status"]=> int(401) ["result"]=> string(20) "no_auth_method_found"
    Ofcource i added the IP's to the whitelist, but i keep getting teh same error.
    Also i have no idea what the login should be, i cannot set any user/pass etc.

    Think there is a bug in the app, i cannot get it to work at all, when i 'test' the card in homey it works normal, but when i try it from a remote browser or remote address (within my network) it gives the above no auth message.

    Turning off the auth message has no effect, also adding IP's to whitelist does not work.

    Hope this can be fixed soon, my wall tablet is sadly not working anymore (i build a interface on these http flow cards to control my lighting).

    update/edit:

    It seems that the url for local network is changed in this new version!
    old url:
    http://[YourHomeyIP]/api/app/com.internet/[event]/[value]
    new url:
    http://[YourHomeyIP]/api/app/com.internet/whitelist/[event]/[value]
    The whitelist option is new in the url....
  • B3rt said:
    since the last (auto) update to v 2.0.1 of the app my cards suddenly dont work anymore (i am on homey 1.5.3).

    Also my whitelist is suddenly empty and after disabling the auth method i keep getting:
    ["status"]=> int(401) ["result"]=> string(20) "no_auth_method_found"
    Ofcource i re-added the IP's to the whitelist, but i keep getting teh same error.
    Also i have no idea what the login should be, i cannot set any user/pass etc.

    Think there is a bug in the app, i cannot get it to work at all, when i 'test' the card in homey it works normal, but when i try it from a remote browser or remote address (within my network) it gives the above no auth message.

    Turning off the auth message has no effect, also adding IP's to whitelist does not work.

    Hope this can be fixed soon, my wall tablet is sadly not working anymore (i build a interface on these http flow cards to control my lighting).
    Hi Bert, did you restarted the app after changing the Auth setting?
  • B3rt said:
    since the last (auto) update to v 2.0.1 of the app my cards suddenly dont work anymore (i am on homey 1.5.3).

    Also my whitelist is suddenly empty and after disabling the auth method i keep getting:
    ["status"]=> int(401) ["result"]=> string(20) "no_auth_method_found"
    Ofcource i re-added the IP's to the whitelist, but i keep getting teh same error.
    Also i have no idea what the login should be, i cannot set any user/pass etc.

    Think there is a bug in the app, i cannot get it to work at all, when i 'test' the card in homey it works normal, but when i try it from a remote browser or remote address (within my network) it gives the above no auth message.

    Turning off the auth message has no effect, also adding IP's to whitelist does not work.

    Hope this can be fixed soon, my wall tablet is sadly not working anymore (i build a interface on these http flow cards to control my lighting).
    Hi Bert, did you restarted the app after changing the Auth setting?
    yes, but i edit my last post, it seems the url for local connect was changed.
    After updating the url it worked again.

  • B3rt said:
    B3rt said:
    since the last (auto) update to v 2.0.1 of the app my cards suddenly dont work anymore (i am on homey 1.5.3).

    Also my whitelist is suddenly empty and after disabling the auth method i keep getting:
    ["status"]=> int(401) ["result"]=> string(20) "no_auth_method_found"
    Ofcource i re-added the IP's to the whitelist, but i keep getting teh same error.
    Also i have no idea what the login should be, i cannot set any user/pass etc.

    Think there is a bug in the app, i cannot get it to work at all, when i 'test' the card in homey it works normal, but when i try it from a remote browser or remote address (within my network) it gives the above no auth message.

    Turning off the auth message has no effect, also adding IP's to whitelist does not work.

    Hope this can be fixed soon, my wall tablet is sadly not working anymore (i build a interface on these http flow cards to control my lighting).
    Hi Bert, did you restarted the app after changing the Auth setting?
    yes, but i edit my last post, it seems the url for local connect was changed.
    After updating the url it worked again.

    Hmm.. the whitelist option allways existed. Whitelist url checks the request origin IP against the configured whitelist. The non-whitelist url will check for the authorization headers as long as the auth configuration is active.
  • bvb said:
    I try to make a validation if the Bose Soundtouch is ON or OFF.

    I want to use the GET JSONpath function to check if the system is on "STANDBY": 

    1. URL: http://192.168.0.20:8090/now_playing
    2. No parameter needed, but I can't save the flow without a value... any ideas?
    3. JSONpath: $.nowPlaying.source
    4. Value: STANDBY 

    The following is returend when I enter the URL in my browser:

    <nowPlaying deviceID="8030DC576803" source="STANDBY">
    <ContentItem unusedField="0" source="STANDBY" isPresetable="true"/>
    </nowPlaying>

    Can someone help me?

    Hi BvB
    Did you ever get this to work, I am trying to do the same thing but not successful so far;-(
    Jacques

  • bvb said:
    I try to make a validation if the Bose Soundtouch is ON or OFF.

    I want to use the GET JSONpath function to check if the system is on "STANDBY": 

    1. URL: http://192.168.0.20:8090/now_playing
    2. No parameter needed, but I can't save the flow without a value... any ideas?
    3. JSONpath: $.nowPlaying.source
    4. Value: STANDBY 

    The following is returend when I enter the URL in my browser:

    <nowPlaying deviceID="8030DC576803" source="STANDBY">
    <ContentItem unusedField="0" source="STANDBY" isPresetable="true"/>
    </nowPlaying>

    Can someone help me?

    Hi BvB
    Did you ever get this to work, I am trying to do the same thing but not successful so far;-(
    Jacques

    Enter only {} for the second parameter if no parameter is needed. The 3rd parameter should be:
    $.nowPlaying.$.source

    Will that work for you?
  • Hello,

    I am trying to post an XML soap message to my TV to turn it of. But when I use the POST XML action card, I am unable to paste the required XML code in the second parameter field:

    <?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1"><IRCCCode>AAAAAQAAAAEAAAAvAw==</IRCCCode></u:X_SendIRCC></s:Body></s:Envelope>

    Has anyone any idea why this doesn't work? From curl of via postman everything works fine.

    Gr. Remco

  • Hello,

    I am trying to post an XML soap message to my TV to turn it of. But when I use the POST XML action card, I am unable to paste the required XML code in the second parameter field:

    <?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1"><IRCCCode>AAAAAQAAAAEAAAAvAw==</IRCCCode></u:X_SendIRCC></s:Body></s:Envelope>

    Has anyone any idea why this doesn't work? From curl of via postman everything works fine.

    Gr. Remco

    Unfortunately the Homey interface escapes all tags on the flow card text input fields. I have not found a way to work around this.
  • RemcoHanninkRemcoHannink Member
    edited January 2018
    Rik,

    Good tip, the flooring XML with escaped <> is working in the action card:

    &lt;?xml version="1.0" encoding="utf-8”?&gt;&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;s:Body&gt;&lt;u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1"&gt;&lt;IRCCCode&gt;AAAAAQAAAAEAAAAvAw==&lt;/IRCCCode&gt;&lt;/u:X_SendIRCC&gt;&lt;/s:Body&gt;</s:Envelope&gt;

    < = &lt;

    > = &gt;

Sign In or Register to comment.