-
Notifications
You must be signed in to change notification settings - Fork 48
Web services description
There are web services useful for many functions. The default format is JSON (or JPG for images).
- Snapshot
- Record
- Privacy
- Motion events management
- Configuration
- Maintenance
- Service start and stop
- PTZ
http://IP:PORT/cgi-bin/snapshot.sh?file=FILE
FILE: name of the file you want to save in /mnt/mmc/sonoff-hack/www/alarm_record/ (default returns image/jpeg)
http://IP:PORT/cgi-bin/record.sh?name=NAME
Start recording of a short video: about 40 seconds starting 5 seconds in the past.
Returns the path of the file.
http://IP:PORT/cgi-bin/privacy.sh?value=VALUE
VALUE: on, off or status Set privacy on or off, or get the status. Privacy "on" means rtsp and snapshot disabled, privacy "off" means rtsp and snapshot enabled.
http://IP:PORT/cgi-bin/eventsdir.sh
List of directories containing registered mp4 files.
http://IP:PORT/cgi-bin/eventsfile.sh?dirname=20200101/10
List of mp4 files contained in a specific directory.
http://IP:PORT/cgi-bin/eventsdirdel.sh?dir=all
Remove all directories (containing registered mp4 files).
http://IP:PORT/cgi-bin/eventsdirdel.sh?dir=20200101/10
Remove directory /mnt/mmc/alarm_record/20200101/10 (directory containing registered mp4 files).
http://IP:PORT/cgi-bin/eventsfiledel.sh?file=20200101/10/ARC20200101100320.mp4
Remove file /mnt/mmc/alarm_record/20200101/10/ARC20200101100320.mp4
http://IP:PORT/cgi-bin/getlastrecordedvideo.sh
Use. Available variables:
"oldness" variable. Defines which video to retrieve..
-
"0" (default) or "1" means latest already available.
-
greater than "0" specifies the oldness, so "3" means the third oldest video. Only looks into the current hour folder. So if value is greater than the videos in the latest hour folder, the last one will be sent.
"type" variable. Defines what to retrieve.
-
"1" (default). Gets relative name in the format of DIR/VIDEO.mp4
-
"2". Gets full URL video.
-
"3". Gets the video itself as video/mp4 inline.
-
"4". Gets the video itself as video/mp4 attachment.
Examples of use:
http://IP:PORT/cgi-bin/getlastrecordedvideo.sh?oldness=0&type=4 -- Send the last video as an attachment.
http://IP:PORT/cgi-bin/getlastrecordedvideo.sh?oldness=0&type=3 -- Show the last video inline in the browser.
http://IP:PORT/cgi-bin/getlastrecordedvideo.sh?type=1 -- Send the relative route of the last available video.
http://IP:PORT/cgi-bin/getlastrecordedvideo.sh?oldness=2&type=2 -- Send the URL of the second to last available video.
http://IP:PORT/cgi-bin/get_configs.sh?conf=CONF
CONF | action |
---|---|
system | Get system configuration |
mqtt | Get mqtt configuration |
http://IP:PORT/cgi-bin/set_configs.sh?conf=CONF
CONF | action |
---|---|
system | Update system configuration |
mqtt | Update mqtt configuration |
Need POST mehod with a json file.
http://IP:PORT/cgi-bin/status.json
http://IP:PORT/cgi-bin/hostname.js
http://IP:PORT/cgi-bin/load.sh
Load configuration file (it requires post method).
http://IP:PORT/cgi-bin/save.sh
Save configuration to a file.
http://IP:PORT/cgi-bin/fw_upgrade.sh?get=info
Get upgrade info.
http://IP:PORT/cgi-bin/fw_upgrade.sh?get=upgrade
Start upgrade procedure.
http://IP:PORT/cgi-bin/reboot.sh
http://IP:PORT/cgi-bin/service.sh?name=NAME&action=ACTION¶m1=PARAM1¶m2=PARAM2
name | action | param1 | param2 | description |
---|---|---|---|---|
rtsp | start/stop/status | N/A | N/A | start and stop sonoff rtspd daemon |
onvif | start/stop/status | low/high/both | N/A | onvif: use param1 to set resolution |
wsdd | start/stop/status | N/A | N/A | onvif web service discovery |
ftpd | start/stop/status | busybox/pure-ftpd | N/A | ftpd: use param1 to set which daemon use |
mqtt | start/stop/status | N/A | N/A | mqtt to send motion events to a broker |
all | start/stop/status | N/A | N/A | all above services |
http://IP:PORT/cgi-bin/ptz.sh?dir=DIRECTION
DIRECTION=left, right, up or down (required option).
http://IP:PORT/cgi-bin/preset.sh?action=ACTION&num=NUMBER&name=NAME
action | num | name |
---|---|---|
go_preset | 0-14 | N/A |
set_preset | 0-9 | preset name |