bottleneck
Choose style:

Author Topic: Does Almond support HTTP GET API?  (Read 6979 times)

0 Members and 1 Guest are viewing this topic.

Offline BrownChiLD

  • Chestnut
  • ***
  • Posts: 64
  • Thanks: 0
  • Registered : 12/08/2013
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Does Almond support HTTP GET API?
« on: January 12, 2017, 08:09:09 am »
Hi guys
WebSockets are great, and I've yet to dive into Almonds' WS capabilities.

But at the moment I need something really simple and I favor HTTP based API as it is easy to apply and doesn't require persistent connection and re-connection routines

What I'm trying to do is rather simple, I just need to get the status of a device (value false/true) based on device ID and a more universal HTTP api GET/POST = JSON style would be nice and will work with my current stuffs.

So, can almond do this? really hope it can.

PS
What I'd really like for it to do is have a RULE where if sensor is triggered then do an HTTP GET.. I really expected this to be part of the RULES "then" actions.. I hope it gets added sometime in the near future  :( and nope IFTTT is not an option... must not be dependent on internet connectivity.

Offline sfalc

  • Backer
  • *
  • Posts: 167
  • Thanks: 0
  • Registered : 11/09/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Does Almond support HTTP GET API?
« Reply #1 on: January 12, 2017, 08:43:31 am »
No, use the WS API, that is why it is there.
Securifi already have implemented six (LocalWebUI, CloudWebUI, LCD,App,WS API, programming API) different ways to control your Almond and its sensors. They really shouldn't add a seventh, as they can hardly keep all features in sync as it is.
Almond+ with 2 dimmer switches, 2 binary on/off switches, 1 Qubino Flush dimmer, 1 Aeontec micro dimmer, 1 Fibaro Dimmer 2, 1 Lightify RGBW bulb, 2 Lightify Flex RGBW Led strip, 1 WeMo Bulb, 1 Fibaro magnetic door sensor, Vision PIR & temperature sensor.

Offline fillibar

  • Backer
  • *
  • Posts: 2060
  • Thanks: 4
  • Registered : 02/08/2013
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Does Almond support HTTP GET API?
« Reply #2 on: January 12, 2017, 11:19:20 am »
While I agree they have the WS, and other methods. I would also still like to see HTTP/HTTPS GET... Much easier for my methods than a persistent connection.
Almond 3 mesh handling the home.

Offline BrownChiLD

  • Chestnut
  • ***
  • Posts: 64
  • Thanks: 0
  • Registered : 12/08/2013
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Does Almond support HTTP GET API?
« Reply #3 on: January 13, 2017, 01:27:27 am »
No, use the WS API, that is why it is there.
Securifi already have implemented six (LocalWebUI, CloudWebUI, LCD,App,WS API, programming API) different ways to control your Almond and its sensors. They really shouldn't add a seventh, as they can hardly keep all features in sync as it is.

while i do appreciate WS API, i believe that HTTP RESTful API should've been prioritized as this has become the standard API for a lot of things already and it is much more simple and elegant to work with rather than dealing with persistent sockets which is a resource hog, most shared hosts wont even allow, and that it is less stable because maintaining persistent connection between two machines is less bulletproof than on demand TO and FROM http communication.

And personally for me at the moment, I just wanted to run a PHP file ever X seconds that will open and close HTTP connection to Almond and get device status . that's all and that's easily done w/ 1 php file , less dependencies, and a cronjob.

But with Web Sockets, i now need to keep a browser open and running to maintain the socket connection (HTML5 sockets) just to do this. and if the browser is accidentally closed, well you get the point.

I supposed i can take the same php + cron job approach, only this time php will open socket, authenticate, send receive message, then close it and rest.. this actually adds strain on the server having open, wait, maintain, and close sockets.  rather tha just GET HTTP and wait for response.


anyway, HTTP API would've been best and more universal to start with in my opinion, and I hope Securifi would consider.

Offline deyan

  • Newbie
  • *
  • Posts: 8
  • Thanks: 0
  • Registered : 29/09/2016
    YearsYearsYearsYearsYearsYearsYearsYears
Re: Does Almond support HTTP GET API?
« Reply #4 on: January 15, 2017, 09:09:07 am »
I have been trying to get this thing do what it should since day one. IFTTT support is really limited. No way to communicate with other devices. Until now I have been able to implement two hacks that offer limited functionalities, but extend the capabilities of the router greatly.
Option 1: read and listen to changes in /tmp/customRule.log - i have been using that for quite some time in order to be able to turn on/off couple of ACs using Harmony Hub and IFTTT. I do wget (which can do both GET and POST) from the router, but there is up to 60 seconds delay, since the script is run by a cronjob every minute.
Option 2: I have been able to install nodejs to the router (on external memory). This makes it a lot easier to do whatever you want - you can easily bridge the ws API to a REST API or whatever else you may need. While it requires significant time to invest, it can be done. Please note that I have not tested the performance of node in terms of memory and CPU usage. nor reliability, just tried it and it works. Take a look at this repo https://github.com/Optware/Optware-ng - i did execute the armeabi-hf script and executables do work on my Almond+. You can execute the script on your external memory and then create a softlink /opt so that everything works. Then you will have /opt/bin/ipkg which allows you to install a lot of precompiled packages, including samba (that handles large files), git, node, etc. Full list here http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabihf/Packages.html.

Offline BrownChiLD

  • Chestnut
  • ***
  • Posts: 64
  • Thanks: 0
  • Registered : 12/08/2013
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Does Almond support HTTP GET API?
« Reply #5 on: January 17, 2017, 06:53:23 am »
hi  deyan, i guess we're on the same boat ey?

thank you very much for sharing your information and experience, it's really valuable.
I went through the leads and understand where you're getting at. unfortunately, that route is too complicated and adds so much independence and relying on too many things to work.

I like to keep things simple and stable . Also since my requirement is more of to trigger my PHP application based on sensor awareness,  I might just have to deal with the WebSockets method for my current need. sucks that we dont have plain HTTP api .. hopefully in the near future.

please securifi, you already have the foundation for the HTTP API judging by the WS..just extend that a little perhaps?


Offline BrownChiLD

  • Chestnut
  • ***
  • Posts: 64
  • Thanks: 0
  • Registered : 12/08/2013
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Does Almond support HTTP GET API?
« Reply #6 on: January 17, 2017, 09:13:56 am »
..check out how elegantly simple VERA's HTTP API is..

This returns the current status for all devices including all the current UPnP variables and the status of any active jobs.


Getting status.

Examples:

    http://ip_address:3480/data_request?id=status&output_format=xml

Or for a specific device:

    http://ip_address:3480/data_request?id=status&output_format=xml&UDN=uuid:4d494342-5342-5645-0002-000000000002
    http://ip_address:3480/data_request?id=status&output_format=xml&DeviceNum=6
http://wiki.micasaverde.com/index.php/Luup_Requests#status


so simple.

 

Page created in 0.072 seconds with 24 queries.