Ifttt integration sending "fake" events


(Alessandro Marzini) #1

Hello to everyone,
using the TTN Node I’m catching the “button” event to receive a trigget on IFTTT that send me a message on Telegram. Everything is working smoothly excelt the fact that TTN IFTTT Integrations send events also when I don’t press my TTN Node button.
In Payload Format - Converter I’ve this:

function Converter(decoded, port) {
// Merge, split or otherwise
// mutate decoded fields.
var converted = decoded;
converted.trigger = false;

if (port === 1 && (converted.led === 0 || converted.led === 1)) {
converted.led = Boolean(converted.led);
}
if (port == 4) {
converted.trigger = true;
}
return converted;
}

This is the decoder part (that I didn’t modify):

function Decoder(bytes, port) {
var decoded = {};
var events = {
1: ‘setup’,
2: ‘interval’,
3: ‘motion’,
4: ‘button’
};
decoded.event = events[port];
decoded.battery = (bytes[0] << 8) + bytes[1];
decoded.light = (bytes[2] << 8) + bytes[3];
decoded.temperature = ((bytes[4] << 8) + bytes[5]) / 100;
return decoded;
}

Should I put trigger=false also in the “decoder” part too?
Thanks

Alessandro Marzini


(Alessandro Marzini) #2

So I did some debug and I created another IFTTT integration sending me app_id, dev_id and the port.
app_id and dev_id are of course the same I configured the ifttt integration, but the port is without any value. So for example this morning I received two of this:
Event ttn_node_event occurred at May 14, 2019 at 08:40AM.
app_id: almoonds-iot
dev_id: ttnnode
port:
So, am I doing something wrong in the encoder/decoder/validitor or is possible that TTN is sending spurious triggers?