Page 1 of 1

Reflectors RESTful API

PostPosted: Sat Jan 18, 2020 2:25 am
by davinci
I want to get values from Indigo and set devices without using DDNS.

Is this possible with the subscription? Are there any docs?

Thanks

Re: Reflectors RESTful API

PostPosted: Sat Jan 18, 2020 4:03 am
by howartp
I’m not sure I understand the question?


Sent from my iPhone using Tapatalk Pro

Re: Reflectors RESTful API

PostPosted: Sat Jan 18, 2020 4:21 am
by davinci
https://wiki.indigodomo.com/doku.php?id ... stful_urls


Basically, I want to execute this command:
Code: Select all
http://127.0.0.1:8176/actions/party%20scene?_method=execute

but with the reflector:
Code: Select all
http://reflector_url/actions/party%20scene?_method=execute

since I can't use this:
Code: Select all
http://DYNDNS/actions/party%20scene?_method=execute

Re: Reflectors RESTful API

PostPosted: Sun Jan 19, 2020 12:06 pm
by jay (support)
Yes - the REST API is available through the reflector (as are all web functions).

Re: Reflectors RESTful API

PostPosted: Sun Jan 19, 2020 3:47 pm
by davinci
Perfect, thanks for the clarification.

I will try that.

Re: Reflectors RESTful API

PostPosted: Sun May 31, 2020 11:25 am
by davinci
I use the connection and albeit it is somewhat slow, it works.

However, I would like to get the update as quick as possible. So I call the API every 500 ms. But sometimes it stops working and resumes after some time. Is there a limit? What is best practice to get real time data?

Re: Reflectors RESTful API

PostPosted: Sun May 31, 2020 12:15 pm
by Dual
I’m curious why you aren’t using Indigo Touch?


Sent from my iPhone using Tapatalk

Re: Reflectors RESTful API

PostPosted: Sun May 31, 2020 1:06 pm
by FlyingDiver
davinci wrote:
I use the connection and albeit it is somewhat slow, it works.

However, I would like to get the update as quick as possible. So I call the API every 500 ms. But sometimes it stops working and resumes after some time. Is there a limit? What is best practice to get real time data?


Where are you trying to get the data to? What application is doing the polling? Also, where are you located? Where's the Indigo server and the polling client?

Re: Reflectors RESTful API

PostPosted: Sun May 31, 2020 2:15 pm
by davinci
I am from Switzerland.

The data is used in an iOS App that I developed for my personal use. It meets my needs better than IndigoTouch in terms of functionality/looks.

Re: Reflectors RESTful API

PostPosted: Sun May 31, 2020 2:37 pm
by FlyingDiver
The round trip from the Indigo server to the reflector in the US and back to your app is what's killing you. And polling is really inefficient.

You need to implement a push method of getting your updates directly from Indigo, rather then trying to poll for updates. This is a perfect situation for setting up a local MQTT server and using MQTT to push updates from Indigo to your app.

Re: Reflectors RESTful API

PostPosted: Mon Jun 01, 2020 12:25 am
by davinci
I can‘t use dyndns nor port forwarding. Is there a way around this?

I basically have to emulate what Indigo is doing, but with Swiss servers.

Re: Reflectors RESTful API

PostPosted: Mon Jun 01, 2020 8:19 am
by FlyingDiver
How much data are you polling for? How many REST API calls are you trying to make every 500ms? It's possible that if you reduce the frequency of the updates, and minimize the amount of REST calls you're making, then you MIGHT be able to get this to work acceptably.

But, the reality of the situation is that (1) polling is bad, (2) polling at sub-second intervals is worse, (3) REST API calls are fairly high overhead for a single data item, and (4) network delays from Switzerland to the US are just going to make things worse.

Since you can't do anything about (4), it's probably best to avoid using the Indigo reflector at all for this kind of high traffic volume process.

Going to some sort of Push solution solves (1) and (2). And if you're going to use a Push solution, (3) is moot.

Is there some technical reason you can't use DDNS and port forwarding? Is your application only used on the local LAN with the Indigo server, or does it need to be usable from outside your LAN? Using a VPN to access the LAN remotely would eliminate the need for port forwarding, but has it's own issues.

Do you have a cloud server available to substitute for the Indigo Reflector? Or are you willing to pay for one? The company I use for my cloud-based MQTT server (and a few other things) costs US$5/month. Mine is in a US data center, but European data centers are available.