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)

1356714

Comments

  • Thanks to @Emile I was able to put a little app together for simple HTTP get/put/post requests. Check it out in the store : https://apps.athom.com/app/com.internet

    With this app you get a few extra actions in flows:
    [...]
    Feedback is welcome! 
    Happy hacking!
    Hi Erik, 
    Thanks for the app! I like it already....
    But ;-)
    Is it possible to put headers in it? 
    Something like : 
    Header:  
    Authorization: Bearer 2002c000Deaf001000bad1000effe000hace0002
    Content-Type: application/json; charset=UTF-8
    I think you already know why....
    (https://forum.athom.com/discussion/comment/10833/#Comment_10833 )

    Maybe we can create flows to program Homeys ;-)
  • TarikFaik said:
    traying to trigger android auto remote with url but dont work and if i copy and past the url in a browser it just works



    Gotta love the UI! ;)
  • @GeurtDijker: I considered it, but will not implement header-options in the app. It's too complicated for most users and the flow-cards are really small.
    But you can modify my app and install it locally (read developer docs: cli athom project --install) if you need this.

    PS: Version 0.3.0 is now pending approval.

  • I can i do this with the app?


    This is for the ikettle 1.0 
  • @GeurtDijker: I considered it, but will not implement header-options in the app. It's too complicated for most users and the flow-cards are really small.
    But you can modify my app and install it locally (read developer docs: cli athom project --install) if you need this.

    PS: Version 0.3.0 is now pending approval.


    +10


  • ErikVanDongenErikVanDongen Member
    edited February 2016
    jovink said:
    I can i do this with the app?


    This is for the ikettle 1.0 
    Nope. The iKettle has no REST interface. You can create an app for it based on this nodejs module: https://libraries.io/npm/ikettle.js/1.0.2

    Edit: Haha or use this one (after it's fixed): https://apps.athom.com/app/am.smarter?category=appliances

  • Uranday said:
    @GeurtDijker: I considered it, but will not implement header-options in the app. It's too complicated for most users and the flow-cards are really small.
    But you can modify my app and install it locally (read developer docs: cli athom project --install) if you need this.

    PS: Version 0.3.0 is now pending approval.

    +10
    @ErikVanDongen ;
    Thanks I certainly will try, already started with MyFistHomeyApp  (the Hello World com.athom.hello)
    I understand the problem, I hope they will make cards with a Popup button to configure (Like the add Devices wizard)

    @Uranday
    do you give +10 Erik because he refuses my request or do you like me to create that extension?  ;-) 
  • Is it possible to send a HTTP Post JSON to a specific port number? When adding the port in the destination field (for instance http://192.168.2.10:19444) the flow does not run and a red exclamation mark appears on the card.
  • Uranday said:
    @GeurtDijker: I considered it, but will not implement header-options in the app. It's too complicated for most users and the flow-cards are really small.
    But you can modify my app and install it locally (read developer docs: cli athom project --install) if you need this.

    PS: Version 0.3.0 is now pending approval.

    +10
    @ErikVanDongen ;
    Thanks I certainly will try, already started with MyFistHomeyApp  (the Hello World com.athom.hello)
    I understand the problem, I hope they will make cards with a Popup button to configure (Like the add Devices wizard)

    @Uranday
    do you give +10 Erik because he refuses my request or do you like me to create that extension?  ;-) 

    Because he submitted version 0.3.0
  • Phuturist said:
    Is it possible to send a HTTP Post JSON to a specific port number? When adding the port in the destination field (for instance http://192.168.2.10:19444) the flow does not run and a red exclamation mark appears on the card.
    Yes, it's possible. I'm running 0.3.0 and I can post to my testnode with port 19444 :). Is your JSON correct?
  • Phuturist said:
    Is it possible to send a HTTP Post JSON to a specific port number? When adding the port in the destination field (for instance http://192.168.2.10:19444) the flow does not run and a red exclamation mark appears on the card.
    Yes, it's possible. I'm running 0.3.0 and I can post to my testnode with port 19444 :). Is your JSON correct?
    Strange, JSON seems to be correct. It gives me a green check when not using the port number. After adding the port number it's a red cross. So I'm pretty sure it had something to do with the port number. I'm running version 0.2. Perhaps this is fixed in 0.3 on which you tested it?!?
  • Be sure you type / paste the url and port without any markup. Can you post a screenshot of the card? Or PM me on slack.
  • Noob question: how do i activate a Hue scene? 
    i want to activate this scene:
    },
    "2f2c88bd4-off-0": {
    "name": "Surf Relax off 1449008873000",
    "lights": [
    "1",
    "2",
    "3",
    "4",
    "9",
    "10"
    ],
    "owner": "ffffffffd64b465effffffffcb33aea4",
    "recycle": true,
    "locked": false,
    "appdata": {},
    "picture": "",
    "lastupdated": "2015-12-19T11:38:58",
    "version": 1
    }

    So i create a Put action something like this ?? 

    http://<ipadress>/api/3b1e2625398977273b69d5f138e58a53/group/0/action

    {
    "on": true,
    "scene": "Surf Relax" 
    }

    Getting confused by the documentation, maybe someone got a example for me?
  • Be sure you type / paste the url and port without any markup. Can you post a screenshot of the card? Or PM me on slack.
    Bought a secondhand Homey so I dont have a slack invite. I already made sure there is no markup in the fields. Here is a screenshot.


  • Just a wild guess, what happens if you put the [0,255,255] between quotes?
  • ErikVanDongenErikVanDongen Member
    edited February 2016
    Phuturist said:
    Be sure you type / paste the url and port without any markup. Can you post a screenshot of the card? Or PM me on slack.
    Bought a secondhand Homey so I dont have a slack invite. I already made sure there is no markup in the fields. Here is a screenshot.


    Ah. I didn't know slack was on invite only. 

    The HTTP Post JSON card sends this request:
    ****HTTP Post Request received*****
    headers:  { host: '192.168.0.8:19444',
      accept: 'application/json',
      'content-type': 'application/json',
      'content-length': '54',
      connection: 'close' }
    body:  { color: [ 0, 255, 255 ], command: 'color', priority: 100 }

    Can you test your receiving device with a tool like postman? If your device expects a 'application/x-www-form-urlencoded' cntent-type, something must be wrong with your JSON, because this content-type does not allow multi dimensional data, like color. If it's a really weird implementation one of these jsons might work:
    {"color[0]":0, "color[1]": 255, "color[2]": 255,"command":"color","priority":100}  
    {"color":"[0,255,255]","command":"color","priority":100}
    {"color":"0,255,255","command":"color","priority":100}
  • Phuturist said:
    Be sure you type / paste the url and port without any markup. Can you post a screenshot of the card? Or PM me on slack.
    Bought a secondhand Homey so I dont have a slack invite. I already made sure there is no markup in the fields. Here is a screenshot.


    Here you get the slack invite:

    https://developers.athom.com/slack/
  • Noob question: how do i activate a Hue scene? 
    i want to activate this scene:

    "2f2c88bd4-off-0": {

    {
    "on": true,
    "scene": "Surf Relax" 
    }

    Getting confused by the documentation, maybe someone got a example for me?
    You're allmost there: use  {"scene": "2f2c88bd4-off-0"} 

  • The HTTP Post JSON card sends this request:
    ****HTTP Post Request received*****
    headers:  { host: '192.168.0.8:19444',
      accept: 'application/json',
      'content-type': 'application/json',
      'content-length': '54',
      connection: 'close' }
    body:  { color: [ 0, 255, 255 ], command: 'color', priority: 100 }

    Can you test your receiving device with a tool like postman? If your device expects a 'application/x-www-form-urlencoded' cntent-type, something must be wrong with your JSON, because this content-type does not allow multi dimensional data, like color. If it's a really weird implementation one of these jsons might work:
    {"color[0]":0, "color[1]": 255, "color[2]": 255,"command":"color","priority":100}  
    {"color":"[0,255,255]","command":"color","priority":100}
    {"color":"0,255,255","command":"color","priority":100}
    Ok, I might know what is wrong. The receiving webserver is a Raspberry PI running Hyperion (Hyperion is software for controlling LED strips and capable of creating DIY Ambilight). Hyperion is using websockets for it's communication, so the JSON send by this app is probably not what it's expecting. I did find a script that uses parameters and that should be able to send the correct POST so I'm gonna look into this (https://github.com/tvdzwan/hyperion/issues/313#issuecomment-172244381). Thanx for the help.
  • Ah. You need something that sends data through a Web Socket. So no Get/Post/Etc request. Maybe I can create a card for that. 
    Do you have the athom cli installed? So you can test this with a non published version of the app?
  • Ah. You need something that sends data through a Web Socket. So no Get/Post/Etc request. Maybe I can create a card for that. 
    Do you have the athom cli installed? So you can test this with a non published version of the app?
    Not yet but that wont be an issue. If I could add this a feature request it would be awesome and I'd be willing to test it locally.
  • Noob question: how do i activate a Hue scene? 
    i want to activate this scene:

    "2f2c88bd4-off-0": {

    {
    "on": true,
    "scene": "Surf Relax" 
    }

    Getting confused by the documentation, maybe someone got a example for me?
    You're allmost there: use  {"scene": "2f2c88bd4-off-0"} 
    Sorry but i can't get it to work, any tips?

  • It's groups instead of group.
  • It's groups instead of group.
     :(  that i missed that, thanks Erik it is working now (sort of) 
  • Is it also possible to control a connected KAKU dimmer with Homey's REST API?
  • Is it also possible to control a connected KAKU dimmer with Homey's REST API?
    No. Those 433 Mhz devices are not connected to your LAN network or WAN, so not controllable with HTTP commands.
  • Is it also possible to control a connected KAKU dimmer with Homey's REST API?
    No. Those 433 Mhz devices are not connected to your LAN network or WAN, so not controllable with HTTP commands.

    You enabled it to post data to homey didn't you? 

    Post variable, trigger flow, turn on lamp.. Can't wait till my app is done. I think I'll start with an kaku switch that reacts on a book value.. 


  • Is it also possible to control a connected KAKU dimmer with Homey's REST API?
    No. Those 433 Mhz devices are not connected to your LAN network or WAN, so not controllable with HTTP commands.
    I thought that maybe the settings of the KAKU where stored in the settings which can be controlled by the REST API. Controllig the flows was also a plan B for me.

    Thanks for thinking with me.
  • Is it also possible to control a connected KAKU dimmer with Homey's REST API?
    No. Those 433 Mhz devices are not connected to your LAN network or WAN, so not controllable with HTTP commands.
    I thought that maybe the settings of the KAKU where stored in the settings which can be controlled by the REST API. Controllig the flows was also a plan B for me.

    Thanks for thinking with me.
    Ah now I understand (or read) better. You can start a flow with version 0.3.0 and higher with a Get request to Homey. You can also use variables with this. So with that it's possible to start flows which switches any connected device.

    BTW: My app does not support calls to the Homey Api itself, for it does not support authentication headers. 
Sign In or Register to comment.