I have not attempted this as yet but before I do I thought to ask the question. I am trying to find a code solution where I can get my imp device to not only send data to imp agent as normal (plenty how to tuts here so can do this part ok) but also want the device to send the same data directly to an RPI web server on the private LAN using say REST GET and POST once I hard code the RPI IP address (will assign as static IP address here).
Purpose is that in the event of loss of internet I can still see my data by accessing my RPI web server when I am logged into LAN.
If you want to use the Imp to communicate without using the agent, you’ll have to add something like bluetooth or other wireless networking to your design. While it is perfectly capable of executing code in an offline mode, there is no native way to communicate directly to the device over IP.
Ok, thanks for confirming. Yes looks like I now need to rethink my system architecture as to what should be used for remote node level and local web server versus how my sensor data is then communicated to the outside world via my imp device / gateway.
Or connect the imp to the Pi using UART, and log your data over the serial bus. I’ve done this on a couple of occasions, though it assumes both devices are close enough for you to run a cable between them.
As banana pi, raspberry pi, arduino, beaglebone and imp can all talk i2c at hardware level, is there some kind of higher level protocol eg MQTT that they could use to message pass with each other?
So would skynet run over the i2c and then imp tunnel the messages onto the internet (in a way echoing Imp’s namesake) and if so would this make the imp and imp-cloud “transparent” to the device using it?
Sorry no hadn’t quite understood what you wanted to do. But the raw i2c could be web encoded/decoded at each end. If/when e.imp supported MQTT then you should be able to send binary. Any news on MQTT?
As you may know, for security reasons Imp devices are designed to only communicate to the agent via your LAN & router. So, a Keep It Simple approach was applied and I bypassed the LAN altogether if the Internet connection was lost, by sending data directly to RPI using a P2P topology. The distance between the Imp device and the RPI was close enough to allow me to use two 433MHz transceivers, at the expense of 2 Imp GPIO’s for UART, to send data between the two. So not much code involved other than a serial write or read command.
Now, I probably would use Bluetooth Low Energy as there is now a new IMP004 device which includes BLE 4.1.
Agent MQTT Support is out in preview / beta. So please reach out to Electric Imp Support and they can likely help you to get your devices onto our MQTT preview program.
For local network quick prototyping (NO local security), I now use this as Serial to WebSocket interface: https://www.seeedstudio.com/Grove-UART-WiFi-V2-(ESP8285)-p-3054.html
I can send a command to connect WiFi, then open a WebSocket server (or client). It is a bit make sense in the context of imp Cellular communicate to the local WiFi network. It might be just interim to wait for platform-supported local networking.