Flespi devices feature both commands and settings for device management and since the concepts are tightly interwoven, the choice between the two may be confusing. So let us clarify.
Commands include the entirety of all instructions that can be sent to the device (as per the protocol documentation) to change its behavior.
You can send specific commands via the flespi panel interface — on the Commands tab on the device configuration screen:
Most protocols integrated into Flespi support a so-called custom command that accepts arbitrary command text and, as long as the command syntax is correct, the command will be executed on the device.
Here’s how a custom command looks for Queclink devices:
Here’s the commands API to send any command to the device.
Commands field for easy access to the list of the available commands
To make access to the list of available device commands more convenient, we added a new commands device field. This field contains an array with the definitions of all available commands and can be requested via API:
As a result, you will get the list of commands and their schemas available for the device:
More about how to send commands to devices is outlined in a dedicated article.
The setting is a clearly named wrapper around a specific command instruction that also stores the current (latest known) state of the related device configuration feature (aka device shadow). You can use the settings API or the Settings tab on the device configuration screen to send a command to change the corresponding setting value.
Settings represent a subset of commands, so, basically, everything you can send as a setting can also be sent as a corresponding custom command (see examples in the Commands section of the article).
There is a class of action commands/settings (e.g. “reboot”) that might not have the state to store. For such commands triggering the corresponding action via a commands API or settings API is identical. For settings such action items are grouped on the Action tab:
It becomes simply a matter of convenience.
If you don’t see a specific setting but have a protocol specification at hand, the custom command can be your last resort. Or you can ask us to add the settings for you:)
Configuring device settings polling for more control over traffic consumption
Once a new device is connected to Flespi (i.e. establishes a connection with the proper channel), the platform will request the device configuration to know its current state. As a result of synchronization, the Flespi platform gets a complete up-to-date virtual copy of the physical device’s actual state also known as device shadow.
Sometimes when the device attempts to sync all its numerous settings, it triggers substantial cellular traffic consumption. And if you have a fleet of a thousand vehicles equipped with such devices, you get a bloated bill from your connectivity provider.
To put you in control of the above situation, we introduced a new configuration option for the device that allows adjusting the device settings polling interval. You can now do that on the “pencil” tab on the device configuration screen:
The possible polling frequency values to choose from include:
once (default) — query device setting values only once (usually upon connect to the channel)
never — do not request settings from the device. This is useful for reducing device traffic.
daily, weekly, monthly — update the device settings once in the specified period.
Sidenote: another way to optimize expenses is to adjust flespi resource consumption.