Get Snapshot from Synology Surveillance Station

This flow can show, in your dashboard, a snapshot from Synology Surveillance Station. I tested it on DSM 5.2 with Surveillance Station 7.1.

Before the first use you must :

  • change the "HOST" (http://HOST:5000...) in nodes "Login", "URL", "URL 1/2"
  • change ACCOUNT and PASS in node "Login" (...&account=ACCOUNT&passwd=PASS...)

You could adapt this flow to Enable or Disable Camera on Surveillance Station.

For more help on Synology API, use the documentation: https://global.download.synology.com/download/Document/DeveloperGuide/

[{"id":"796803bc.d17ac4","type":"inject","z":"a1cc623b.4cb5d","name":"GetSnapshot","topic":"Snapshot","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"x":90,"y":880,"wires":[["1186ac95.8f6643"]]},{"id":"1186ac95.8f6643","type":"www-request","z":"a1cc623b.4cb5d","name":"Login","method":"GET","ret":"obj","url":"http://HOST:5000/webapi/auth.cgi?api=SYNO.API.Auth&method=Login&version=4&account=ACCOUNT&passwd=PASS&session=SurveillanceStation","tls":"","x":210,"y":920,"wires":[["78fb548f.05d414"]]},{"id":"78fb548f.05d414","type":"change","z":"a1cc623b.4cb5d","name":"URL","rules":[{"t":"set","p":"url","pt":"msg","to":"http://HOST:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Camera&method=GetInfo&version=4&cameraIds=2&_sid=","tot":"str"},{"t":"set","p":"url","pt":"msg","to":"$join($append($string(msg.url), msg.payload.data.sid))","tot":"jsonata"},{"t":"set","p":"_msgid","pt":"msg","to":"payload.data.sid","tot":"msg"},{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"headers","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":960,"wires":[["a06501f3.ed9238"]]},{"id":"a06501f3.ed9238","type":"www-request","z":"a1cc623b.4cb5d","name":"GetInfo","method":"GET","ret":"obj","url":"","tls":"","x":420,"y":1000,"wires":[["9b5f2830.f72bd8"]]},{"id":"9b5f2830.f72bd8","type":"change","z":"a1cc623b.4cb5d","name":"URL 1/2","rules":[{"t":"set","p":"url","pt":"msg","to":"payload.data.cameras.0.snapshot_path","tot":"msg"},{"t":"set","p":"url","pt":"msg","to":"$join($append(\"http://HOST:5000\", msg.url)\t)\t","tot":"jsonata"},{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"headers","pt":"msg"},{"t":"set","p":"temp","pt":"msg","to":"$join($append(\"&_sid=\", msg._msgid)\t)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":1040,"wires":[["7fd9964d.3c92e"]]},{"id":"7fd9964d.3c92e","type":"change","z":"a1cc623b.4cb5d","name":"URL 2/2","rules":[{"t":"set","p":"url","pt":"msg","to":"$join($append(msg.url, msg.temp)\t)\t","tot":"jsonata"},{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"headers","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":1080,"wires":[["a3b880ef.ae185"]]},{"id":"a3b880ef.ae185","type":"ui_template","z":"a1cc623b.4cb5d","group":"1271de05.831cea","name":"Demo","order":0,"width":"0","height":"0","format":"<div ng-init=\"myVar = 'snapshot.jpg'\">\n    <h1>Latest Snapshot</h1>\n    <img ng-src=\"{{msg.url}}\" height=\"216\" width=\"384\">\n</div>","storeOutMessages":true,"fwdInMessages":true,"x":770,"y":1120,"wires":[[]]},{"id":"1e69c869.0f7ba","type":"comment","z":"a1cc623b.4cb5d","name":"ReadMe","info":"Work on Synology DSM 5.2 and\nSurveillance Station 7.1\n\nChange the http://HOST:5000 \nin node \"Login\", \"URL\", \"URL 1/2\"\n\nAnd change ACCOUNT and PASS in node \"Login\"\n...&account=ACCOUNT&passwd=PASS...","x":470,"y":960,"wires":[]},{"id":"1271de05.831cea","type":"ui_group","z":"","name":"Demo","tab":"b81a8d9c.6cc6a","disp":true,"width":"7"},{"id":"b81a8d9c.6cc6a","type":"ui_tab","z":"","name":"Demo","icon":"home","order":"1"}]
AberciF

Flow Info

created 5 months, 1 week ago

Node Types

Core
  • change (x3)
  • comment (x1)
  • inject (x1)
Other
  • ui_group (x1)
  • ui_tab (x1)
  • ui_template (x1)
  • www-request (x2)

Tags

  • synology
  • Surveillance Station
  • img
  • photo
  • dashboard
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option