Remote control notecard

Hello,
is it possible to send “hub Requests” commands from the “Notehub API”?
I would like to be able to modify the “hub.set” remotely via the “Notehub API”?
Is it possible?
thanx

Hey @lejibxl some of the hub requests can be called through the Notehub API. See here. Those requests are decorated with a “Notehub” badge.

That said, hub.set is not available via the Notehub API, but depending on what you are trying to accomplish, there might be another path available to you. What attributes specifically are you hoping to modify through the API?

hey bsatrom, thanks for your help
it’s for switch from “continuous” mode to “periodic” mode with a time: “outbound” & “inbound”
(to be able to save battery)

Hey @lejibxl,

You have a few options here.

The easiest option is to use the hub.set request’s vinbound and voutbound arguments. These arguments allow you to set different inbound and outbound values based on the state of the battery. See our documentation on power management for examples.

Those arguments do not allow you to switch between "periodic" and "continuous", but you could set inbound and outbound to very low values when you have sufficient battery, and much high values when you’re low on battery.

If switching between "periodic" and "continuous" is a hard requirement, your next best option is to use the Notecard’s _sync_continuous, _sync_continuous_inbound, _sync_inbound_mins, and _sync_outbound_mins environment variables. (See our documentation on reserved environment variables for details.)

The environment variables allow you to remotely switch your Notecard’s mode, and to change your inbound and outbound values. However, you need to run a {"req":"hub.set","reset":true} request after enabling continuous mode, as the Notecard requires a reset to set up a socket to listen for inbound .qi changes.

So I’d start with vinbound and voutbound, and if those don’t meet your needs try playing with the environment variables, and if those don’t meet your needs let us know and we can try to help :slightly_smiling_face:

TJ

Sorry to hijack this thread, but I have a similar question/situation. Is it possible/what is the best way to setup basic changes to the firmware of the device?

A super simple example is to have a button on our platform that changes the temperature reading from C to F for instance.

Thanks.

Hey @dksmc,

No worries at all. And probably the easiest way you could do this is through an environment variable (see Notecard Walkthrough - Blues Wireless Developers and Understanding Environment Variables - Blues Wireless Developers).

Environment variables can be applied to individual devices, fleets of devices, or all devices in a project. And they’re great for configuration variables that you want to keep in sync between the device and the cloud.

Check out those documentation articles and let us know if that ends up working for you.

TJ