Following on from discussions on this forum, my new iPhone app for controlling any Electric Imp device is now live on the App Store.
It features three buttons, two switches and one slider, all configurable as JSON key/value pairs.
Any chance of sharing the source (XCode project) through the dev wiki ? I’m about to start my own client => this could prove to be a great example to get the basics from saving me a lot of time figuring it out myself
Congrats! Looks great! Do you know if the HTTP-IN node decodes JSON or do you have to send it to an agent?
@brendandawes: works like a charm with the buttons
e.g. normally entering in my browser ‘https://api.electricimp.com/v1//?value=120’ and in your app
using for URL field 'https://api.electricimp.com/v1//?'
for Button 1 Key 'value’
for , Value ‘120’
(note: quotes not actually entered)
This works fine with all three buttons, but how to use the two switches in a similar way?
Also use of the slider is not entirely clear, e.g. what range does it cover and also here the same question as with the switches.
As a start a very, very useful app. Thanks for creating this!!
@jwehr - thanks! I probably should have explained that it’s really for use with agents so I’ll post some code to show exactly how to read the json values if anyone needs it.
@moose - the switches send a 0 for off and a 1 for on. The sliders send a floating point between 0 and 1.0. I’ve put together some more info on http://support.brendandawes.com/solution/categories/112900/folders/185934
More improvements to come but it’s a start!
@brendandawes I think I’ve finally gotten a handle on passing JSON to the imp agent, and that is clearly the way to go. The first version of IoT Buddy will not use JSON in the body, so it might be a good start for those who are still using HTTP IN nodes and InputPort. I’m already working on an update that will use JSON.
Have you worked with the xively.com Objective-C libraries? I’d like to add that to IoT Buddy at some point, but need to put some thought into how others might be using it. It could be a separate app, I suppose. I’m using it in my “jTherm” app and really like it.
Thanks, works great. Any chance of adding a color picker? Check out Color sender.
@vedecoid - yeah sure - source code is here: https://bitbucket.org/brendandawes/little-devil
@osheri - yeah sure, nice idea. I’ll try and add it in the next update.
I dont know how to get this little devil app to woke with my imp. I put “response”,http.jsondecode(request.body)); on the settings url and i cant get it connected using that web address there is an error (expected status codeine ((200-299), got 404.
Im vary new to programming in general, do I need to pay a third party for agent hosting to use this app and my electric imp? I don’t know what to put in the device url in the settings of the iphone app. Can you please help a less advanced programmer like myself and give me a step by step guid on how to turn an LED on. in one of the examples on the imp i.e. I leaned to turn the led on by having positive to the led and sinking current to a given pin.
There are a number of examples on the Electric Imp GitHub for handling HTTP, as well as on mine. Essentially, you receive the data, with http.onrequest, then you decode the json data, if there is some, and there will be with Little Devil. Then you just need to check within the json data for the key:value pairs that you are expecting.
Here is some example code:
@beardedinventor has an instructable on blinking an LED.
I know how to use the imp with my computer and I have done most of the examples for the April board. I feel I got the hang of it but with my lack of education I seem to be confused on how agents work with an imp. Also Im trying to figure out if i need to spend money to get an agent. Does twilleo cost money? Also do you live in the Los Angeles area? Thank you for your help Ill study the code and try to get get my Led on with this cool app. Also I have a question do you think I should make an account on get hub?, Is it a programming language forum like site?
thanks @bendandawes and @jwehr for putting this all together, this thread helped me the most to work with the agents in the new beta