I wasn’t sure if I should post this in Mobile or Planner, sorry if this is in the wrong sub.
A project I’m working on uses an Android app to modify/read states on an imp. The imp is communicating with sensors, and should be able to inform the app of changes to states. What I’d like to do is have the app read the imp state to update the GUI, but from what I can tell there’s no storing of data on the Planner or electricimp.com cloud. All I really need is a few bytes at most, do I need a web server?
I may have not been clear, but I also need the Android app to view the values (or even modify them) as well. My impression is that’s not possible with permanentvalues.
A simple example based on the http.onrequest() documentation, using Agent.
This example assumes a switch (to GND) on pin 1, and a LED (to GND, through 470 ohm resistor) on pin 2:
Agent:
`
responses <- []
http.onrequest(function(req, res) {
responses.push(res)
local val = -1
if(“led” in req.query) {
val = req.query.led == “on” ? 1 : 0
}
device.send(“ping”, val)
})
device.on(“pong”, function(data) {
foreach(res in responses) {
res.send(200, format(“switch: %s”, data ? “on” : “off”))
}
responses = [];
})`
Device:
`
local sw = hardware.pin1
local led = hardware.pin2