Problem with note.add request

Hi, I’m trying to use note.add request with the max argument combined with "sync":true in order to automatically trigger a sync when the number of pending notes matches the max value. However, the behavioral i’m obtaining from my NOTE-NBGL is not what i expect. Following you will find the logs i’m getting from my arduino sketch, where you can see that after the number of pending notes is 5 (the value i set tomax argument), instead of trigger a sync and queue the next note in notefile, the result i obtain is that the 6th note (corresponding to "temperature":37) is discarded because the number of notes in notefile is 5, so it is lost, as you can see in notehub events. Is that correct? …

|···Notecard request: {"req":"note.add","file":"rak4631.qo","sync":true,"max":5,"body":{"sensor":"rak4631","temperature":32}}

[INFO] {"req":"note.add","file":"rak4631.qo","sync":true,"max":5,"body":{"sensor":"rak4631","temperature":32},"crc":"000C:1163B8FD"}

[INFO] {"total":1}

|···Notecard request: {"req":"note.add","file":"rak4631.qo","sync":true,"max":5,"body":{"sensor":"rak4631","temperature":33}}

[INFO] {"req":"note.add","file":"rak4631.qo","sync":true,"max":5,"body":{"sensor":"rak4631","temperature":33},"crc":"000D:10A1D2CA"}

[INFO] {"total":2}

|···Notecard request: {"req":"note.add","file":"rak4631.qo","sync":true,"max":5,"body":{"sensor":"rak4631","temperature":34}}

[INFO] {"req":"note.add","file":"rak4631.qo","sync":true,"max":5,"body":{"sensor":"rak4631","temperature":34},"crc":"000E:15EEC44F"}

[INFO] {"total":3}

|···Notecard request: {"req":"note.add","file":"rak4631.qo","sync":true,"max":5,"body":{"sensor":"rak4631","temperature":35}}

[INFO] {"req":"note.add","file":"rak4631.qo","sync":true,"max":5,"body":{"sensor":"rak4631","temperature":35},"crc":"000F:142CAE78"}

[INFO] {"total":4}

|···Notecard request: {"req":"note.add","file":"rak4631.qo","sync":true,"max":5,"body":{"sensor":"rak4631","temperature":36}}

[INFO] {"req":"note.add","file":"rak4631.qo","sync":true,"max":5,"body":{"sensor":"rak4631","temperature":36},"crc":"0010:166A1021"}

[INFO] {"total":5}

|···Notecard request: {"req":"note.add","file":"rak4631.qo","sync":true,"max":5,"body":{"sensor":"rak4631","temperature":37}}

[INFO] {"req":"note.add","file":"rak4631.qo","sync":true,"max":5,"body":{"sensor":"rak4631","temperature":37},"crc":"0011:17A87A16"}

[INFO] {"err":"notefile already contains 5 notes (5 max) {note-max}","crc":"0011:B84959EF"}

|···Notecard request: {"req":"note.add","file":"rak4631.qo","sync":true,"max":5,"body":{"sensor":"rak4631","temperature":38}}

[INFO] {"req":"note.add","file":"rak4631.qo","sync":true,"max":5,"body":{"sensor":"rak4631","temperature":38},"crc":"0012:1CF43D2B"}

[INFO] {"total":1}

Hey @fbt1,

Welcome to the Blues community! And sorry you hit issues here.

One question to start: can you check what version of the Notecard firmware you’re using with a card.version request? The max argument is pretty new (we added it in 8.2.1) so I’m wondering if you maybe the issue is you have an older version and need to upgrade.

I just gave added three Notes on my test Notecard running 9.3.1 and it triggered a sync after the third note.add as expected.

> {"req":"note.add","max":3,"sync":true,"body":{"test":"value"}}
{"total":1}
> {"req":"note.add","max":3,"sync":true,"body":{"test":"value"}}
{"total":2}
> {"req":"note.add","max":3,"sync":true,"body":{"test":"value"}}
{"total":3}

TJ

1 Like

Hi @tjvantoll , thanks a lot for your support. I was using 9.2.3.17324 vesion, but i already updated to 9.3.1.17434 and the behavioral i see is the same, as you can check from the following log messages … the sync is triggered after the 6th note (corresponding in this case to "temperature":33), which is discarded because the number of notes in notefile is 5, so this last note is lost. Can you please let your test run for some additional notes addition?. As additional information, in my particular case, the notecard’s synchronization mode is set to “minimum”. Thanks a lot.

…

|···Notecard request: {“req”:“note.add”,“file”:“rak4631.qo”,“sync”:true,“max”:5,“body”:{“sensor”:“rak4631”,“temperature”:31}}
[INFO] {“req”:“note.add”,“file”:“rak4631.qo”,“sync”:true,“max”:5,“body”:{“sensor”:“rak4631”,“temperature”:31},“crc”:“0035:132506A4”}
[INFO] {“total”:4}
|···Notecard request: {“req”:“note.add”,“file”:“rak4631.qo”,“sync”:true,“max”:5,“body”:{“sensor”:“rak4631”,“temperature”:32}}
[INFO] {“req”:“note.add”,“file”:“rak4631.qo”,“sync”:true,“max”:5,“body”:{“sensor”:“rak4631”,“temperature”:32},“crc”:“0036:1163B8FD”}
[INFO] {“total”:5}
|···Notecard request: {“req”:“note.add”,“file”:“rak4631.qo”,“sync”:true,“max”:5,“body”:{“sensor”:“rak4631”,“temperature”:33}}
[INFO] {“req”:“note.add”,“file”:“rak4631.qo”,“sync”:true,“max”:5,“body”:{“sensor”:“rak4631”,“temperature”:33},“crc”:“0037:10A1D2CA”}
[INFO] {“err”:“notefile already contains 5 notes (5 max) {note-max}”,“crc”:“0037:B84959EF”}


|···Notecard request: {“req”:“note.add”,“file”:“rak4631.qo”,“sync”:true,“max”:5,“body”:{“sensor”:“rak4631”,“temperature”:34}}
[INFO] {“req”:“note.add”,“file”:“rak4631.qo”,“sync”:true,“max”:5,“body”:{“sensor”:“rak4631”,“temperature”:34},“crc”:“0038:15EEC44F”}
[INFO] {“total”:1}

Ok yep I see the problem now. Thanks for following up on this because it’s definitely bug. I’ve reported it internally and we’ll try to get this fixed for our next firmware release.

TJ

2 Likes