diff --git a/www/config/cp_add_device.cgi b/www/config/cp_add_device.cgi index 082113daa..afe05b618 100755 --- a/www/config/cp_add_device.cgi +++ b/www/config/cp_add_device.cgi @@ -20,6 +20,9 @@ if { [info exists EQ3_SERVICE_HS485D_PORT] } { } set HS485D_URL "bin://127.0.0.1:$portnumber" +set KEYSERVER_HOST "secgtw.homematic.com" +set KEYSERVER_PORT 8443 + proc getButton {class onclick title} { set html "" @@ -46,12 +49,14 @@ proc initJavascript {} { var thisSection = jQuery("body").data(section); if(thisSection) { jQuery('#section'+section).show(); + jQuery('#sectionUNAVAIL').hide(); } else { if (typeof thisSection == "undefined") { homematic('Interface.isPresent', {"interface": section}, function(result, error) { if (result == true) { jQuery('#section'+section).show(); + jQuery('#sectionUNAVAIL').hide(); dlgPopup.readaptSize(); } }); @@ -62,6 +67,16 @@ proc initJavascript {} { } } +proc putSectionUNAVAIL {} { + set html "" + append html "" + append html "" + append html "\${dialogNewDevicesUNAVAILWarn}" + append html "" + append html "" + return $html +} + proc putSectionBidCosRF {} { set html "" @@ -190,7 +205,7 @@ proc putSectionHMIP {} { append html "" append html "" - append html "
\${dialogNewDevicesBidCosRFFetchmodeNotActive}
" + append html "
\${dialogNewDevicesBidCosRFFetchmodeNotActive}
\${dialogNewDevicesKeyserverChecking}" append html "" append html [getButton {CLASS21210 colorGradient50px} {buttonPressed(this); hmip_install_mode("HmIP-RF")} \${dialogNewDevicesHmIPAddDeviceBtn}] append html "" @@ -224,7 +239,7 @@ proc putSectionHMIP {} { append html "\${lblTeachInKEY}" append html "" append html "" - append html "" + append html "" append html "" append html "" @@ -233,7 +248,7 @@ proc putSectionHMIP {} { append html "\${lblTeachInSGTIN}" append html "" append html "" - append html "" + append html "" append html "" append html "" @@ -292,7 +307,7 @@ proc putSectionHMIPWired {} { append html "" append html "" - append html "
\${dialogNewDevicesBidCosRFFetchmodeNotActive}
" + append html "
\${dialogNewDevicesBidCosRFFetchmodeNotActive}
\${dialogNewDevicesKeyserverChecking}" append html "" append html [getButton {CLASS21210 colorGradient50px} {buttonPressed(this); hmip_install_mode("HmIP-Wired")} \${dialogNewDevicesHmIPAddDeviceBtn}] append html "" @@ -383,6 +398,8 @@ proc action_put_page {} { puts "
" + puts "" + initJavascript puts "" @@ -392,6 +409,10 @@ puts "
" puts "
" puts "" + # Start section UNAVAIL + puts [putSectionUNAVAIL] + # End section UNAVAIL + # Start section BidCos-RF puts [putSectionBidCosRF] # End section BidCos-RF @@ -439,6 +460,29 @@ puts "" puts "var url = \"$env(SCRIPT_NAME)?sid=\" + SessionId;" puts "var installTimerHmIP = 0;" puts { + checkKeyserver = function() { + var statusElements = jQuery(".keyserver-status"); + new Ajax.Request(url, { + method: "post", + postBody: "action=check_keyserver", + onSuccess: function(transport) { + var result = transport.responseText.trim(); + var key = result === "reachable" ? "dialogNewDevicesKeyserverReachable" : + result === "unreachable" ? "dialogNewDevicesKeyserverUnreachable" : + "dialogNewDevicesKeyserverCheckFailed"; + statusElements + .removeClass("keyserver-reachable keyserver-unreachable") + .addClass(result === "reachable" ? "keyserver-reachable" : + result === "unreachable" ? "keyserver-unreachable" : "") + .text(translateKey(key) || key); + }, + onFailure: function() { + statusElements + .removeClass("keyserver-reachable keyserver-unreachable") + .text(translateKey("dialogNewDevicesKeyserverCheckFailed") || "dialogNewDevicesKeyserverCheckFailed"); + } + }); + }; update_new_device_count = function() { var pb = "action=get_new_device_count"; var opts = { @@ -712,8 +756,12 @@ puts "" } puts { OnInbox = function() { - rf_install_mode(false); - hmip_install_mode_stop(); + if (jQuery("body").data("BidCos-RF")) { + rf_install_mode(false); + } + if (jQuery("body").data("HmIP-RF")) { + hmip_install_mode_stop(); + } PopupClose(); WebUI.enter(NewDeviceListPage, {"fromTeachIn":true}); } @@ -744,6 +792,7 @@ puts "" } puts "translatePage('#messagebox');" + puts "checkKeyserver();" puts "dlgPopup.readaptSize();" } @@ -961,6 +1010,15 @@ proc action_get_new_device_count {} { puts [get_new_device_count] } +proc action_check_keyserver {} { + global KEYSERVER_HOST KEYSERVER_PORT + if {[catch {exec nc -z -w 3 $KEYSERVER_HOST $KEYSERVER_PORT}]} { + puts "unreachable" + } else { + puts "reachable" + } +} + cgi_eval { #cgi_debug -on cgi_input diff --git a/www/webui/js/lang/de/translate.lang.js b/www/webui/js/lang/de/translate.lang.js index 1cdcec782..e73ba3067 100755 --- a/www/webui/js/lang/de/translate.lang.js +++ b/www/webui/js/lang/de/translate.lang.js @@ -739,6 +739,10 @@ jQuery.extend(true,langJSON, { "dialogNewDevicesErrorSecKeyLbl1g" : "Sicherheitsschl%FCssel:", "dialogNewDevicesBtnSetKeyAndTryAgain" : "Schl%FCssel setzen und erneut versuchen", "dialogNewDevicesLblAllDevicesConfigured" : "Alle Ger%E4te konfiguriert", + "dialogNewDevicesKeyserverChecking" : "eQ-3-Keyserver: Erreichbarkeit wird gepr%FCft ...", + "dialogNewDevicesKeyserverReachable" : "eQ-3-Keyserver: Erreichbar", + "dialogNewDevicesKeyserverUnreachable" : "eQ-3-Keyserver: Nicht erreichbar", + "dialogNewDevicesKeyserverCheckFailed" : "eQ-3-Keyserver: Pr%FCfung fehlgeschlagen", "commentDialogNewDevicesEnd" : "***********************************************", "commentDialogHelp" : "***********************************************", "homepage" : "Homepage", diff --git a/www/webui/js/lang/en/translate.lang.js b/www/webui/js/lang/en/translate.lang.js index 8093226f8..c4a670c36 100755 --- a/www/webui/js/lang/en/translate.lang.js +++ b/www/webui/js/lang/en/translate.lang.js @@ -758,6 +758,11 @@ jQuery.extend(true,langJSON, { "dialogNewDevicesBtnSetKeyAndTryAgain" : "Set security key and try again", "dialogNewDevicesLblAllDevicesConfigured" : "All devices configured", + + "dialogNewDevicesKeyserverChecking" : "eQ-3 key server: Checking connectivity ...", + "dialogNewDevicesKeyserverReachable" : "eQ-3 key server: Reachable", + "dialogNewDevicesKeyserverUnreachable" : "eQ-3 key server: Not reachable", + "dialogNewDevicesKeyserverCheckFailed" : "eQ-3 key server: Check failed", "commentDialogNewDevicesEnd" : "***********************************************",