Hi,
I am very new to Spark and before I commit myself to use this in my project, I want to know if it is possible to do what I have in mind.
Here is what I am planning to do:
Monitor a physical variable, like say, for example the water level of my water tank every minute. I want to log this information via a streaming service: https://www.initialstate.com/streaming
This service allows me to post my variables to their cloud based system.
In case the monitored variable goes beyond a certain value, I want an email/tweet to be sent out to me, as a warning.
Both 1 and 2 are easily achieved via python if I use a raspberry Pi hooked up to my sensor. But I want to achieve everything via the Spark. This keeps my project small and web enabled from the get-go.
The question is: is this doable.
I read the API documentation. I know I can GET and POST urls to my core. But how do I make my CORE itself do a POST request to the streaming service webserver?
And how do I get the core to send out a tweet? Are there libraries that I can use for this purpose?
Thanks for your patience in reading my post.
Have a good day.
Seemanta
@seemanta, since the Core cannot do https directly, you can now do GET/POSTs using webhooks. These allow you use use Spark.subcribe()/publish() to send or get data from any website to and from the Core. A neat new feature recently added is the ability to have the Cloud do a JSON parse on return data so you only get what you want from the payload, removing the need to do JSON parsing in the Core.
I’m looking at using the Photon for monitoring some things, but security is an issue for me. So I need to be able to push data from the photon in real time, but I can’t use the public cloud.
@aaltieri, perhaps @Dave can clarify. If you cannot connect to a public network, you may want to consider using TCP only. If you search the forum, you will find examples like this one:
The “local cloud” is a version of the full Spark Cloud you can run on a local computer such as a Raspberry Pi for example. Though it does not support all the functions of the full Cloud, it can be used where internet connectivity to the Spark Cloud is not available or not desired.
If you need this to be entirely local only and want to use the local cloud, you can always add something like webhooks behavior to the local cloud quickly. I’m hoping to sketch out a better interface for extending the local cloud, but if you installed it / got your core connected to that locally, you could do something like…
// etc
if (lowername == "my/event") {
var request = require('request');
request({ url: "https://mysite.foo/api" ... });
}