Hi, I´m new using electric imp.
And I have a doubt about how can I acquire data from the IDE.
My system is: The electric imp, connected to WiFi, that control a circuit. And an android app (in a smartphone, obviously) that send commands to the electric imp. But I have two problems:
- In the log of the IDE appears a data, that was sended by the electric imp to the server. I need capture this data in the smartphone. How can i do that?
- The smartphone should be capable of recognize if the electric imp is turn off. This is another parameter that I see in the IDE, but how can I recognize the electrim imp state since the smartphone
If someone can help me with this problems, I will be so grateful
Thanks in advance
When you say “app”, do you mean a “native app”, or “website app”. If you are using a native app, which app is it?
Your agent should expose this itself over HTTP, and your mobile app should talk to that.
As @rogerlipscombe mentioned - you’ll want to add endpoints in your http.onrequest handler.
You can determine whether a device is online / offline by calling device.isconnected in the agent.
I just stumbled across NetIO and built some configurations to display data from GroveStreams. However, it could have easily gotten data directly from the agent as suggested by @beardedinventor.
NetIO is nice, as it’s both Android and iOS. The only downside is the cost ~$11.00 smartphone. I found it a bit challenging to understand at first, but now I’ve developed more than a dozen displays.
It can also send data to the agent, if need be, if you want to control something.
I think it’s worth a looksie unless you have a preferred alternative approach.
As mentioned above, agent provides http functionality. So unless there is a compelling reason to build an app, I find the web-browser based Bootstrap framework the quickest and simplest to create a mobile (smartphone) friendly web user interface for my imps.
All you need to include is two lines in the agent html page:
mlseim: beardedinventor has posted a reference code set that allows the agent to server a webpage. Then you simply point your smart phone browser to the agent url and control that way. I have used this framework extensively and it removes one more interface you need to build. It’s not an APP, but you can use it from platform.
take a look at this: https://github.com/beardedinventor/ElectricImp-PowerSwitch
edited for clarity
Thanks for all your answer.
The app that I develop by myself is called LightGo and is upload in the playStore. I use eclipse to develop that.
In this moment, I can take data loading the url, but due to my specifical aplication, this is a slow process and I need improve that. And the data that I need to adquire appears faster in the log than in the url (and the difference is almost 1second)
Thats the reason, because I want to take the data from the Log, avoiding the slow part of load the URL
Thanks again. Are you so friendly
The “log” is a log … just a message displayed by the server for local programming use. Are you sending the agent a command, and waiting for a reply? Is that what you mean takes so long? What exactly is your application supposed to do?
yes @mlseim. I want to know the state (on or off) of a system that is connected to my imp.
So my app send a data to the agent throught the url. The agent request to the device imp, the device answer to the agent and the agent put the answer in the http, then the smartphone can take it.
But all this process is so slow and in some case I receive fake data.
You can have the device send the state to the agent every time it changes via pin.configure(DIGITAL_IN, function). That way, the agent does not need to talk to the imp–it already knows the most recent state of the input.