Accessing env variables from Routes

Hi all,

I am wondering whether is it possible to access an environmental variable (let’s say a default one I set on the device) from Routes, but not from _env.dbs. My scenario is the following: I am recording GPS position data in a Notefile that is then being parsed by JSONata and sent via generic HTTP/HTTPS Route. And I wonder whether any of these two options is possible:

  • accessing ENV variable related to the device at the Routes level, but not from _env.dbs (i am only routing _motion.qo Notefiles)
  • appending ENV variable to the body of a message sent by the device in the card.location.mode = periodic so that it will be explicitly seen in the JSON and could be parsed later on

Best!

Hi @m2m and welcome to the Blues Wireless community!

What you’re asking for makes a lot of sense. Currently, when using the card.location.track API, you don’t have the ability to customize the note like you do when manually crafting the body of a note and using the note.add API.

There is a way to append environment variables to the _session.qo notefile, by adding a $ prefix to the name of the variable. However, these are not routable (yet) either.

Regardless, I’m going to create a feature request for our engineering team to see how we can best address this in the future.

Thanks,
Rob

I should clarify too, that if you are using a host MCU with your tracker, you can customize your notefiles by following our guide here.

Dear @RobLauer ,

Thanks for your answer on that. Yes, I think that routing env variables would be a very helpful thing, so I keep fingers crossed for providing the access to ENV variables in the routing mechanism.

Hover, I wanted to ask about one thing regarding host MCU vs standalone mode. Am I assuming correctly that the notecard has some template for location tracking embedded and non-modifiable? Or maybe is there an option to create a second template with very similar configuration to the one that generates _motion.q - but would it require host MCU or issuing a number of commands to notecard will be just fine? The reason why I ask is that I do not quite understand what are the capabilities of sole/standalone notecard in terms of defining templates. Simply speaking: is it possible to hand-craft a template for notecards and send it to notecard in order to have notes periodically generated and sent to notehub?

If that would be possible, I’d be more or less fine, but when for customized notes host MCU is required, this will raise the issues of extensive power consumption and accessing ENV variables during routing could be of some help here in order to not to have MCU embedded.

Best!

Hey @m2m,

Sorry for the delay in getting back to you. So you are correct in assuming that asset trackers without a host MCU/SBC can only use a static “template” for sending data (what you see described in the motion.qo notefile). For customized scenarios you’d have to add an MCU.

Great feature request though that I’ll be forwarding to the team again.

Thanks,
Rob