Quantcast
Channel: ThingSpeak IoT Community - All Forums
Viewing all articles
Browse latest Browse all 1833

Vinod on Plugin show ON/OFF devices.

$
0
0

Make a modification to the above, change the javascript logic to:

// get the data point
p = (Date.now() - new Date(data.created_at)) / (60*1000);
q = document.getElementById('LED');

// if there is a data point display it
if (p && q) {
if (p>5){ q.className = 'red-led'; } else {q.className = 'green-led';}
}

 

This will make the status LED go red if the channel was updated over 5 minutes ago. 


Viewing all articles
Browse latest Browse all 1833

Trending Articles