mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
refactor: Align Phillips Hue to reworked device handling (#712)
* Align PhilipsHue (Classic) * Minor Device corrections * Have code working with Qt < 5.10 * Fixes on Hue Wizzard * Fixes on Hue Wizzard * Calculate Latchtime only for lights updated by hyperion * Allow to disable restoring original light's state * Fix - LightIDs / LightMap vectors were not cleared when reopening the device * Reduce API Calls for state updates by consolidation
This commit is contained in:
@@ -426,6 +426,7 @@
|
||||
"edt_dev_spec_transistionTime_title": "Übergangszeit",
|
||||
"edt_dev_spec_switchOffOnBlack_title": "Aus bei schwarz",
|
||||
"edt_dev_spec_brightnessFactor_title": "Helligkeitsfaktor",
|
||||
"edt_dev_spec_restoreOriginalState_title" : "Lampen Originalzustand wiederhestellen",
|
||||
"edt_dev_spec_ledType_title": "LED typ",
|
||||
"edt_dev_spec_uid_title": "UID",
|
||||
"edt_dev_spec_intervall_title": "Intervall",
|
||||
|
@@ -425,6 +425,7 @@
|
||||
"edt_dev_spec_transistionTime_title" : "Transition time",
|
||||
"edt_dev_spec_switchOffOnBlack_title" : "Switch off on black",
|
||||
"edt_dev_spec_brightnessFactor_title" : "Brightness factor",
|
||||
"edt_dev_spec_restoreOriginalState_title" : "Restore lights' original state",
|
||||
"edt_dev_spec_ledType_title" : "LED Type",
|
||||
"edt_dev_spec_uid_title" : "UID",
|
||||
"edt_dev_spec_intervall_title" : "Interval",
|
||||
|
@@ -567,23 +567,35 @@ function checkHueBridge(cb,hueUser){
|
||||
timeout: 2000
|
||||
})
|
||||
.done( function( data, textStatus, jqXHR ) {
|
||||
if(Array.isArray(data) && data[0].error && data[0].error.type == 4)
|
||||
cb(true);
|
||||
else if(Array.isArray(data) && data[0].error)
|
||||
cb(false);
|
||||
if( Array.isArray(data) && data[0].error)
|
||||
{
|
||||
if ( data[0].error.type == 3 || data[0].error.type == 4)
|
||||
{
|
||||
cb(true, usr);
|
||||
}
|
||||
else
|
||||
{
|
||||
cb(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
cb(true);
|
||||
{
|
||||
cb(true, usr);
|
||||
}
|
||||
|
||||
})
|
||||
.fail( function( jqXHR, textStatus ) {
|
||||
cb(false);
|
||||
});
|
||||
}
|
||||
|
||||
function checkUserResult(reply){
|
||||
function checkUserResult(reply, usr){
|
||||
|
||||
if(reply)
|
||||
{
|
||||
$('#wiz_hue_usrstate').html("");
|
||||
$('#wiz_hue_create_user').toggle(false);
|
||||
$('#user').val(usr);
|
||||
get_hue_lights();
|
||||
}
|
||||
else
|
||||
@@ -640,17 +652,22 @@ function checkBridgeResult(reply){
|
||||
|
||||
function identHueId(id, off)
|
||||
{
|
||||
var on = true;
|
||||
if(off !== true)
|
||||
{
|
||||
setTimeout(identHueId,1500,id,true);
|
||||
var put_data = '{"on":true,"bri":254,"hue":47000,"sat":254}';
|
||||
}
|
||||
else
|
||||
on = false;
|
||||
{
|
||||
var put_data = '{"on":false}';
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: 'http://'+$('#ip').val()+'/api/'+$('#user').val()+'/lights/'+id+'/state',
|
||||
type: 'PUT',
|
||||
timeout: 2000,
|
||||
data: ' {"on":'+on+', "sat":254, "bri":254,"hue":47000}'
|
||||
|
||||
data: put_data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -686,7 +703,9 @@ function beginWizardHue()
|
||||
|
||||
//check if ip is empty/reachable/search for bridge
|
||||
if(conf_editor.getEditor("root.specificOptions.output").getValue() == "")
|
||||
{
|
||||
getHueIPs();
|
||||
}
|
||||
else
|
||||
{
|
||||
var ip = conf_editor.getEditor("root.specificOptions.output").getValue();
|
||||
@@ -719,6 +738,7 @@ function beginWizardHue()
|
||||
}
|
||||
}
|
||||
|
||||
var ledCount= Object.keys(lightIDs).length;
|
||||
|
||||
window.serverConfig.leds = hueLedConfig;
|
||||
|
||||
@@ -736,6 +756,7 @@ function beginWizardHue()
|
||||
d.lightIds = finalLightIds;
|
||||
d.username = $('#user').val();
|
||||
d.type = "philipshue";
|
||||
d.hardwareLedCount = ledCount;
|
||||
d.transitiontime = 1;
|
||||
d.switchOffOnBlack = true;
|
||||
|
||||
@@ -814,6 +835,7 @@ function get_hue_lights(){
|
||||
|
||||
for(var lightid in r)
|
||||
{
|
||||
|
||||
$('.lidsb').append(createTableRow([lightid+' ('+r[lightid].name+')', '<select id="hue_'+lightid+'" class="hue_sel_watch form-control"><option value="disabled">'+$.i18n('wiz_hue_ids_disabled')+'</option><option value="top">'+$.i18n('conf_leds_layout_cl_top')+'</option><option value="bottom">'+$.i18n('conf_leds_layout_cl_bottom')+'</option><option value="left">'+$.i18n('conf_leds_layout_cl_left')+'</option><option value="right">'+$.i18n('conf_leds_layout_cl_right')+'</option><option value="entire">'+$.i18n('wiz_hue_ids_entire')+'</option></select>','<button class="btn btn-sm btn-primary" onClick=identHueId('+lightid+')>'+$.i18n('wiz_hue_blinkblue',lightid)+'</button>']));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user