Seeed Button click type AWS IoT

Hi, can someone help how to have the code in lambda to get the click type? Right now each time i click i get undefined. What shall i pass to be able to get the click type and than act depending on it?

Thank you in advance

Hi! I also have a question surrounding click payloads. When i use the seeed button to trigger a lambda, i don’t see an option to use double click or long click to trigger the lambda. Can i use each type of click to trigger a different lambda? Or do i need to get the button click payload and take action in my code based on it being a single, double, or long click?

Hi, I also have similar situation, do you know what is it the default topic for the Seeed Button AWS, I had try with iotbutton similar to aws iot button for using with the mqtt protocol, but when I clicked it i could not get the payload also can’t trigger any lamba function and off course can not get the click type and its serial number

Hi guys. It doesn’t seem like this forum is really moderated by anyone from SEEED. Which is a little depressing. Post here if you make any progress on figuring out the different payload types. If you know the default topic for the button - that would be great too so I can see the payloads.

Not sure if you’ve solved this but the examples in the IOT mailer lambda etc. show undefined as the click type is nested in the JSON not at the top level. I solved this by just parsing the JSON

See below for an example which will let you see what’s happening in cloudwatch:

exports.handler = function(event, context) {
var msg = JSON.stringify(event);
console.log(msg);
var jsonmsg = JSON.parse(msg);
if (jsonmsg.deviceEvent.buttonClicked.clickType == ‘SINGLE’){
console.log(‘Single Click’);
}
};