added help & better output
added help & better output

--- a/onvif/snapshot.html
+++ b/onvif/snapshot.html
@@ -18,7 +18,50 @@
 </script>
 
 <script type="text/x-red" data-help-name="ONVIF Snapshot">
-    <p>Fetches a snapshot from an ip camera</p>
+<h2>Inputs</h2>
+<p>You can wire inject nodes to the input of this node and send the following in <code>msg.payload</code>.</p>
+<table>
+    <thead>
+        <tr>
+            <th>msg.payload</th>
+            <th></th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td><code>url</code></td>
+            <td>IP camera URL</td>
+        </tr>
+        <tr>
+            <td><code>username</code></td>
+            <td>IP camera username</td>
+        </tr>
+        <tr>
+            <td><code>password</code></td>
+            <td>IP camera password</td>
+        </tr>
+    </tbody>
+</table>
+
+<h2>Output</h2>
+<table>
+    <thead>
+        <tr>
+            <th>msg.payload</th>
+            <th></th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td><code>image.base64</code></td>
+            <td>Base64 encoded image</td>
+        </tr>
+        <tr>
+            <td><code>image.binary</code></td>
+            <td>Binary image</td>
+        </tr>
+    </tbody>
+</table>
 </script>
 
 <script type="text/javascript">

--- a/onvif/snapshot.js
+++ b/onvif/snapshot.js
@@ -10,6 +10,9 @@
             try {
                 let _msg = JSON.parse(msg.payload);
                 if (typeof _msg === "object") {
+                    if(_msg.hasOwnProperty("name")) {
+                        msg.name = _msg.name;
+                    }
                     if(_msg.hasOwnProperty("url")) {
                         msg.url = _msg.url;
                     }
@@ -23,7 +26,8 @@
             }
             catch (ex) {}
 
-            config.url = msg.url || config.url;
+            config.name     = msg.name || config.name;
+            config.url      = msg.url || config.url;
             config.username = msg.username || config.username;
             config.password = msg.password || config.password;
 
@@ -55,8 +59,13 @@
         }).then((res) => {
             let prefix = 'data:' + res.headers['content-type'] + ';base64,';
             let base64Image = Buffer.from(res.body, 'binary').toString('base64');
-            msg.payload = prefix + base64Image;
-            msg.binaryImage = res.body;
+            msg.payload = {
+                config: config,
+                image: {
+                    base64: (prefix + base64Image),
+                    binary: res.body
+                }
+            };
             node.send(msg);
         }).catch((error) => {
             msg.payload = null;

comments