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)

1235714

Comments

  • Thanks, that's a good example!
  • Awesome example Erik, gonna implement that as well for my own solar panels!
  • Could you give me some advice, I run into an error on the "GET variable step 1" card and specifically on the url parameters.

    url: http://192.168.0.110:8084/json.htm
    parameters: ?type=devices&rid=32
    JSON: $.[0][result][CounterToday]
    variable: solarToday

    What is wrong with the parameters, does it need special formatting? I tried between brackets as well but to no avail.

  • Phuturist said:
    Could you give me some advice, I run into an error on the "GET variable step 1" card and specifically on the url parameters.

    url: http://192.168.0.110:8084/json.htm
    parameters: ?type=devices&rid=32
    JSON: $.[0][result][CounterToday]
    variable: solarToday

    What is wrong with the parameters, does it need special formatting? I tried between brackets as well but to no avail.

    The second parameter must be a valid json object. Try this: {"type":"devices","rid":32}
  • PhuturistPhuturist Member
    edited March 2016
    Phuturist said:
    Could you give me some advice, I run into an error on the "GET variable step 1" card and specifically on the url parameters.

    url: http://192.168.0.110:8084/json.htm
    parameters: ?type=devices&rid=32
    JSON: $.[0][result][CounterToday]
    variable: solarToday

    What is wrong with the parameters, does it need special formatting? I tried between brackets as well but to no avail.

    The second parameter must be a valid json object. Try this: {"type":"devices","rid":32}
    Right I could have figured that out based on the default brackets myself ... :dizzy:  . I got this working now, pretty sweet.

    And the stangest thing is, my JSON contains this "8.153 kWh" but Homey seems to know the meaning of of the abbreviation of kWh and tells me "kilowatt hours" . How can it do that?
  • Phuturist said:
    abbreviation of kWh and tells me "kilowatt hours" . How can it do that?
    https://www.ivona.com
  • For what i tested, only the american voice translate kWh to kilowatt hour
  • Quick sanity check - I'm trying to read the bri/hue/sat settings of some Hue lights, but the "Get variable step 1" card gives me a strange message:



    These are the values used:

    {}
    $.state.bri
    Get_Trigger_Hue_Jar_Bri

    I can't find a "<" token anywhere in those :)
  • Quick sanity check - I'm trying to read the bri/hue/sat settings of some Hue lights, but the "Get variable step 1" card gives me a strange message:



    These are the values used:

    {}
    $.state.bri
    Get_Trigger_Hue_Jar_Bri

    I can't find a "<" token anywhere in those :)
    Did you copy and paste any of the values. Make sure no markup is pasted along (for instance first paste in in the address bar of your browser and copy it from there). Other than that I wouldnt know and it looks fine.
  • Nope, what I pasted here I copied directly from the card - it's squeaky clean!

    In a separate flow I'm using a similar card to get some other values from another source, that works just fine (green tick appears). The only difference is that it has content between the {}s.
  • Hm - even when I change those values to a dummy URL, a trigger callled "test" and no JSONPATH at all I get the same error. Could it be that 0.8.22 broke something?
  • ErikVanDongenErikVanDongen Member
    edited March 2016
    Hm - even when I change those values to a dummy URL, a trigger callled "test" and no JSONPATH at all I get the same error. Could it be that 0.8.22 broke something?
    I investigated this. The philips hue API is strict. But if the query object (2nd parameter) is an empty object the app adds a ? to the url. The philips hue API does not accept this. I just submitted an improved version (0.5.2).

    You can get it here if you don't want to wait: https://github.com/irritanterik/homey-http-request-actions
  • That was quick! Thanks Erik, much appreciated.
  • edited March 2016
    What would be the best way to go about troubleshooting a trigger not working properly? I have a trigger flow that performs a GET every hour, but the variable from step 2 doesn't always update. When I execute the trigger myself, it gets updated about half the times.

    (I sooo wish there was an internal Homey system log that recorded flow action)

    Update: nothing to do with the trigger not working, I look at the BetterLogic list of variables and their timestamps. That's not correct, see https://forum.athom.com/discussion/840/better-logic-variable-management#latest.
  • Guys, all we're missing is authentication headers, if I get down on my knees and beg, could it be added?

    Pretty, please?
  • MarkSwift said:
    Guys, all we're missing is authentication headers, if I get down on my knees and beg, could it be added?

    Pretty, please?
    Can you describe the card and parameters you'll need for this? There's very little room for parameters, so adding header/auth options on the existing cards is no option.
  • Hi, One of the api's I use requires one, in my php script I currently use:

    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: numbersandlettershere='));

    BTW, is the option to update variable in better logic from a certain JSON value fully working now?
  • Do you need further info, it would be great to get this working!
  • MarkSwift said:
    Do you need further info, it would be great to get this working!
    I added a new action card, it allows you to use all possible parameters, but it needs some Geekness. It will be published in the app store after Athoms code-review. Expect it within a few days or get it now from github.
  • Hello,

    Thanks for making this app, works wonderfully. I have a question, which is perhaps not specifically a problem with this app, but more with my inability to fully grasp HTTP GET/POST/whatever.

    Yamaha receivers can be controlled with HTTP_POST, as far as I know, but a quite lengthy xml code has to be send. Nothing that I try in Homey seems to work. What I think I should be sending is something like the following:

    POST /YamahaRemoteControl/ctrl HTTP/1.1
         "<YAMAHA_AV cmd="PUT"><System><Power_Control><Power>Standby</Power></Power_Control></System></YAMAHA_AV>"

    Do you have any idea how to enable this in Homey?

    Thanks~!
  • POST /YamahaRemoteControl/ctrl HTTP/1.1
         "<YAMAHA_AV cmd="PUT"><System><Power_Control><Power>Standby</Power></Power_Control></System></YAMAHA_AV>"

    Do you have any idea how to enable this in Homey?
    It would be best to develop a Yamaha app! There is a nodejs library available.
    The HTTP app does not support xml formatted or free format body POST.
    An issue with a free format body would be special characters. It would be hard and possibly risky to work around Homey's native special-character-escaping mechanism for flow card parameters.

  • POST /YamahaRemoteControl/ctrl HTTP/1.1
         "<YAMAHA_AV cmd="PUT"><System><Power_Control><Power>Standby</Power></Power_Control></System></YAMAHA_AV>"

    Do you have any idea how to enable this in Homey?
    It would be best to develop a Yamaha app! There is a nodejs library available.
    The HTTP app does not support xml formatted or free format body POST.
    An issue with a free format body would be special characters. It would be hard and possibly risky to work around Homey's native special-character-escaping mechanism for flow card parameters.

    Thanks for the quick response, I'll try to look into developing an app.
  • @KoenMartens you could also try converting an existing app like my Onkyo receiver app https://github.com/jordenc/com.onkyo

    Replace the commands and in a few days Yamaha might be working :)
  • Version 0.6.0 is now available with a special geek card for full node http options support (e.g. authentication headers)
  • @ErikVanDongen Thank you, hopefully I can figure it out ;-)
  • MarkSwiftMarkSwift Member
    edited April 2016
    Sanity check:

    I currently use Domoticz as I have a bunch of MySensors. I have 2 of these sensors on my robot mower garage, one detects rain, and another detects soil moisture, they're both simple on / off switches.

    I am right in thinking that in order to record them as variables to use elsewhere, I need 2 flows for each. One that runs on an interval and looks up the JSON value, and the seconds which uses the trigger card, to set the better logic variable. Is that right? Also, how can I match the http variable to my better logic variable?

    Edit: Okay, got it working. This is how I have it setup:

    Flow  1: every 5 minutes get a 2 x JSON values
    Flow 2 & 3: Based on variable trigger, set Better Logic variable.
    Flow 4: If Better Logic variables = "On", Trigger mower to return.

    Does that seem an efficient use of the cards?
  • You can consider using the HTTP apps API and 'push' a flowtrigger from Domoticz. 
    Using the Better Logic API for this is also an options. 
  • You can consider using the HTTP apps API and 'push' a flowtrigger from Domoticz. 
    Using the Better Logic API for this is also an options. 
    Can you provide me a quick example, that sounds ideal!

    BTW, I'm pasting in a plain text GET command:

    http://192.168.1.14:8080/json.htm?type=command&param=switchlight&idx=6&switchcmd=On

    It seems to get changed to:

    http://192.168.1.14:8080/json.htm?type=command¶m=switchlight&idx=6&switchcmd=On

    On either paste or save, any ideas?
  • MarkSwiftMarkSwift Member
    edited April 2016
    Same thing, after saving and returning to the flow it's been modified :(

    Such a shame I was so close to the perfect flow to my robot mower!
Sign In or Register to comment.