From f2a059080ec75a19e29f5b5bb4aa334a7281afb0 Mon Sep 17 00:00:00 2001 From: jghaanstra Date: Fri, 5 Jan 2018 20:56:37 +0100 Subject: [PATCH] Release 1.2.3 --- APPSTORE.md | 3 +++ app.json | 2 +- lib/util.js | 15 ++++++++++++++- package.json | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/APPSTORE.md b/APPSTORE.md index 18f5634..5b4c725 100644 --- a/APPSTORE.md +++ b/APPSTORE.md @@ -32,6 +32,9 @@ For support please use the official support topic on the forum [here](https://fo - When using multiple IP Webcameras only one global image token is registered and available. This is due to current limitations of Homey core and will hopefully become available in the future. ## Changelog +### 2018-01-05 - v1.2.3 +- FIX: really properly fixed the IP Webcam device going offline if no lux sensor is present + ### 2017-12-29 - v1.2.2 - FIX: properly fixed the IP Webcam device going offline if no lux sensor is present diff --git a/app.json b/app.json index dcb122c..973e190 100644 --- a/app.json +++ b/app.json @@ -9,7 +9,7 @@ "en": [ "ip webcam", "android" ], "nl": [ "ip webcam", "android" ] }, - "version": "1.2.2", + "version": "1.2.3", "compatibility": "1.x >=1.5.0", "author": { "name": "Jelger Haanstra", diff --git a/lib/util.js b/lib/util.js index 8bf25d9..1d04c57 100644 --- a/lib/util.js +++ b/lib/util.js @@ -59,6 +59,7 @@ exports.getIpwebcam = function (address, port, username, password) { if (response.statusCode == 200) { var data = JSON.parse(response.body); + var lux = 0; if(data.motion_active.data[0][1][0] == 1) { var motion = true; @@ -73,7 +74,11 @@ exports.getIpwebcam = function (address, port, username, password) { } if(data.hasOwnProperty("light")) { - var lux = data.light.data[0][1][0]; + if(!isEmpty(data.light.data)) { + var lux = data.light.data[0][1][0]; + } else { + var lux = 0; + } } else { var lux = 0; } @@ -280,3 +285,11 @@ function getDateTime() { return { year: year, month: month, day: day, hour: hour, min: min }; } + +function isEmpty(obj) { + for(var prop in obj) { + if(obj.hasOwnProperty(prop)) + return false; + } + return true; +} diff --git a/package.json b/package.json index 29c2de2..89a7c6f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "android.ipwebcam", - "version": "1.2.2", + "version": "1.2.3", "description": "Homey app for Android IP Webcam", "main": "app.js", "dependencies": {