# Skiply Smilio Payload decoder

**URL:** <https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312>\
**Category:** End Devices (Nodes)\
**Created:** [April 20, 2020, 1:55pm UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312 "2020-04-20T13:55:50Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![michaelcee](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/michaelcee/32/25844_2.png) [@michaelcee](https://www.thethingsnetwork.org/forum/u/michaelcee)\
**Post date:** [April 20, 2020, 1:55pm UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312/1 "2020-04-20T13:55:50Z")

</div>

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:

```json
  "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:

```javascript
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](https://www.thethingsnetwork.org/forum/uploads/short-url/iZjBIN6H4kIuvOZFfQICL1ylnFX.pdf) (942.6 KB)

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [April 20, 2020, 4:54pm UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312/2 "2020-04-20T16:54:39Z")

</div>

I’ve formatted your post; please see [How do I format my forum post? [HowTo]](https://www.thethingsnetwork.org/forum/t/how-do-i-format-my-forum-post-howto/8735)

> [@michaelcee](#):
>
> the mqtt output looks like this:
> 
> ```json
> "txInfo" : {
> "frequency" : 868100000,
> "dr" : 0
> },
> 
> ```
> 
> …
> 
> My solution for this task is the following:
> 
> ```javascript
> function Decode(fPort, bytes) {
> 
> ```

Is this even related to The Things Network?

Also, it’s not clear to me what you’re asking. If indeed each uplink starts with `11` then that’s not something you can fix in the decoder, but needs fixing in the device. That is: if you’re sure that `11` is not expected. Maybe you just have the wrong documentation.

> [@michaelcee](#):
>
> ```javascript
> result.redCount = (bytes[1] << 4) + bytes[2];
> 
> ```

Shifting only 4 bytes doesn’t look right. See [Working with Bytes](https://www.thethingsnetwork.org/docs/devices/bytes.html).

> [@michaelcee](#):
>
> ```javascript
> result.payloadType = bytes[0];
> ...
> result.battery = (bytes[0] & 0x01);
> 
> ```

The above doesn’t look right either.

---

<div class="post-metadata">

**Author:** ![jeromeskiply](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/jeromeskiply/32/32659_2.png) [@jeromeskiply](https://www.thethingsnetwork.org/forum/u/jeromeskiply)\
**Post date:** [April 27, 2020, 3:00pm UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312/3 "2020-04-27T15:00:31Z")

</div>

Hi Michael,  
I’m Jerome from Skiply. I will try to help you to make the suitable decoder.  
The first byte gives you the type of payload:  
0x01 = heart bit with battery level  
0x02 = normal mode  
0x03 = normal mode with badge  
0x10 or 0x11 or 0x31 or 0x13 or 0x33 = code mode  
0x04 is the configuration frame sent by the device at each startup.  
So, first you need to know the mode and the frame type to know what the other bytes mean.

When we integrate with TTN, we use this function:

```javascript
function Decoder(bytes, port) {
  var hexPayload = "";
  bytes.forEach(function(byte) {
    hexPayload += ('0' + (byte & 0xFF).toString(16)).slice(-2);
  });
  var decoded = {hex_payload:hexPayload};
  return decoded;
}

```

To convert the payload into an hex payload.

Then you can test the frame type with substring.

Does it help ?

Do not hesitate to ask.

---

<div class="post-metadata">

**Author:** ![jeromeskiply](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/jeromeskiply/32/32659_2.png) [@jeromeskiply](https://www.thethingsnetwork.org/forum/u/jeromeskiply)\
**Post date:** [April 27, 2020, 3:18pm UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312/4 "2020-04-27T15:18:55Z")

</div>

Additionnal info: [https://skiplyfrance.github.io/simulator.html](https://skiplyfrance.github.io/simulator.html) (to understand the difference between the normal, pulse and code mode)

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [April 27, 2020, 4:55pm UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312/5 "2020-04-27T16:55:43Z")

</div>

> [@jeromeskiply](#):
>
> So, first you need to know the mode and the frame type to know what the other bytes mean.

Yes, of course. But where to find the details? Displaying the binary payload in a human-readable hexadecimal representation is not going to help Michael (or better yet: future readers) at all, I’d say? There must be some documentation that explains more than the one that was posted above?

---

<div class="post-metadata">

**Author:** ![jeromeskiply](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/jeromeskiply/32/32659_2.png) [@jeromeskiply](https://www.thethingsnetwork.org/forum/u/jeromeskiply)\
**Post date:** [April 27, 2020, 5:32pm UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312/6 "2020-04-27T17:32:56Z")

</div>

All the details are in the user manual that is attached. As I said, first you should setup the mode you need, then, you have to adapt the decoder according to that. If you need a “generic decoder”, you should test the frame type, and make the requested conditions.

---

<div class="post-metadata">

**Author:** ![jeromeskiply](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/jeromeskiply/32/32659_2.png) [@jeromeskiply](https://www.thethingsnetwork.org/forum/u/jeromeskiply)\
**Post date:** [April 27, 2020, 5:35pm UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312/7 "2020-04-27T17:35:15Z")

</div>

![normal-mode](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/b/d/bdf7a1bea5ef8a84d5d934e59d09d6ee56d9ad12.png)

---

<div class="post-metadata">

**Author:** ![jeromeskiply](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/jeromeskiply/32/32659_2.png) [@jeromeskiply](https://www.thethingsnetwork.org/forum/u/jeromeskiply)\
**Post date:** [April 27, 2020, 5:35pm UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312/8 "2020-04-27T17:35:56Z")

</div>

![code](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/8/3/83ffc9608382a77db05bc2e90a30e019d4b9bb72.png)

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [April 27, 2020, 6:36pm UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312/9 "2020-04-27T18:36:47Z")

</div>

> [@jeromeskiply](#):
>
> 0x10 or 0x11 or 0x31 or 0x13 or 0x33 = code mode

It’s not like I care, as I don’t own the device. But Michael is also saying that 0x11 is not documented. Skimming the documentation I cannot find at least a few of the above either.

---

<div class="post-metadata">

**Author:** ![michaelcee](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/michaelcee/32/25844_2.png) [@michaelcee](https://www.thethingsnetwork.org/forum/u/michaelcee)\
**Post date:** [April 28, 2020, 6:11am UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312/10 "2020-04-28T06:11:59Z")

</div>

Thank you guys for your reply.  
i tried the code jerome provide and got the following result when i press the green button twice:

> },  
> “adr” : false,  
> “fCnt” : 180,  
> “fPort” : 2,  
> “data” : “EQAAAQAAAgAAAg==”,  
> “object” : {  
> “hex\_payload” : “11000001000002000002”  
> }  
> }

> — and here the 2nd time it got pressed:  
> },  
> “adr” : false,  
> “fCnt” : 181,  
> “fPort” : 2,  
> “data” : “EQAAAgAAAgAAAg==”,  
> “object” : {  
> “hex\_payload” : “11000002000002000002”  
> }  
> }

> — one time yellow button got pressed:  
> },  
> “adr” : false,  
> “fCnt” : 182,  
> “fPort” : 2,  
> “data” : “EQAACwAAAgAAAw==”,  
> “object” : {  
> “hex\_payload” : “1100000b000002000003”  
> }

you can see a change in the hex\_payload, but i am still confused about 0x11 as 1st byte instead of 0x03 for example.

The 2nd thing not mentioned before, but found on your faq-page is this entry " Why are you sending states of counters instead of number of buttons pressed ?" I understand that its a saver method not to loose any packages, but it confuse me a little bit when the bytes change and not only its counter.

it could be possible that i misunderstand it and its easier than i thought it was.

if you agree let us go through every byte in the hex\_payload string.  
When i go through the documentation i understand it like this:

```
example here yellow button got pressed more times "hex_payload" : "1100000b000002000003" and here a 2nd time "hex_payload" : "1100000c000003000003"

```

The string consists of 10bytes:  
11 = byte[0] will be the payloadtype  
0000 = byte[1] + byte[2] should be button1 (green in my example)  
0b00 = byte[3] + byte[4] should be button2 (yellow in my example)  
0002 = byte[5] + byte[6] should be button3 (red in my example)  
0000 = byte[7] + byte[8] should be button4 (a not used one,because with have only 3)  
03 = byte[9] what about this byte?

where can i find the batterystatus is this included in byte[9] ?

Would be fine we could could get together to a solution.  
thanks

---

<div class="post-metadata">

**Author:** ![jeromeskiply](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/jeromeskiply/32/32659_2.png) [@jeromeskiply](https://www.thethingsnetwork.org/forum/u/jeromeskiply)\
**Post date:** [May 7, 2020, 7:58pm UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312/11 "2020-05-07T19:58:15Z")

</div>

Sorry I missed your message. 11 means you are in code mode (p. 28 of the manual). In this mode, you have the last sequence pressed, and the previous one, + the time in minutes between the 2.  
So if you press button 1 and button 3, you should receive something like: 1X XX XXXXXX 000013 (I do it from memory).  
If you want to use the normal mode (start with 02 or 03), you should send the corresponding downlink. See: [https://skiplyfrance.github.io/configurator.html](https://skiplyfrance.github.io/configurator.html)

---

<div class="post-metadata">

**Author:** ![jeromeskiply](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/jeromeskiply/32/32659_2.png) [@jeromeskiply](https://www.thethingsnetwork.org/forum/u/jeromeskiply)\
**Post date:** [May 7, 2020, 7:59pm UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312/12 "2020-05-07T19:59:07Z")

</div>

Hi, the page 28 describes the code mode.

---

<div class="post-metadata">

**Author:** ![jeromeskiply](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/jeromeskiply/32/32659_2.png) [@jeromeskiply](https://www.thethingsnetwork.org/forum/u/jeromeskiply)\
**Post date:** [May 7, 2020, 8:01pm UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312/13 "2020-05-07T20:01:30Z")

</div>

I did a demo during the virtual TTN conference (I switched from one mode to an other). I don’t know how to find it, it was during the workshops.

---

<div class="post-metadata">

**Author:** ![Albert7](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/albert7/32/35697_2.png) [@Albert7](https://www.thethingsnetwork.org/forum/u/Albert7)\
**Post date:** [April 9, 2024, 9:34pm UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312/14 "2024-04-09T21:34:46Z")

</div>

Hello, can anyone provide a full example skiply smilio payload formatter please?

---

<div class="post-metadata">

**Author:** ![Albert7](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/albert7/32/35697_2.png) [@Albert7](https://www.thethingsnetwork.org/forum/u/Albert7)\
**Post date:** [April 11, 2024, 4:12pm UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312/15 "2024-04-11T16:12:06Z")

</div>

could you send us the demo url?

---

<div class="post-metadata">

**Author:** ![Albert7](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/albert7/32/35697_2.png) [@Albert7](https://www.thethingsnetwork.org/forum/u/Albert7)\
**Post date:** [April 11, 2024, 4:15pm UTC](https://www.thethingsnetwork.org/forum/t/skiply-smilio-payload-decoder/36312/16 "2024-04-11T16:15:28Z")

</div>

I have a question about the Skiply device, I didn’t send any downlink to enbale any mode, but when I add the device to TTN, it got joined and reporting normally. However, after one day’s testing, when I click the button again, it started flashing the red/green light, it doesn’t report uplink msg anymore and not sure why.
