Skip to Content

ZONES Command — Geofence Download

Downloads a binary geofence (zones) file to the device over HTTP and manages the loaded slot. The download is asynchronous: the command returns immediately and the final result arrives when it finishes.


What is it for?

🗺️ Main use cases:

  • ⬇️ Provision the device with a geofence set hosted on a server (HTTP GET)
  • 🔄 Update geofences remotely without reconfiguring point by point
  • ⏹️ Cancel an ongoing download if it was launched by mistake or the file changed
  • 🗑️ Delete the geofence slot loaded on the device
  • 🔍 Check whether geofences are loaded, plus their version, CRC and size

The geofence storage module must be enabled on the device. If it is not, SZONES responds RZONES,ERR,mode_off and QZONES responds RZONES,DISABLED.


Commands

OperationSyntaxImmediate response
DownloadSZONES"url"RZONES,START
Cancel downloadSZONESCRZONESC
Delete slotSZONESDRZONESD
Query statusQZONESRZONES,LOADED|EMPTY|DISABLED

Download (SZONES)

The URL must be in quotes. It accepts an optional prefix to force the channel:

PrefixChannel
(no prefix)WiFi with fallback to modem
W:Forces WiFi
M:Forces modem
>SZONES"http://host/zones.bin"< >RZONES,START<

The download runs in a separate task, so the parser stays free to process other commands (e.g. SZONESC to cancel over the same channel). When it finishes, the device emits the final result:

ResultDescription
RZONES,OK,ver=…,crc=0x…,elem=…,size=…Valid download, geofences loaded
RZONES,CANCELEDCanceled by the user (SZONESC)
RZONES,ERR,<reason>Error during download
>SZONES"http://host/zones.bin"< >RZONES,START< // ... download in progress ... >RZONES,OK,ver=3,crc=0x1A2B3C4D,elem=25,size=8192<

Start errors

ResponseCause
RZONES,ERR,mode_offGeofence module not enabled
RZONES,ERR,bad_url_formatURL not properly quoted
RZONES,ERR,busy_or_nomemA download is already running or no memory

Cancel download (SZONESC)

Cancels the ongoing download. It is idempotent: if there is no active download, it does nothing.

>SZONESC< >RZONESC<

On cancel, the partition may be left with partial data; on the next reload the CRC fails and it is not loaded. The next SZONES"…" starts clean.


Delete slot (SZONESD)

Unloads and erases the device geofence slot. It is the clean alias of the legacy SZONES**D command (kept for backward compatibility).

>SZONESD< >RZONESD< >SZONES**D< // legacy equivalent >RZONES**D<

Query status (QZONES)

>QZONES< >RZONES,LOADED,ver=3,crc=0x1A2B3C4D,elem=25,size=8192<
ResponseMeaning
RZONES,LOADED,ver=…,crc=0x…,elem=…,size=…Geofences are loaded
RZONES,EMPTYModule enabled, no geofences loaded
RZONES,DISABLEDGeofence module disabled
FieldDescription
verGeofence file version
crcFile CRC (hexadecimal)
elemNumber of elements (geofences)
sizeFile size in bytes

See Also

Compatibility

💾Firmware:v1.09.21
💾Firmware v1.09.21
SP-IOT
SM-IOT
ZE-IOT
SZONESC / SZONESD from v1.09.21
Last updated