node-red-contrib-hik-media-buffer 1.1.85 → 1.1.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/hik-media-buffer.js +14 -1
- package/package.json +1 -1
package/hik-media-buffer.js
CHANGED
|
@@ -30,7 +30,20 @@ module.exports = function(RED) {
|
|
|
30
30
|
|
|
31
31
|
node.status({fill:"grey", shape:"ring", text:"Inizializzazione..."});
|
|
32
32
|
|
|
33
|
-
function toHikDate(d) {
|
|
33
|
+
function toHikDate(d) {
|
|
34
|
+
const pad = (num) => String(num).padStart(2, '0');
|
|
35
|
+
|
|
36
|
+
// Estraiamo i componenti dell'ora LOCALE della macchina su cui gira Node-RED
|
|
37
|
+
const year = d.getFullYear();
|
|
38
|
+
const month = pad(d.getMonth() + 1);
|
|
39
|
+
const day = pad(d.getDate());
|
|
40
|
+
const hours = pad(d.getHours());
|
|
41
|
+
const minutes = pad(d.getMinutes());
|
|
42
|
+
const seconds = pad(d.getSeconds());
|
|
43
|
+
|
|
44
|
+
// Formato finale richiesto dagli NVR Hikvision: YYYY-MM-DDTHH:mm:ss (SENZA "Z" E SENZA OFFSET!)
|
|
45
|
+
return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;
|
|
46
|
+
}
|
|
34
47
|
|
|
35
48
|
// Manteniamo AxiosDigest solo per lo stream degli allarmi e lo stato dei canali (dove va da dio)
|
|
36
49
|
const nvrAuthAxios = new AxiosDigestAuth({ username: node.user, password: node.pass });
|