Skip to content

Commit

Permalink
v1.6a
Browse files Browse the repository at this point in the history
  • Loading branch information
FredBardin committed Dec 29, 2016
1 parent 00c2da5 commit 90ee528
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 30 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Php web interface to manage Philips Hue lights in a local network.
* Copy color settings between lights (copy to, copy from, switch with)
* Switch lights on/off
* Run simple effects
* **Multi Lang** (new translation files can be added after installation or be submitted for an integration)
* **Multi Lang** (new translation files can be added after installation and/or be submitted for an integration)
* Fully touch device compatible
* **Hue API class available** in 'include/hueapi.php' (see comments in file)
* **Hue cmd web service available** with 'hueapi_cmd.php' (see comments in file and [wiki](https://github.com/FredBardin/phpMyHue/wiki/Web-services))
Expand Down Expand Up @@ -46,7 +46,7 @@ If you're asked to proceed manually because automatic setup failed to complete (
2. Edit 'include/config.php' and put correct values for '$bridgeip', '$username' and, if needed, for '$lang'.
* 'bridgeip' is the ip address of your hue bridge in your lan.
* 'username' is a registered user in your hue bridge (cf http://www.developers.meethue.com/documentation/api-core-concepts).
* 'lang' references an existing 'include/text_"lang".json' file ('en' by default).
* 'lang' references an existing 'lang/text_"lang".json' file ('en' by default).

### Licence
MIT
Expand Down
12 changes: 6 additions & 6 deletions effects/score.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
<light id="2" on="true" />
<light id="3" on="true" />
<light id="4" on="true" />
<!-- Loop to switch lamp 1 with 4 and 2 with 3 -->
<!-- Loop to switch lamp 1 with 2 and 3 with 4 -->
<loop repeat="$repeat">
<getcolor id="1" name="first" />
<getcolor id="4" name="second" />
<getcolor id="2" name="second" />
<setcolor id="1" name="second" transitiontime="$transition" />
<setcolor id="2" name="first" transitiontime="$transition" />
<getcolor id="3" name="first" />
<getcolor id="4" name="second" />
<setcolor id="3" name="second" transitiontime="$transition" />
<setcolor id="4" name="first" transitiontime="$transition" />
<getcolor id="2" name="first" />
<getcolor id="3" name="second" />
<setcolor id="2" name="second" transitiontime="$transition" />
<setcolor id="3" name="first" transitiontime="$transition" />
<timer duration="$duration" />
</loop>
<!-- Restore original state -->
Expand Down
4 changes: 4 additions & 0 deletions histo.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v1.6 - :
- New logo
- Move translation files from 'include' to 'lang'
- Correction of
v1.5 - 11/09/2016 :
- Add Sensors Rules management
- Update color conversion with new formulas from meethue
Expand Down
2 changes: 1 addition & 1 deletion hueapi_cmd.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
}
echo json_encode($HueAPI->info['groups']['other']);
} else { // Normal process
// if command or delete : set, else load information
// if command or delete : set, else load information
if (isset($cmdjs) || $method == "DELETE"){
echo $HueAPI->setInfo($action,$cmdjs,$method);
} else {
Expand Down
25 changes: 14 additions & 11 deletions include/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function choose_lang(){
global $lang;

// Get lang file array
$lang_ar = glob('include/text_??.json');
$lang_ar = glob('lang/text_??.json');

// Display lang list
echo "<SELECT ID=c_lang NAME=\"lang\">\n";
Expand Down Expand Up @@ -137,16 +137,19 @@ function display_lights_groups($prefid="",$cbpos="E",$brislider=false){
foreach ($gval['lights'] as $internal => $lnum){display_light_row($prefid,$lnum,$gnum,$cbpos,$brislider);}
}

// Lamps without group
echo "<TR CLASS=grp gnum=other>";
echo "<TD><SPAN CLASS=\"grp ui-icon ui-icon-circle-minus\" gnum=other open></SPAN>";
if ($cbpos == "B"){display_td_checkbox($prefid, "other", "grp", "other");}
echo "<TD CLASS=\"label grp\"><LABEL FOR=".$prefid."cb_other>".$trs["Lamps"]."</LABEL>";
echo "<TD><BUTTON ID=".$prefid."otheron>On</BUTTON><BUTTON ID=".$prefid."otheroff>Off</BUTTON>";
if ($cbpos == "E"){display_td_checkbox($prefid, "other", "grp", "other");}
if ($brislider){display_bri_slider($prefid,"other","other");}
foreach ($HueAPI->info['lights'] as $lnum => $lval){if (! isset($lval['grp'])){display_light_row($prefid,$lnum,"other",$cbpos,$brislider);}}
echo "</DIV>";
// Lamps without group only if existing
$othergroup=false;
foreach ($HueAPI->info['lights'] as $lnum => $lval){if (! isset($lval['grp'])){$othergroup=true;break;}}
if ($othergroup){
echo "<TR CLASS=grp gnum=other>";
echo "<TD><SPAN CLASS=\"grp ui-icon ui-icon-circle-minus\" gnum=other open></SPAN>";
if ($cbpos == "B"){display_td_checkbox($prefid, "other", "grp", "other");}
echo "<TD CLASS=\"label grp\"><LABEL FOR=".$prefid."cb_other>".$trs["Lamps"]."</LABEL>";
echo "<TD><BUTTON ID=".$prefid."otheron>On</BUTTON><BUTTON ID=".$prefid."otheroff>Off</BUTTON>";
if ($cbpos == "E"){display_td_checkbox($prefid, "other", "grp", "other");}
if ($brislider){display_bri_slider($prefid,"other","other");}
foreach ($HueAPI->info['lights'] as $lnum => $lval){if (! isset($lval['grp'])){display_light_row($prefid,$lnum,"other",$cbpos,$brislider);}}
}

echo "</TABLE>";
} // display_lights_groups
Expand Down
2 changes: 1 addition & 1 deletion include/hueapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
if (! defined('INIT')){include "include/config.php";}

// Load translations
$trs = json_decode(implode(file('include/text_'.$lang.'.json')),true);
$trs = json_decode(implode(file('lang/text_'.$lang.'.json')),true);

//-- API Class
class HueAPI {
Expand Down
2 changes: 1 addition & 1 deletion include/init_conf.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

// Load translations
if ($lang == ""){$lang = "en";} // Default lang = en
$trs = json_decode(implode(file('include/text_'.$lang.'.json')),true);
$trs = json_decode(implode(file('lang/text_'.$lang.'.json')),true);

echo "<FORM METHOD=post>";

Expand Down
3 changes: 2 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
include "include/init_conf.php";

// Load translations (lf+cr+<+>+' are removed)
$trs_json = preg_replace("/[\n\r<>']/","", implode(file('include/text_'.$lang.'.json')));
$trs_json = preg_replace("/[\n\r<>']/","", implode(file('lang/text_'.$lang.'.json')));
$trs = json_decode($trs_json,true);
?>

Expand Down Expand Up @@ -68,6 +68,7 @@

</DIV><!-- div page -->
<SCRIPT>
// Make transalations available in javascript
var trs = jQuery.parseJSON('<?php echo $trs_json?>');

// Enable tooltip if not on mobile (= touch interface)
Expand Down
11 changes: 7 additions & 4 deletions js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// lightList manage list list event (for light tab or scene detail tab)
// switchGroup switch on or off a group of lamps
//------------------------------------------------------------------------
// 2016/12/28 : Correction on lights de-select if present in several groups
//------------------------------------------------------------------------
//----------------------------------------
// Create fonctions for mobiles detection
//----------------------------------------
Expand Down Expand Up @@ -281,27 +283,28 @@ function lightsList(listtab,prefid){
});

// Uncheck all and group if a lamp is unchecked
// + check/uncheck all line for the same lamp (if it belongs to several groups)
// + check/uncheck all lines for the same lamp (if it belongs to several groups)
$(listtab+' tbody input.light').change(function() {
id=$(this).attr('id');
var lnum = $(this).attr('lnum');
var gnum = $(this).attr('gnum');
$('#'+prefid+'s_'+gnum+'_'+lnum).toggleClass('cbchecked');
if ($(this).prop('checked')){
$(listtab+' tbody tr.light[lnum='+lnum+'] td.label').addClass('ui-state-focus');
$(listtab+' tbody tr.light[lnum='+lnum+'] input.light').prop('checked',true);
$(listtab+' tbody tr.light[lnum='+lnum+'] input.light').parent('span').addClass('cbchecked');
} else {
$(listtab+' tbody tr.light[lnum='+lnum+'] td.label').removeClass('ui-state-focus');
$(listtab+' tbody tr.light[lnum='+lnum+'] input.light').prop('checked',false);
$(listtab+' tbody tr.light[lnum='+lnum+'] input.light').parent('span').removeClass('cbchecked');
$(listtab+' tbody tr.light[lnum='+lnum+']').each(function(){
gnum = $(this).attr('gnum');
$(listtab+' tbody tr.grp[gnum='+gnum+'] input.grp').prop('checked',false);
$(listtab+' tbody tr.grp[gnum='+gnum+'] td.label').removeClass('ui-state-focus');
$(listtab+' tbody tr.grp[gnum='+gnum+'] input.grp').prop('checked',false);
$(listtab+' tbody tr.grp[gnum='+gnum+'] input.grp').parent('span').removeClass('cbchecked');
});
$(listtab+' thead td.label').removeClass('ui-state-focus');
$('#'+prefid+'cb_all').prop('checked',false);
$('#'+prefid+'s_all').removeClass('cbchecked');
$(listtab+' thead td.label').removeClass('ui-state-focus');
}
if (prefid == ""){loadSelectedLightsDetail(listtab);}
});
Expand Down
8 changes: 5 additions & 3 deletions js/lights.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Javascript Functions for lights tab in phpMyHue
// F. Bardin 2015/02/10
// ------------------------------------------------
// 2016/12/28 : correct group description when not a lightgroup
// ------------------------------------------------

/*====================================
Tab lights functions
Expand Down Expand Up @@ -110,10 +112,10 @@ function loadSelectedLightsDetail(tablights){
$('#detail').show("slide"); // Show tab
$('#selname').hide(); // Hide name selection by default
$('#transset').hide(); // Hide color settings transfer by default
$('#descri').accordion('option','active',false);
$('#brislider').val(0); // Reset brightness
updateColorPicker("", 0, '#ffffff');
$('#descri').accordion('option','active',false); // Close description by default
$('#descri').hide(); // Hide description by default
$('#brislider').val(0); // Reset brightness by default
updateColorPicker("", 0, '#ffffff'); // set color to white by default

if (lamponly != grponly){ // Show group management only if all elements are of the same type
$('#grpmgmt').show();
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 90ee528

Please sign in to comment.