Storage
The Storage component manages the device's local media storage. It supports an SD card or a remote NFS network share, and exposes methods for listing recorded media, deleting files and managing the underlying filesystem.
Storage.Listto list recorded media filesStorage.Deleteto delete a specific media fileStorage.GetStatusto obtain the component's statusStorage.GetConfigto obtain the component's configurationStorage.SetConfigto update the component's configurationStorage.Formatto format the SD cardStorage.Ejectto unmount the SD card safely
Methods
Storage.List
Lists recorded media files stored on the device with pagination support.
Request
Parameters:
| Property | Type | Description |
|---|---|---|
| number | Id of the storage component |
| number | Number of items to skip (for pagination) |
Response
Attributes in the result:
| Property | Type | Description | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| number | Total number of media files available. | |||||||||||||||||||||||||||
| number | The offset that was used to produce this page (echoed from the request). | |||||||||||||||||||||||||||
| number | Storage revision counter. Incremented every time the contents of the storage change (new media added, media deleted, cleanup, etc.). Clients can use it to detect changes between calls. | |||||||||||||||||||||||||||
| array of objects | List of media items.
|
| Value | Description |
|---|---|
| Still image (JPEG). |
| Video file (MP4). |
Storage.Delete
Deletes a specific media file from the storage. Both the media file and its associated thumbnail (if any) are removed.
Request
Parameters:
| Property | Type | Description |
|---|---|---|
| number | Id of the storage component |
| string | Unique identifier of the media file to delete. |
Response
The result from this method is null.
Storage.GetStatus
Obtain the current status of the storage.
Request
Parameters:
| Property | Type | Description |
|---|---|---|
| number | Id of the storage component |
See the status section for the response shape.
Storage.GetConfig
Obtain the storage configuration.
Request
Parameters:
| Property | Type | Description |
|---|---|---|
| number | Id of the storage component |
See the configuration section for the response shape.
Storage.SetConfig
Update the storage configuration. Only the fields included in the request are modified; omitted fields are left unchanged. Setting a field to null resets it to the device default.
If the new configuration changes the active mount, the storage is unmounted and re-mounted automatically; intermediate states are reflected in Storage.GetStatus.
Request
Parameters:
| Property | Type | Description |
|---|---|---|
| number | Id of the storage component |
| object | Configuration to apply (see the configuration section). |
Response
| Property | Type | Description |
|---|---|---|
| boolean |
|
Storage.Format
Erases and reformats the SD card to the expected filesystem. The operation is asynchronous: the call returns once formatting has been started, and progress is reflected in Storage.GetStatus (with errors containing "formatting" while in progress).
This method applies to SD card storage only and requires an SD card to be physically present. It has no effect on network-mounted (NFS) storage.
This operation will permanently delete all data on the SD card.
Request
Parameters:
| Property | Type | Description |
|---|---|---|
| number | Id of the storage component |
Response
The result from this method is null.
Storage.Eject
Unmounts the SD card to allow safe physical removal while the camera is running. Auto-mounting is disabled until the SD card is removed and re-inserted.
For network-mounted (NFS) storage this method is a no-op and returns successfully without unmounting.
Request
Parameters:
| Property | Type | Description |
|---|---|---|
| number | Id of the storage component |
Response
The result from this method is null.
Configuration
The Storage configuration controls the optional NFS network mount target. SD card parameters (device node, mount point, filesystem type) are device-specific and not user-configurable.
When both nfs.host and nfs.path are set, the device mounts the remote NFS share. When NFS is not configured, the local SD card (if present) is used instead.
Properties:
| Property | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| number | Id of the storage component | |||||||||
| string | Name of the storage. | |||||||||
| object | NFS settings. Set to
|
NFS server requirements
The camera firmware runs as UID 1000 / GID 1000, and the NFS client mounts the share as that user. Unlike the SD-card mount, ownership is not overridden on NFS — the server's filesystem permissions apply directly. Make sure the camera can create directories and files under the exported path:
- Either make the entire exported path writable by UID 1000 / GID 1000, or
- Pre-create a
DCIM/directory inside the export and make that directory writable by UID 1000 / GID 1000.
Each camera stores its media under DCIM/<hostname>/, where <hostname> is
the device's hostname (e.g. shellycamera-068df8bc340f). This sub-directory is
created automatically once the parent DCIM/ is writable, so multiple cameras
can safely share a single NFS export.
Typical export configuration on the NFS server (Linux /etc/exports):
/export/shelly 192.168.1.0/24(rw,sync,no_subtree_check,all_squash,anonuid=1000,anongid=1000)
The all_squash + anonuid=1000/anongid=1000 options map every incoming
request to UID/GID 1000 on the server, ensuring the camera always has the
correct identity regardless of the local user numbering on the server.
Alternatively, omit all_squash and simply chown 1000:1000 (or chmod
appropriately) on the export root or its DCIM/ sub-directory.
Status
The status of the Storage component reports the physical state of the storage medium, the available and total capacity, the current revision counter and any active error condition.
Properties:
| Property | Type | Description |
|---|---|---|
| number | Id of the storage component. |
| number | Storage revision counter. Incremented every time the contents of the storage change. |
| boolean |
|
| boolean |
|
| number | Available free space on the storage in bytes. |
| number | Total size of the storage in bytes. |
| array of strings | Optional. List of currently active error/transient conditions. Absent when there are none. See accepted values. |
| Value | Description |
|---|---|
| An SD card is present but its filesystem could not be mounted; the card likely needs to be formatted (see |
| The SD card is currently being mounted. |
| Mounting the NFS share failed. |
| The NFS share is currently being mounted. |
| The NFS share is currently being unmounted (e.g. after a network disconnection). |
| Unmounting the storage failed. |
| DNS resolution of the NFS host is in progress. |
| The storage was mounted successfully but the media database could not be initialized (e.g. directory creation or database open failed). |
| The SD card is currently being formatted. |
| The most recent format operation failed. |
| The SD card has been ejected via |
| Ejecting the SD card via |
Examples
Storage.List example
- Storage.List HTTP GET Request
- Storage.List Curl Request
- Storage.List Mos Request
http://192.168.33.1/rpc/Storage.List?id=0&offset=0
curl -X POST -d '{"id":1,"method":"Storage.List","params":{"id":0,"offset":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call Storage.List '{"id":0,"offset":0}'
Response
- Storage.List HTTP GET Response
- Storage.List Curl Response
- Storage.List Mos Response
{
"offset": 0,
"total": 1,
"rev": 42,
"items": [
{
"media_id": "019abff8-3bfa-7475-af43-89b0a792d705",
"type": "video",
"ts": 1722887000.123,
"duration": 30,
"size": 20800000,
"url": "/storage/019abff8-3bfa-7475-af43-89b0a792d705/<sig>/MOV_20240805_140320.mp4",
"thumbnail_url": "/storage/019abff8-3bfa-7475-af43-89b0a792d705/<sig>/IMG_20240805_140320.jpg",
"trigger": {
"component": "camerazone:200",
"event": "motion_detected",
"ts": 1722887000
}
}
]
}
{
"id": 1,
"src": "shellycamera-068df8bc340f",
"params": {
"offset": 0,
"total": 1,
"rev": 42,
"items": [
{
"media_id": "019abff8-3bfa-7475-af43-89b0a792d705",
"type": "video",
"ts": 1722887000.123,
"duration": 30,
"size": 20800000,
"url": "/storage/019abff8-3bfa-7475-af43-89b0a792d705/<sig>/MOV_20240805_140320.mp4",
"thumbnail_url": "/storage/019abff8-3bfa-7475-af43-89b0a792d705/<sig>/IMG_20240805_140320.jpg",
"trigger": {
"component": "camerazone:200",
"event": "motion_detected",
"ts": 1722887000
}
}
]
}
}
{
"offset": 0,
"total": 1,
"rev": 42,
"items": [
{
"media_id": "019abff8-3bfa-7475-af43-89b0a792d705",
"type": "video",
"ts": 1722887000.123,
"duration": 30,
"size": 20800000,
"url": "/storage/019abff8-3bfa-7475-af43-89b0a792d705/<sig>/MOV_20240805_140320.mp4",
"thumbnail_url": "/storage/019abff8-3bfa-7475-af43-89b0a792d705/<sig>/IMG_20240805_140320.jpg",
"trigger": {
"component": "camerazone:200",
"event": "motion_detected",
"ts": 1722887000
}
}
]
}
Storage.Delete example
- Storage.Delete HTTP GET Request
- Storage.Delete Curl Request
- Storage.Delete Mos Request
http://192.168.33.1/rpc/Storage.Delete?id=0&media_id="019abff8-3bfa-7475-af43-89b0a792d705"
curl -X POST -d '{"id":1,"method":"Storage.Delete","params":{"id":0,"media_id":"019abff8-3bfa-7475-af43-89b0a792d705"}}' http://${SHELLY}/rpc
mos --port ${PORT} call Storage.Delete '{"id":0,"media_id":"019abff8-3bfa-7475-af43-89b0a792d705"}'
Response
- Storage.Delete HTTP GET Response
- Storage.Delete Curl Response
- Storage.Delete Mos Response
null
{
"id": 1,
"src": "shellycamera-068df8bc340f",
"params": null
}
null
Storage.GetStatus example
- Storage.GetStatus HTTP GET Request
- Storage.GetStatus Curl Request
- Storage.GetStatus Mos Request
http://192.168.33.1/rpc/Storage.GetStatus?id=0
curl -X POST -d '{"id":1,"method":"Storage.GetStatus","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call Storage.GetStatus '{"id":0}'
Response
- Storage.GetStatus HTTP GET Response
- Storage.GetStatus Curl Response
- Storage.GetStatus Mos Response
{
"id": 0,
"rev": 42,
"present": true,
"active": false,
"fs_free": 0,
"fs_size": 0,
"errors": [
"needs_formatting"
]
}
{
"id": 1,
"src": "shellycamera-068df8bc340f",
"params": {
"id": 0,
"rev": 42,
"present": true,
"active": false,
"fs_free": 0,
"fs_size": 0,
"errors": [
"needs_formatting"
]
}
}
{
"id": 0,
"rev": 42,
"present": true,
"active": false,
"fs_free": 0,
"fs_size": 0,
"errors": [
"needs_formatting"
]
}
Storage.GetConfig example
- Storage.GetConfig HTTP GET Request
- Storage.GetConfig Curl Request
- Storage.GetConfig Mos Request
http://192.168.33.1/rpc/Storage.GetConfig?id=0
curl -X POST -d '{"id":1,"method":"Storage.GetConfig","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call Storage.GetConfig '{"id":0}'
Response
- Storage.GetConfig HTTP GET Response
- Storage.GetConfig Curl Response
- Storage.GetConfig Mos Response
{
"id": 0,
"name": "SD card",
"nfs": {
"host": "nas.local",
"path": "/export/shelly"
}
}
{
"id": 1,
"src": "shellycamera-068df8bc340f",
"params": {
"id": 0,
"name": "SD card",
"nfs": {
"host": "nas.local",
"path": "/export/shelly"
}
}
}
{
"id": 0,
"name": "SD card",
"nfs": {
"host": "nas.local",
"path": "/export/shelly"
}
}
Storage.SetConfig example
- Storage.SetConfig HTTP GET Request
- Storage.SetConfig Curl Request
- Storage.SetConfig Mos Request
http://192.168.33.1/rpc/Storage.SetConfig?id=0&config={"nfs":{"host":"nas.local","path":"/export/shelly"}}
curl -X POST -d '{"id":1,"method":"Storage.SetConfig","params":{"id":0,"config":{"nfs":{"host":"nas.local","path":"/export/shelly"}}}}' http://${SHELLY}/rpc
mos --port ${PORT} call Storage.SetConfig '{"id":0,"config":{"nfs":{"host":"nas.local","path":"/export/shelly"}}}'
Response
- Storage.SetConfig HTTP GET Response
- Storage.SetConfig Curl Response
- Storage.SetConfig Mos Response
{
"restart_required": false
}
{
"id": 1,
"src": "shellycamera-068df8bc340f",
"params": {
"restart_required": false
}
}
{
"restart_required": false
}
Storage.Format example
- Storage.Format HTTP GET Request
- Storage.Format Curl Request
- Storage.Format Mos Request
http://192.168.33.1/rpc/Storage.Format?id=0
curl -X POST -d '{"id":1,"method":"Storage.Format","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call Storage.Format '{"id":0}'
Response
- Storage.Format HTTP GET Response
- Storage.Format Curl Response
- Storage.Format Mos Response
null
{
"id": 1,
"src": "shellycamera-068df8bc340f",
"params": null
}
null
Storage.Eject example
- Storage.Eject HTTP GET Request
- Storage.Eject Curl Request
- Storage.Eject Mos Request
http://192.168.33.1/rpc/Storage.Eject?id=0
curl -X POST -d '{"id":1,"method":"Storage.Eject","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call Storage.Eject '{"id":0}'
Response
- Storage.Eject HTTP GET Response
- Storage.Eject Curl Response
- Storage.Eject Mos Response
null
{
"id": 1,
"src": "shellycamera-068df8bc340f",
"params": null
}
null