Suggest a very simple cloud to store on/off for a remote switch? (like SONOFF)

Hi There!
Can anyone suggest a simple but reliable cloud platform that I can use to "share" a button status between a web panel (or App) and the remote device?

It's like the SONOFF devices, but I need to develop my own to use, for instance, more than 1 outputs with one GSM device

All I need to be able to do is

  1. Web panel (or App) has a button, when it's clicked, it sends a "1" to a specific cloud channel. When it's clicked off, it uploads a "0" to the cloud.
  2. Remote device continously read the last status of the specific cloud channel, when it reads a 1, it switches a relay ON. When it reads a 0, it switches the relay off.

I currently use Thingspeak but it has some limitations, and is more complex than I need-
I only need to store the last update, I don't require any history keeping

Thanks!!

Have you considered http://mqtt.org/? Its a lightweight protocol with a publish/subscribe model that might fit your application nicely. List of public brokers at public_brokers · mqtt/mqtt.org Wiki · GitHub

Otherwise perhaps a redis or mongodb hosted database? For example https://redislabs.com/pricing/cloud/ (free for 30Mb of data and 30 connections) or MongoDB Atlas Database | Multi-Cloud Database Service | MongoDB.

To be honest Im more (well...only) used to API REST protocol. All my devices work with TS on API REST connections.
Is there any advantage with using MQTT?
Would I trust all those Mqtt listed servers? This is for a comercial project

Thanks!!

Well if you have the resources for rest API's I guess theres no real push to go to MQTT. Although the ability to subscribe to a topic rather than repeatedly poll an API endpoint might make your system more responsive. The list of public brokers is merely for the PoC stage- you can get paid plans or run your own infrastructure if you wish.

Otherwise the hosted redis or mongodb might suit as they are only generally charged on data stored not requests made. There are obviously paid plans for those too.

Ok, there's something I don't get here. While using API REST to check for a status change in the "cloud" channel (and determine that the relay status has to change", yes, I need to be polling the server every X seconds.
In yoursentence above it looks like while using MQTT I would subscribe to a topic and I wouldn't need to poll to seek for changes? How does that work?

Thanks

An MQTT client maintains a persistent TCP connection to the broker and simply waits for messages to be pushed to it. Very simple in theory although in the real world your code has to handle the connection being interrupted (and some brokers will kick you off after periods of inactivity)

The most famous MQTT library for Arduino is https://pubsubclient.knolleary.net/

I had no clue about that behaviour in mqtt connections. Now, comparing both ways, TBH I prefer to have full control over my connections, polling the server with the frequency I feel comfortable with, relying on opening the TCP socket and closing it when it's finished, etc...instead of assuming my connection will be open to then discover that the server decided to close it, or having to check all the time that a loss of ocverage hasn't finished my connection.
I still need a good reliable but simple (if possible using API REST :slight_smile: ) server that retains the last state (on or off) so I can poll it from my device to decide whether to turn a relay on or off
Being this simple Im even considering a custom development for this too. Security is my only concern...

In that case you are back to a hosted nosql database like redis or mongodb. If going the custom route then perhaps look into Amazon SimpleDB or Google's Cloud Datastore. All these provide the ability to store and retrieve key-value pairs in a simple manner.

This table summarises some of the google vs amazon products.