From 859cf4905e2f00e1636f62bfd77206c379a13250 Mon Sep 17 00:00:00 2001 From: Mario Stephan Date: Tue, 17 Mar 2015 21:09:50 +0100 Subject: [PATCH] Added an extra check for null for button states --- js/fhem-tablet-ui.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/js/fhem-tablet-ui.js b/js/fhem-tablet-ui.js index f06abd0c..56f4eba5 100755 --- a/js/fhem-tablet-ui.js +++ b/js/fhem-tablet-ui.js @@ -369,15 +369,16 @@ function update(filter) { else if (deviceType == 'switch' || deviceType == 'contact'){ var state = getDeviceValue( $(this), 'get' ); - - if ( state == $(this).data('get-on') ) - $(this).data('famultibutton').setOn(); - else if ( state == $(this).data('get-off') ) - $(this).data('famultibutton').setOff(); - else if ( state.match(RegExp('^' + $(this).data('get-on') + '$')) ) - $(this).data('famultibutton').setOn(); - else if ( state.match(RegExp('^' + $(this).data('get-off') + '$')) ) - $(this).data('famultibutton').setOff(); + if (state) { + if ( state == $(this).data('get-on') ) + $(this).data('famultibutton').setOn(); + else if ( state == $(this).data('get-off') ) + $(this).data('famultibutton').setOff(); + else if ( state.match(RegExp('^' + $(this).data('get-on') + '$')) ) + $(this).data('famultibutton').setOn(); + else if ( state.match(RegExp('^' + $(this).data('get-off') + '$')) ) + $(this).data('famultibutton').setOff(); + } } }); ready = true;