I’d like to post data to my home server which is on the same WiFi network as my Imp. I was planning on using http.post to send JSON encoded data, but just discovered that it only works from agent code, not device code. One of the purposes of having a home server is not needing internet access, so I’d much prefer to not upload and re-download the data if I don’t have to.
Is there a way of sending data to my server from the device directly?
No, I’m afraid not. For various reasons, including security, imps cannot make any requests on the local network. This means that the server side can do full certificate validation HTTPS connections, for example, something that wouldn’t be possible on a device with as little memory as the imp.
If you require this, you’ll need to use a different device - sorry.
I too wish Imps could communicate with other devices on the local network. I haven’t found another device that is this easy to update code on. However, I do understand how local network access could be seen a security risk though.
Heck, I’d even settle for a TX-only UDP-only message option. I basically would like to send lots of little log messages to a local database.
An IMP004 device could do it using Bluetooth LE.
If you want to rely on local wifi network only, then the simplest method is to purchase a cheap ESP01 and use this as a UART serial bridge / gateway between the Imp device and your local server. This way you are still secure and have gained a parallel local data back up method too.
Local networking is coming, but there are various prerequisites - to ensure we can do it securely - which need to be in place before that point. Not going to promise timescales publicly as that gets me into trouble, but it’s being driven by some commercial customers.