Message Boards Message Boards

0
|
8472 Views
|
1 Reply
|
3 Total Likes
View groups...
Share
Share this post:
GROUPS:

Watch a databin for new entries?

Posted 7 years ago

In his Data Drop announcement post Stephen Wolfram writes:

You don’t have to make a report. Instead, you can just have a Wolfram Language program that watches a databin, then for example sends out alerts—or takes some other action—if whatever combination of conditions you specify occur.

How exactly does one do that? I'd like to send an email whenever a new databin entry is added, but after hours of googling I cannot find anything related to any such functionality.

I thought I came close when I found out about Channel-Based Communication, but the instructions there work "the other way around", i.e. pushing a message into a databin when the channel receives one -- not pushing a message into a channel when the databin receives one.

POSTED BY: Ville Saalo
Posted 7 years ago

Dear Ville,

This is a simple demo on how this can be done.

I've set up the following wolfram language script and left it running in a raspberryPi.

CloudConnect["user@domain.com","password"]; 
db=Databin["databinID"];
count=db["EntryCount"]; 
latestCount=count;
While[
    FindFile["quit.txt"]==$Failed,  
    latestCount=db["EntryCount"];
    If[latestCount>count, SendMail["Record added in DataBin @"<>DateString@Now];
    count=latestCount;];
    Pause[10];]
    DeleteFile["quit.txt"]

You could use other methods to interrupt the process that we'll trigger in the raspberry Pi instead of checking for the file. Try out the new Channel-Comm to play with this.

enter image description here

From my computer I added a record in the databin

DatabinAdd[db, 666];

The script detected the increase in recordcount of the bin and send me a message back to my registered email address.

enter image description here

POSTED BY: Diego Zviovich
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract