mirror of
https://github.com/mtan93/homebridge.git
synced 2026-05-10 22:06:48 +01:00
catch undefined values in reading2homekit
This commit is contained in:
+6
-4
@@ -687,6 +687,9 @@ FHEM_dim_values = [ 'dim06%', 'dim12%', 'dim18%', 'dim25%', 'dim31%', 'dim37%',
|
|||||||
|
|
||||||
FHEMAccessory.prototype = {
|
FHEMAccessory.prototype = {
|
||||||
reading2homekit: function(reading,value) {
|
reading2homekit: function(reading,value) {
|
||||||
|
if( value == undefined )
|
||||||
|
return undefined;
|
||||||
|
|
||||||
if( reading == 'hue' ) {
|
if( reading == 'hue' ) {
|
||||||
value = Math.round(value * 360 / this.mappings.hue ? this.mappings.hue.max : 360);
|
value = Math.round(value * 360 / this.mappings.hue ? this.mappings.hue.max : 360);
|
||||||
|
|
||||||
@@ -735,14 +738,13 @@ FHEMAccessory.prototype = {
|
|||||||
value = 0;
|
value = 0;
|
||||||
|
|
||||||
} else if( reading == 'lock' ) {
|
} else if( reading == 'lock' ) {
|
||||||
if( value.match( /^locked/ ) )
|
if( value.match( /uncertain/ ) )
|
||||||
|
value = 4;
|
||||||
|
else if( value.match( /^locked/ ) )
|
||||||
value = 1;
|
value = 1;
|
||||||
else
|
else
|
||||||
value = 0;
|
value = 0;
|
||||||
|
|
||||||
if( value.match( /uncertain/ ) )
|
|
||||||
value = 4;
|
|
||||||
|
|
||||||
} else if( reading == 'temperature'
|
} else if( reading == 'temperature'
|
||||||
|| reading == 'measured-temp'
|
|| reading == 'measured-temp'
|
||||||
|| reading == 'desired-temp'
|
|| reading == 'desired-temp'
|
||||||
|
|||||||
Reference in New Issue
Block a user