Skip to content

Commit f6b79b1

Browse files
committed
Add missing bridge-id handling in wizard
1 parent 7a99af1 commit f6b79b1

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

assets/webconfig/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,7 @@
11801180
"wiz_cololight_title": "Cololight Wizard",
11811181
"wiz_guideyou": "The $1 will guide you through the settings. Just press the button!",
11821182
"wiz_hue_blinkblue": "Let it light up",
1183+
"wiz_hue_bridge": "Bridge",
11831184
"wiz_hue_clientkey": "Clientkey",
11841185
"wiz_hue_create_user": "Create new User",
11851186
"wiz_hue_desc1": "1. Hyperion searches automatically for a Hue-Bridge, in case it cannot find one you need to provide the hostname or IP-address and push the reload button. <br> 2. Provide a user ID, if you do not have one create a new one.",

assets/webconfig/js/wizards/LedDevice_philipshue.js

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,11 @@ const philipshueWizard = (() => {
457457
else {
458458
$('#port').val('');
459459
}
460-
hueIPs.push({ host, port });
460+
461+
const bridgeid = utils.eV("bridgeid");
462+
$('#bridgeid').val(bridgeid);
463+
464+
hueIPs.push({ host, port, bridgeid });
461465

462466
if (usr != "") {
463467
checkHueBridge(checkUserResult, usr);
@@ -467,17 +471,20 @@ const philipshueWizard = (() => {
467471
}
468472

469473
$('#retry_bridge').off().on('click', function () {
474+
470475
const host = $('#host').val();
471476
const port = parseInt($('#port').val());
477+
const bridgeid = $('#bridgeid').val();
472478

473479
if (host != "") {
474-
475-
const idx = hueIPs.findIndex(item => item.host === host && item.port === port);
480+
const idx = hueIPs.findIndex(item => item.host === host);
476481
if (idx === -1) {
477-
hueIPs.push({ host: host, port: port });
482+
hueIPs.push({ host, port, bridgeid });
478483
hueIPsinc = hueIPs.length - 1;
479484
} else {
480485
hueIPsinc = idx;
486+
hueIPs[hueIPsinc].port = port;
487+
hueIPs[hueIPsinc].bridgeid = bridgeid;
481488
}
482489
}
483490
else {
@@ -649,8 +656,9 @@ const philipshueWizard = (() => {
649656
function createHueUser() {
650657
const host = hueIPs[hueIPsinc].host;
651658
const port = hueIPs[hueIPsinc].port;
659+
const bridgeid = hueIPs[hueIPsinc].bridgeid;
652660

653-
let params = { host: host };
661+
let params = { host, bridgeid };
654662
if (port !== 'undefined') {
655663
params.port = parseInt(port);
656664
}
@@ -690,6 +698,7 @@ const philipshueWizard = (() => {
690698
conf_editor.getEditor("root.specificOptions.username").setValue(username);
691699
conf_editor.getEditor("root.specificOptions.host").setValue(host);
692700
conf_editor.getEditor("root.specificOptions.port").setValue(port);
701+
conf_editor.getEditor("root.specificOptions.bridgeid").setValue(bridgeid);
693702
}
694703

695704
if (isEntertainmentReady) {
@@ -926,25 +935,36 @@ const philipshueWizard = (() => {
926935
$('#wizp2_body').html('<div id="wh_topcontainer"></div>');
927936

928937
let topContainer_html = '<p class="text-left" style="font-weight:bold">' + $.i18n(hue_desc1) + '</p>' +
929-
'<div class="row">' +
938+
'<div class="row" style="display: flex; align-items: center; margin-bottom: 10px;">' +
930939
'<div class="col-md-2">' +
931-
' <p class="text-left">' + $.i18n('wiz_hue_ip') + '</p></div>' +
940+
' <p class="text-left" style="margin:0;">' + $.i18n('wiz_hue_bridge') + '</p></div>' +
932941
' <div class="col-md-7"><div class="input-group">' +
933942
' <span class="input-group-addon" id="retry_bridge" style="cursor:pointer"><i class="fa fa-refresh"></i></span>' +
934943
' <select id="hue_bridge_select" class="hue_bridge_sel_watch form-control">' + '</select>' + '</div></div>' +
935-
' <div class="col-md-7"><div class="input-group">' +
936-
' <span class="input-group-addon"><i class="fa fa-arrow-right"></i></span>' +
937-
' <input type="text" class="input-group form-control" id="host" placeholder="' + $.i18n('wiz_hue_ip') + '"></div></div>';
944+
'</div>';
945+
946+
if (storedAccess === 'expert') {
947+
topContainer_html += '<div class="row" style="display: flex; align-items: center; margin-bottom: 10px; margin-top: 30px;">' +
948+
'<div class="col-md-2"><p class="text-left" style="margin:0;">' + $.i18n('edt_dev_spec_bridgeid_title') + '</p></div>' +
949+
'<div class="col-md-7"><div class="input-group">' +
950+
'<span class="input-group-addon"><i class="fa fa-qrcode"></i></span>' +
951+
'<input type="text" class="input-group form-control" id="bridgeid" placeholder="' + $.i18n('edt_dev_spec_bridgeid_title') + '"></div></div></div>';
952+
}
953+
954+
topContainer_html += '<div class="row" style="display: flex; align-items: center; margin-bottom: 10px;">' +
955+
'<div class="col-md-2"><p class="text-left" style="margin:0;">' + $.i18n('edt_dev_spec_targetIpHost_title') + '</p></div>' +
956+
'<div class="col-md-7"><div class="input-group">' +
957+
'<span class="input-group-addon"><i class="fa fa-arrow-right"></i></span>' +
958+
'<input type="text" class="input-group form-control" id="host" placeholder="' + $.i18n('edt_dev_spec_targetIpHost_title') + '"></div></div>';
938959

939960
if (storedAccess === 'expert') {
940961
topContainer_html += '<div class="col-md-3"><div class="input-group">' +
941962
'<span class="input-group-addon">:</span>' +
942963
'<input type="text" class="input-group form-control" id="port" placeholder="' + $.i18n('edt_conf_general_port_title') + '"></div></div>';
943964
}
944-
topContainer_html += '</div><p><span style="font-weight:bold;color:red" id="wiz_hue_ipstate"></span><span style="font-weight:bold;" id="wiz_hue_discovered"></span></p>';
965+
topContainer_html += '</div><div class="row" style="margin-top: 15px;"><div text-center"><p><span style="font-weight:bold;color:red" id="wiz_hue_ipstate"></span><span style="font-weight:bold;" id="wiz_hue_discovered"></span></p></div></div>';
945966

946967
// Hidden fields
947-
topContainer_html += '<div class="form-group" style="display:none"><input type="hidden" id="bridgeid" name="bridgeid"></div>';
948968
topContainer_html += '<div class="form-group" id="usrcont" style="display:none"></div>';
949969

950970
$('#wh_topcontainer').append(topContainer_html);

0 commit comments

Comments
 (0)