Hi all,
i try to code a payload decoder for a “Skiply Smilio”. its user_manual cofusing me a little bit about how to detect its datatype, when output look totaly different then the stuff you can find in its manual.
the mqtt output looks like this:
"txInfo" : {
"frequency" : 868100000,
"dr" : 0
},
"adr" : false,
"fCnt" : 150,
"fPort" : 2,
"data" : "EQAAOwAAAgAAAg==",
"object" : {
"greenCount" : 2,
"orangeCount" : 944,
"payloadType" : 17,
"redCount" : 0
}
}
and EQAAOwAAAgAAAg== decoded to hex = 1100003b000002000002
My solution for this task is the following:
function Decode(fPort, bytes) {
var result = {};
result.payloadType = bytes[0];
result.redCount = (bytes[1] << 4) + bytes[2];
result.orangeCount = (bytes[3] << 4) + bytes[4];
result.greenCount = (bytes[5] << 4) + bytes[6];
result.battery = (bytes[0] & 0x01);
return result;
}
In the manual they wrote about 02 or 03 as 1st byte in the datatype section.
01 should be a keep-alive message with batterystatus, but as you can see in the my hexstring everytime it starts with 11 as 1st byte.
Description taken from its manual:
- 0x00
Frame (02) is sent out at each end of period whatever the counter values.- 0x10
Frame (02) is sent out at each end of period, only if counter values have changed since the last sent frame.- 0x01
Frame (02) is sent out at each push with a delay of ‘tpb” between two pushes.
Maybe you have some ideas, how the decoder could look like to solve my problem.
thanks
Regards
Michael
NU_0011_SmilioAction_USER MANUAL_Book_FW_2_0_1_4.pdf (942.6 KB)