Repository navigation
feat(webui): add eQ-3 keyserver connectivity status #297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
08126e9
1a7e5a2
603688c
c2b95f8
c51f144
846c56e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 "<tr id='sectionUNAVAIL' class='CLASS21202'>" | ||
| append html "<td class='CLASS21207' colspan='3'>" | ||
| append html "\${dialogNewDevicesUNAVAILWarn}" | ||
| append html "</td>" | ||
| append html "</tr>" | ||
| return $html | ||
| } | ||
|
|
||
| proc putSectionBidCosRF {} { | ||
|
|
||
| set html "" | ||
|
|
@@ -190,7 +205,7 @@ proc putSectionHMIP {} { | |
| append html "</tr>" | ||
|
|
||
| append html "<tr>" | ||
| append html "<td class='CLASS21206'><div id='teachCounter_$iFace' class='CLASS21215' style='width:100%;'>\${dialogNewDevicesBidCosRFFetchmodeNotActive}</div></td>" | ||
| append html "<td class='CLASS21206'><div id='teachCounter_$iFace' class='CLASS21215' style='width:100%;'>\${dialogNewDevicesBidCosRFFetchmodeNotActive}</div><span class='keyserver-status' style='display:block; margin-top:5px; text-align:center; background:none; border:0; box-shadow:none;'>\${dialogNewDevicesKeyserverChecking}</span></td>" | ||
| append html "<td>" | ||
| append html [getButton {CLASS21210 colorGradient50px} {buttonPressed(this); hmip_install_mode("HmIP-RF")} \${dialogNewDevicesHmIPAddDeviceBtn}] | ||
| append html "</td>" | ||
|
|
@@ -224,7 +239,7 @@ proc putSectionHMIP {} { | |
| append html "<span>\${lblTeachInKEY}</span>" | ||
| append html "</td>" | ||
| append html "<td>" | ||
| append html "<input id='keyHmIPLocal_$iFace' type='text' style='width:390px'>" | ||
| append html "<input id='keyHmIPLocal_$iFace' type='text' style='width:390px' oninput='let p=this.selectionStart;this.value=this.value.toUpperCase();this.setSelectionRange(p, p);'>" | ||
| append html "</td>" | ||
| append html "</tr>" | ||
|
|
||
|
|
@@ -233,7 +248,7 @@ proc putSectionHMIP {} { | |
| append html "<span>\${lblTeachInSGTIN}</span>" | ||
| append html "</td>" | ||
| append html "<td>" | ||
| append html "<input id='serialHmIPLocal_$iFace' type='text' style='width:390px;'>" | ||
| append html "<input id='serialHmIPLocal_$iFace' type='text' style='width:390px' oninput='let p=this.selectionStart;this.value=this.value.toUpperCase();this.setSelectionRange(p, p);'>" | ||
| append html "</td>" | ||
| append html "</tr>" | ||
|
|
||
|
|
@@ -292,7 +307,7 @@ proc putSectionHMIPWired {} { | |
| append html "</tr>" | ||
|
|
||
| append html "<tr>" | ||
| append html "<td class='CLASS21206'><div id='teachCounter_$iFace' class='CLASS21215' style='width:100%;'>\${dialogNewDevicesBidCosRFFetchmodeNotActive}</div></td>" | ||
| append html "<td class='CLASS21206'><div id='teachCounter_$iFace' class='CLASS21215' style='width:100%;'>\${dialogNewDevicesBidCosRFFetchmodeNotActive}</div><span class='keyserver-status' style='display:block; margin-top:5px; text-align:center; background:none; border:0; box-shadow:none;'>\${dialogNewDevicesKeyserverChecking}</span></td>" | ||
| append html "<td>" | ||
| append html [getButton {CLASS21210 colorGradient50px} {buttonPressed(this); hmip_install_mode("HmIP-Wired")} \${dialogNewDevicesHmIPAddDeviceBtn}] | ||
| append html "</td>" | ||
|
|
@@ -383,6 +398,8 @@ proc action_put_page {} { | |
|
|
||
| puts "<div class='CLASS21200 j_translate'>" | ||
|
|
||
| puts "<style>.keyserver-status.keyserver-reachable { color: green; } .keyserver-status.keyserver-unreachable { color: red; }</style>" | ||
|
|
||
| initJavascript | ||
|
|
||
| puts "<table class='popupTable' border='1' style='table-layout:fixed; width:100%;'>" | ||
|
|
@@ -392,6 +409,10 @@ puts "<div class='CLASS21200 j_translate'>" | |
| puts "<col style='width:462px;'>" | ||
| puts "</colgroup>" | ||
|
|
||
| # Start section UNAVAIL | ||
| puts [putSectionUNAVAIL] | ||
| # End section UNAVAIL | ||
|
|
||
| # Start section BidCos-RF | ||
| puts [putSectionBidCosRF] | ||
| # End section BidCos-RF | ||
|
|
@@ -439,6 +460,29 @@ puts "</div>" | |
| 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 "</div>" | |
| } | ||
| puts { | ||
| OnInbox = function() { | ||
| rf_install_mode(false); | ||
| hmip_install_mode_stop(); | ||
| if (jQuery("body").data("BidCos-RF")) { | ||
| rf_install_mode(false); | ||
|
Comment on lines
+759
to
+760
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| if (jQuery("body").data("HmIP-RF")) { | ||
| hmip_install_mode_stop(); | ||
| } | ||
| PopupClose(); | ||
| WebUI.enter(NewDeviceListPage, {"fromTeachIn":true}); | ||
| } | ||
|
|
@@ -744,6 +792,7 @@ puts "</div>" | |
| } | ||
|
|
||
| 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 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
rg -n -C 2 'dialogNewDevicesUNAVAILWarn|translate\.lang\.extension' wwwRepository: OpenCCU/OpenCCU-Base
Length of output: 911
Add the
dialogNewDevicesUNAVAILWarntranslation.The unavailable-interface row uses
${dialogNewDevicesUNAVAILWarn}atwww/config/cp_add_device.cgi:74. No file underwww/webui/js/langdefines this key, including the German and English dictionaries. The warning text can therefore be missing when no interface is available. Add the key to both supported language dictionaries,translate.lang.jsandtranslate.lang.extension.js.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code originates from the existing OpenCCU rootfs patch
0039-WebUI-Fix-Style-Glitchesand is unrelated to the new keyserver connectivity check.The current PR carries over these existing WebUI adjustments because the CGI file is based on the patched OpenCCU version.
I suggest addressing this finding separately as part of the ongoing rootfs patch migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MichaelN0815 Understood. Given the origin in
0039-WebUI-Fix-Style-Glitches, addressingdialogNewDevicesUNAVAILWarnseparately during the rootfs patch migration is reasonable. I will not request that change as part of the keyserver connectivity feature.The translation concern remains deferred, not confirmed fixed. Would you like me to open a follow-up GitHub issue?
Learnings used
You are interacting with an AI system.