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
TJ