Error while adding notes

I am testing my Notecard + Starnote setup and am getting an error after adding a note:

“error adding note: adding notes to a non-uplinked port is not allowed when in packet mode”

I only get this error while sending “long” Notecard-templated notes, but when sending “short” Starnote templated notes, no such error. Can someone please explain what is going on and how to overcome this error?

Hey @rberkelm,

Could you include the note.template call you’re making that produces this error? You should only see that if you forget to include a port on the template.

Thanks,
TJ

1 Like

Hi TJ,
I had two templates sync’d for my Notecard+Starnote. My “long” template was:
{“req”:“note.template”,“file”:“data.qo”,“delete”:true,“body”:{“weight”:12.1,“bat”:12.1,“soc”:12.1,“temp”:12.1,“offset”:14,“slope”:14.1,“netrawwt”: 14,“key”: “AAAAAAAAAAAAAAAA”}}
My “short” template was:{“req”:“note.template”,“file”:“sat.qo”,“format”:“compact”,“port”:11,“delete”:true,“body”:{“_lat”:14.1,“_lon”:14.1,“_time”:14,“weight”:12.1,“soc”:12.1,“temp”:12.1,“key”:“AAAAAAAAAAAAAAAA”}}
At the time of the error, I had previously added a “long” note and a “short” note, pulled the LTE antenna off the Notecard (leaving the sat antenna connected) and did a hub.sync with card.transport method set to cell-ntn. It took roughly 23 minutes to eventually sync via satellite, so that all went well. I subsequently tried to add another “long” note when I got the error. No error when adding a “short” note. Changing the card.transport mode to “cell” made no difference. The only way to get around the issue was to power cycle the Notecard. Is there a more elegant way?

Hey @rberkelm,

Do you intend to sync both of these Notefiles over satellite or just the “short” one?

Regardless, I would start by adding a port to the data.qo template, as that is the most likely cause of the error.

TJ

Thanks TJ,
I intended just the “short” note to be sync’d but your suggestion re adding a port to the “long” note template is very sage advice - thank you!
Ray

Hi @tjvantoll
I just tried adding a port to my “long” data.qo template but I get an error:

{“err”:“‘port’ is only supported for a ‘format’ of ‘compact’”}

My intent is for this template NOT to be compatible with NTN mode, so not compact.
So the issue with not being able to add “long” notes is very repeatable and occurs after changing card.transport from NTN mode to Cell mode. Any suggestions other than power cycling?

Hi @tjvantoll
In diagnosing this issue, I made a few minor “discoveries”.
Assuming the last note was sync’d over NTN:

  1. After issuing a {“req”:“card.transport”,“method”:“cell”} call, the Notecard will never accept a “long” formatted note. The error is always as stated above.
  2. If the Notecard is then sync’d, the sync is over Cell, as expected. So, the Notecard is not stuck in NTN mode - it just looks that way (to me at least).
  3. If you then send a “long” note, the Notecard will accept the note without a problem, responding with {“template”:true}.
  4. If the last sync was over NTN and the transport mode is then changed to cell, you can issue a hub.sync command immediately followed by a “long” note (i.e. before the sync actually happens) and the note is accepted by the Notecard and is sync’d when the connection occurs. So this is a potential work-around for now.

Hope this helps with the diagnosis?

Slightly unrelated to the error, but related to the NTN notes, I came across another quirk: If you set the card.transport mode to NTN and send two “short” notes followed by a hub.sync command, but then do a power cycle before the sync actually takes place, on the next sync, those two notes appear to actually get sync’d. At least the serial log says so with output like:
“2 notes (0 stable, 0 queued, 2 tombstones)”; and “packet: sending 78 bytes (encoded as 80 bytes on-air)” etc. However, when I check Notehub, there are no new notes listed. So are notes purged on power cycle or are they actually sync’d on next connection anyway (and then hidden from view)? Wonder if you can help me understand this one?

1 Like

Hey @rberkelm,

I’m out this week, but I set a reminder to look into what you found when I’m back.

One quick note on this bit though.

If you set the card.transport mode to NTN and send two “short” notes followed by a hub.sync command, but then do a power cycle before the sync actually takes place, on the next sync, those two notes appear to actually get sync’d.

The Notecard does not support power cycling, and so any weird behavior you find there isn’t something we’re going to support.

TJ

Hey @rberkelm,

Sorry for the delay. I’m back today and managed to recreate your problem. In short, it looks like adding to a non-compact Notefile doesn’t work when in NTN mode (at least until you do a sync over a cellular connection).

I agree this is a bit odd. I’m going to do some asking around internally and get back with you.

TJ

Ok got an answer from the firmware team. There is an allow flag you can add to the card.transport method that allows you to add to a non-compact Notefile while on NTN mode.

I just tried it out myself and it seems to fix this problem.

> {"req":"card.transport","method":"ntn"}
{"method":"ntn"}
> {"req":"hub.sync"}
{}
> {"req":"note.add","file":"data.qo","body":{"weight":1.2,"bat":1.2,"soc":1.2,"temp":1.2,"offset":1234,"slope":1.2,"netrawwt":1234}}
{
 "err": "error adding note: adding notes to a non-uplinked port is not allowed when in packet mode"
}
> {"req":"card.transport","method":"ntn","allow":true}
{"method":"ntn"}
> {"req":"note.add","file":"data.qo","body":{"weight":1.2,"bat":1.2,"soc":1.2,"temp":1.2,"offset":1234,"slope":1.2,"netrawwt":1234}}
{"template":true}

I’m going to work on updating the documentation. Thanks for taking the time to write up this issue!

TJ

1 Like

Hi @tjvantoll
Thanks for getting back to this issue. Actually, I think the problem was getting Notes rejected when requesting card.transport , method: “cell” after having previously been “ntn” (not the other way around). Can you try it this way as well?
Thanks
Ray

1 Like

@rberkelm I just gave it another go and tried in both directions—adding short Notes while having previously been in “cell”, and adding long Notes while having previously been in “ntn”—and both worked with fine with {"req":"card.transport","allow":true}.

If you’re still hitting any errors let me know and I’ll try to recreate. There are quite a few permutations with this unfortunately :sweat_smile:

TJ

1 Like