IFTTT (If this then that) Service

Started by HeneryH, December 04, 2017, 11:30:20 AM

HeneryH


Felix

Maybe an artifact from the other gateway.js posted by user spark?

sparky

If the WeatherMote was running on battery I wouldn't like the fact that every time your WeatherMote polls you will keep getting an BTN0:1/BTN0:0 until the other limit is reached.  But maybe I'm missing something...  :P
   
exports.events = {
    de_icerON : { label:'De-Icer: SM101 ON!', icon:'action', descr:'Turn SwitchMote:101 ON when temp goes below x.', serverExecute:function(node) { if (node.metrics['F'] && node.metrics['F'].value < 60 && (Date.now() - new Date(node.metrics['F'].updated).getTime() < 2000)) { sendMessageToNode({nodeId:101, action:'BTN0:1'}); }; } },

    de_icerOFF : { label:'De-Icer: SM101 OFF!', icon:'action', descr:'Turn SwitchMote:101 OFF when temp goes above x.', serverExecute:function(node) { if (node.metrics['F'] && node.metrics['F'].value > 62 && (Date.now() - new Date(node.metrics['F'].updated).getTime() < 2000)) { sendMessageToNode({nodeId:101, action:'BTN0:0)'}); }; } },/code]

HeneryH

Yes, my Weather Mot (with that submersible thermometer) is running on a SuperCap Solar power source.  And it seems to discharge significantly over night.  I need to look at the polling interval.  Hopefully it isn't pulling too much at idle. 

The constant sending of commands (either OFF or ON) depending on the current reading is not ideal.  I'll investigate a way to just check for transitions crossing the freezing line on the way down and up to only send commands then.

sparky

Yeah, that's alot of traffic.  Should be an easy way of telling it not to keep sending an ON command if it's already ON and likewise for OFF.  Then maybe lesson the polls being the water temp isn't going to change very quickly. 

HeneryH

#20
The poll is a database poll though, not a RF Mote poll, correct?

I was looking at the WaterTempMote that was a standard WeatherMot but replaced the bme280 with the "Dallas Temperature Control Arduino" library.

I'm using the following setting to stretch it as much as possible.
#define SEND_LOOPS   15 //send data this many sleep loops (15 loops of 8sec cycles = 120sec ~ 2 minutes)
#define SLEEP_LONGEST SLEEP_8S
period_t sleepTime = SLEEP_LONGEST; //period_t is an enum type defined in the LowPower library (LowPower.h)

sparky

Well the way I understand it; when the WeatherMote polls it sends, via RF, the information to the Gateway and then the GateWay sends the BTN0:1/BTN:0 commands, via RF, to the SwitchMote

HeneryH

Sure, the WeatherMote polls the temp embedded within the Moteino sketch then sends it to the gateway.

But the polling defined in the Gateway user_metrics "events" section is something different right?

I thought that event polling was a database poll that read the latest reading the gateway had stored.  I should definitely change the polling rate defined in the event regardless, but I didn't think that would have translate to RF polling of the Mote.  I'm still a noob though.