From 56ea7d7ee7f4f4184dad2d77d10adc102b6a4e64 Mon Sep 17 00:00:00 2001 From: Tom Hirschberger Date: Sat, 2 May 2020 20:46:38 +0200 Subject: [PATCH] fixed image not updating if connection to ds or cam is lost; fixed cam sizes if cams with and without positions are mixed --- MMM-SynologySurveillance.js | 13 ++++++++++--- node_helper.js | 16 +++++++++++++--- package.json | 2 +- synology-surveillance_h.css | 1 + synology-surveillance_v.css | 1 + 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/MMM-SynologySurveillance.js b/MMM-SynologySurveillance.js index fa3145d..d1fa32d 100644 --- a/MMM-SynologySurveillance.js +++ b/MMM-SynologySurveillance.js @@ -489,10 +489,17 @@ Module.register('MMM-SynologySurveillance', { if(typeof this.dsStreamInfo[payload.dsIdx] !== "undefined") { var updated = false for(var curKey in Object.keys(this.dsStreamInfo[payload.dsIdx])){ - if(this.dsStreamInfo[payload.dsIdx][curKey] !== payload.camStreams[curKey]){ - this.dsStreamInfo[payload.dsIdx] = payload.camStreams - this.updateDom(this.config.animationSpeed) + if(typeof payload.camStreams[curKey] !== "undefined"){ + if(this.dsStreamInfo[payload.dsIdx][curKey] !== payload.camStreams[curKey]){ + this.dsStreamInfo[payload.dsIdx] = payload.camStreams + this.updateDom(this.config.animationSpeed) + console.log("URL of cam: "+curKey+" changed. Updating view!") + updated = true + break + } + } else { console.log("URL of cam: "+curKey+" changed. Updating view!") + this.dsStreamInfo[payload.dsIdx] = {} updated = true break } diff --git a/node_helper.js b/node_helper.js index 9acaf0a..815b3a8 100644 --- a/node_helper.js +++ b/node_helper.js @@ -122,17 +122,27 @@ module.exports = NodeHelper.create({ self.urlUpdateInProgress = false self.sendSocketNotification("DS_STREAM_INFO",curPayload) + } else { + self.sendSocketNotification("DS_STREAM_INFO",{ + dsIdx: curDsIdx, + camStreams: {}, + }) } - // else { - // console.log(JSON.stringify(liveViewError)) - // } }); } else { console.log("Could not find any valid cam for ds with idx: "+curDsIdx) + self.sendSocketNotification("DS_STREAM_INFO",{ + dsIdx: curDsIdx, + camStreams: {}, + }) } } else if (error){ console.log("Problem during fetch of cams of ds with idx: "+curDsIdx) console.log(JSON.stringify(error, null, 2)) + self.sendSocketNotification("DS_STREAM_INFO",{ + dsIdx: curDsIdx, + camStreams: {}, + }) } }) } diff --git a/package.json b/package.json index 6ef687b..4f80462 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "MMM-SynologySurveillance", - "version": "0.0.4", + "version": "0.0.5", "description": "", "main": "MMM-SynologySurveillance.js", "dependencies": { diff --git a/synology-surveillance_h.css b/synology-surveillance_h.css index a85f2e5..697705e 100644 --- a/synology-surveillance_h.css +++ b/synology-surveillance_h.css @@ -30,6 +30,7 @@ } .innerPositionWrapper { + min-height: calc(var(--position-size) + 20px); justify-content: center; align-items: center; display: flex; diff --git a/synology-surveillance_v.css b/synology-surveillance_v.css index 019c77a..87d881a 100644 --- a/synology-surveillance_v.css +++ b/synology-surveillance_v.css @@ -35,6 +35,7 @@ } .innerPositionWrapper { + min-height: calc(var(--position-size) + 10px); justify-content: center; align-items: center; display: flex;