Small Hue improvements (#235)

* Small Hue Bridge improvements

* Small Lang fixing
This commit is contained in:
b1rdhous3 2016-09-11 22:20:57 +02:00 committed by redPanther
parent 0b8d41ed69
commit d097995a74
5 changed files with 60 additions and 52 deletions

View File

@ -57,28 +57,32 @@
<div id="huebridge" class="container-fluid" style="display:none"> <div id="huebridge" class="container-fluid" style="display:none">
<hr/> <hr/>
<div class="row"> <button data-toggle="collapse" class="btn btn-success" data-target="#huebridge_content">Hue Bridge Setup Helper</button>
<div id="huebridge_content" class="collapse">
<!-- <div class="col-lg-12"> --> <!-- <div class="col-lg-12"> -->
<!-- <h1 class="page-header" lang="en" data-lang-token="main_menu_huebridge_token">Hue Bridge</h1> --> <!-- <h1 class="page-header" lang="en" data-lang-token="main_menu_huebridge_token">Hue Bridge</h1> -->
With this Setup Helper you can get a new User for your Hue Bridge and you can see your Lights with the IDs for Hyperion Configuration.<br />
If you already have a working User you will see it below. But you can always create a new one as well. <br />
<b>Remember:</b> This is only a helper. You have to copy and paste them in your config above. <br/ >
<div class="col-lg-12" > <div class="col-lg-12" >
<div class="col-lg-6" >
<span id="ip_alert" style="display:none; color:red; font-weight: bold;" lang="en" data-lang-token="hue_failure_ip_token">Please check your IP Address.</span> <span id="ip_alert" style="display:none; color:red; font-weight: bold;" lang="en" data-lang-token="hue_failure_ip_token">Please check your IP Address.</span>
<span id="abortConnection" style="display:none; color:red; font-weight: bold;" lang="en" data-lang-token="hue_failure_connection_token">Connection Timeout. Please press the button in time.</span> <span id="abortConnection" style="display:none; color:red; font-weight: bold;" lang="en" data-lang-token="hue_failure_connection_token">Connection Timeout. Please press the button in time.</span><br />
<div class="form-group"> <div class="form-group">
<label for="ip">Hue Bridge IP:</label> <label for="ip">Hue Bridge IP:</label>
<input type="text" class="form-control" id="ip"> <input type="text" class="form-control" id="ip">
<label for="user" lang="en" data-lang-token="hue_label_username">Hue Bridge Username:</label> <label for="user" lang="en" data-lang-token="hue_label_username">Hue Bridge Username:</label>
<input type="text" class="form-control" id="user" disabled> <input type="text" class="form-control" id="user" disabled>
<br /> <br />
<div id="hue_lights" class="row" />
<button type="button" class="btn btn-success" id="create_user"> <i class="fa fa-floppy-o"></i><span lang="en" data-lang-token="hue_button_create_user_token"> Create User</span></button> <button type="button" class="btn btn-success" id="create_user"> <i class="fa fa-floppy-o"></i><span lang="en" data-lang-token="hue_button_create_user_token"> Create User</span></button>
</div> </div>
</div> </div>
<!-- </div> -->
</div> </div>
</div> </div>
<hr />
<div id="hue_lights" class="row" />
</div>
</div> </div>
@ -174,4 +178,3 @@ start
<script src="/js/content_leds.js"></script> <script src="/js/content_leds.js"></script>
<script src="/js/content_huebridge.js"></script> <script src="/js/content_huebridge.js"></script>

View File

@ -1,5 +1,5 @@
<div class="container-fluid"> <div class="container-fluid">
<h1 class="page-header" lang="en" data-lang-token="main_menu_leds_conf_token">Remote Control</h1> <h1 class="page-header" lang="en" data-lang-token="main_menu_remotecontrol_token">Remote Control</h1>
</div> </div>
<div class="container"> <div class="container">
@ -14,7 +14,7 @@
<div id="cp2" class="colorpicker-component" style="width:auto;display:inline-block;white-space:nowrap;"> <div id="cp2" class="colorpicker-component" style="width:auto;display:inline-block;white-space:nowrap;">
<input type="text" value="#00AABB" class="form-control" style="display:inline" /><span class="input-group-addon form-control" style="display:inline-block;width:auto;"><i></i></span> <input type="text" value="#00AABB" class="form-control" style="display:inline" /><span class="input-group-addon form-control" style="display:inline-block;width:auto;"><i></i></span>
</div> </div>
<div lang="en" data-lang-token="remote_colors_label_color" style="display:inline-block;margin-left:50px;">effect: </div> <div lang="en" data-lang-token="remote_effects_label_effects" style="display:inline-block;margin-left:50px;">effect: </div>
<select id="effect_select" class="form-control" style="width:auto;display:inline-block"></select> <select id="effect_select" class="form-control" style="width:auto;display:inline-block"></select>
<button lang="en" data-lang-token="remote_colors_button_reset" type="button" class="btn btn-warning" id="reset_color" style="margin-left:20px;width:auto;display:inline-block">Reset Color/Effect</button> <button lang="en" data-lang-token="remote_colors_button_reset" type="button" class="btn btn-warning" id="reset_color" style="margin-left:20px;width:auto;display:inline-block">Reset Color/Effect</button>

View File

@ -1,9 +1,5 @@
$(document).ready( function() { $(document).ready( function() {
if($("#ip").val() != '' && $("#user").val() != '') {
get_hue_lights();
}
$("#create_user").on("click", function() { $("#create_user").on("click", function() {
var connectionRetries = 15; var connectionRetries = 15;
var data = {"devicetype":"hyperion#"+Date.now()}; var data = {"devicetype":"hyperion#"+Date.now()};
@ -32,6 +28,8 @@ $(document).ready( function() {
if (typeof r[0].success != 'undefined') { if (typeof r[0].success != 'undefined') {
$('#pairmodal').modal('hide'); $('#pairmodal').modal('hide');
$('#user').val(r[0].success.username); $('#user').val(r[0].success.username);
$( "#hue_lights" ).empty();
get_hue_lights(); get_hue_lights();
clearInterval(UserInterval); clearInterval(UserInterval);
} }
@ -51,19 +49,4 @@ function abortConnection(UserInterval){
$('#pairmodal').modal('hide'); $('#pairmodal').modal('hide');
} }
function get_hue_lights(){
$.ajax({
type: "GET",
url: 'http://'+$("#ip").val()+'/api/'+$("#user").val()+'/lights',
processData: false,
contentType: 'application/json',
success: function(r) {
for(var lightid in r){
//console.log(r[lightid].name);
$('#hue_lights').append('ID: '+lightid+' Name: '+r[lightid].name+'<br />');
}
}
});
}
}); });

View File

@ -173,6 +173,14 @@ $(document).ready(function() {
if ($(this).val() == "philipshue") if ($(this).val() == "philipshue")
{ {
$("#huebridge").show(); $("#huebridge").show();
$("#ip").attr('value', values_specific.output);
$("#user").attr('value', values_specific.username);
if($("#ip").val() != '' && $("#user").val() != '') {
get_hue_lights();
}
} }
else else
{ {
@ -182,4 +190,3 @@ $(document).ready(function() {
requestServerConfig(); requestServerConfig();
}); });

View File

@ -197,3 +197,18 @@ function requestWriteConfig(config, create, overwrite)
var overwrite = (typeof overwrite !== 'undefined') ? overwrite : false; var overwrite = (typeof overwrite !== 'undefined') ? overwrite : false;
websocket.send('{"command":"config","subcommand":"setconfig", "tan":'+wsTan+', "config":'+JSON.stringify(config)+',"create":'+create+', "overwrite":'+overwrite+'}'); websocket.send('{"command":"config","subcommand":"setconfig", "tan":'+wsTan+', "config":'+JSON.stringify(config)+',"create":'+create+', "overwrite":'+overwrite+'}');
} }
function get_hue_lights(){
$.ajax({
type: "GET",
url: 'http://'+$("#ip").val()+'/api/'+$("#user").val()+'/lights',
processData: false,
contentType: 'application/json',
success: function(r) {
for(var lightid in r){
//console.log(r[lightid].name);
$('#hue_lights').append('ID: '+lightid+' Name: '+r[lightid].name+'<br />');
}
}
});
}