From 4954eba0a873b3c104b71f85ace08173e6671a77 Mon Sep 17 00:00:00 2001 From: Christian Fenzl Date: Sun, 14 Nov 2021 17:59:52 +0100 Subject: [PATCH] settings_loxone.js: No not re-enable "Default" output on On-Off-On Fixes #31 --- webfrontend/htmlauth/js/settings_loxone.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/webfrontend/htmlauth/js/settings_loxone.js b/webfrontend/htmlauth/js/settings_loxone.js index 307e4e7..8cef3f7 100644 --- a/webfrontend/htmlauth/js/settings_loxone.js +++ b/webfrontend/htmlauth/js/settings_loxone.js @@ -71,7 +71,8 @@ $(function() { uid = $(target).closest('table').data("uid"); msno = $(target).closest('table').data("msno"); var control = controls.find( obj => { return obj.UID === uid && obj.msno == msno }) - + var stat = statsconfigLoxone.find(obj => { + return obj.uuid === control.UID && obj.msno == control.msno }) // Validations and changes of dependent inputs if( target.id == "LoxoneDetails_s4lmeasurementname" ) { @@ -93,7 +94,12 @@ $(function() { // Activate interval field $("#LoxoneDetails_s4lstatinterval").prop( "disabled", false ).textinput("refresh"); $('[name="LoxoneDetails_s4loutput"]').prop( "disabled", false ); - $('[name="LoxoneDetails_s4loutput"][value="Default"').prop( "checked", true ); + + // Enable "Default" setting only when nothing else is activated + if( !stat ) { + // This element does not exist in stats.json yet, therefore enable "Default" on activation + $('[name="LoxoneDetails_s4loutput"][value="Default"').prop( "checked", true ); + } } else { // Disable interval field and outputs