Pipe-cache-params protocol

Channel with this protocol will consume messages from other channels, store the last values of specified parameters and add them into new messages if missing.
flespi parses the Pipe-cache-params protocol messages into a JSON object with the fields listed below in the Parameters tab.

Partial data in messages is a common pain point in fleet management since it compromises accuracy and timeliness of related operations. Oftentimes, status messages and events from sensors, panic buttons, etc. come without position data. 

Flespi has come up with the solution to fix this inconsistency — you create a pipe-cache-params channel, specify the source channel (or channels) where messages will come from, say which parameters have to be present in each message, and flespi will be filling the gaps as new messages arrive. 

Flespi can complement any parameters (not just position data) that are presupposed in the message provided that at least one previous message from the given device (ident) sent non-empty values for these parameters.

One prerequisite to using the pipe-cache-params channel is having at least one other active channel that receives messages from devices.

Once you have it, create a new channel and pick the pipe-cache-params protocol_id.

Then check the configuration item and populate the Channel IDs, Token (either ACL type with access to the listed channel messages or Standard; avoid using Master token here — it's excessive), and Parameters to cache fields with valid values.

flespi pipe cache params channel create

Pay special attention to the “Generate messages only when ALL listed parameters are cached” toggle — this one can dramatically affect the behavior of the channel. With this option enabled, if the cache is cleared either because it expires or our servers are rebooted or you disable and enable the channel, all listed parameters in it will be lost. Consequently, newly received messages will be discarded until ALL listed parameters are cached again.

Note: the caching of parameters is performed on a per-ident basis, which means that if earlier messages for a given device (ident) contained certain non-empty parameters, the pipe-cache-params channel will be able to inject their values into subsequent messages in place of the missing values.

As you can see on the screenshot below, our Dataflow channel sometimes gets messages with the position data missing:

incoming message with missing parameters

While our Pipe channel has this issue fixed seamlessly:

message with fixed missing parameters

You can specify several channels as sources for the pipe channel. In this way, you need can fix missing values for the same parameters across multiple device types (and manufacturers) since they have common names. 

Note: Avoid having devices with the same ident in different channels — this will corrupt your cache for this ident and will lead to wrong position data being pasted.

channel.id
number
ID of channel that received a message
custom
number
Any custom parameter
device.id
number
ID of device that received a message
device.name
string
Name of device that received a message
device.type.id
number
ID of device type of device that received a message
ident
string
Device unique identifier like serial number, IMEI, etc
peer
string
IP:port from which device connecting to the channel
protocol.id
number
ID of protocol
server.timestamp
number
seconds
Timestamp when server received a message
timestamp
number
seconds
Message timestamp