diff --git a/core/class/gsh_ColorSetting.class.php b/core/class/gsh_ColorSetting.class.php index b5df01d..a8c7513 100644 --- a/core/class/gsh_ColorSetting.class.php +++ b/core/class/gsh_ColorSetting.class.php @@ -20,18 +20,18 @@ require_once dirname(__FILE__) . '/../../../../core/php/core.inc.php'; class gsh_ColorSetting { - + /* * *************************Attributs****************************** */ - + private static $_COLOR = array('LIGHT_SET_COLOR'); private static $_COLOR_STATE = array('LIGHT_COLOR'); private static $_COLOR_TEMP = array('LIGHT_SET_COLOR_TEMP'); private static $_COLOR_TEMP_STATE = array('LIGHT_COLOR_TEMP'); - + /* * ***********************Methode static*************************** */ - - public static function discover($_device,$_eqLogic){ - $return = array('traits' => array(),'customData' => array()); + + public static function discover($_device, $_eqLogic) { + $return = array('traits' => array(), 'customData' => array()); foreach ($_eqLogic->getCmd() as $cmd) { if (in_array($cmd->getGeneric_type(), self::$_COLOR)) { if (!in_array('action.devices.traits.ColorSetting', $return['traits'])) { @@ -43,7 +43,7 @@ public static function discover($_device,$_eqLogic){ } $return['attributes']['colorModel'] = 'rgb'; } - if (in_array($cmd->getGeneric_type(),self::$_COLOR_TEMP)) { + if (in_array($cmd->getGeneric_type(), self::$_COLOR_TEMP)) { if (!in_array('action.devices.traits.ColorSetting', $return['traits'])) { $return['traits'][] = 'action.devices.traits.ColorSetting'; } @@ -65,45 +65,45 @@ public static function discover($_device,$_eqLogic){ } return $return; } - - public static function needGenericType(){ + + public static function needGenericType() { return array( - __('Couleur',__FILE__) => self::$_COLOR, - __('Etat couleur',__FILE__) => self::$_COLOR_STATE, + __('Couleur', __FILE__) => self::$_COLOR, + __('Etat couleur', __FILE__) => self::$_COLOR_STATE, ); } - - public static function exec($_device, $_executions, $_infos){ + + public static function exec($_device, $_executions, $_infos) { $return = array(); foreach ($_executions as $execution) { try { switch ($execution['command']) { case 'action.devices.commands.ColorAbsolute': - if (isset($execution['params']['color']['spectrumRGB'])) { - if (isset($_infos['customData']['ColorSetting_cmdSetColor'])) { - $cmd = cmd::byId($_infos['customData']['ColorSetting_cmdSetColor']); - } - if(is_object($cmd)){ - $cmd->execCmd(array('color' => '#' . str_pad(dechex($execution['params']['color']['spectrumRGB']), 6, '0', STR_PAD_LEFT))); + if (isset($execution['params']['color']['spectrumRGB'])) { + if (isset($_infos['customData']['ColorSetting_cmdSetColor'])) { + $cmd = cmd::byId($_infos['customData']['ColorSetting_cmdSetColor']); + } + if (is_object($cmd)) { + $cmd->execCmd(array('color' => '#' . str_pad(dechex($execution['params']['color']['spectrumRGB']), 6, '0', STR_PAD_LEFT))); + } } - } - if (isset($execution['params']['color']['temperature'])) { - if (isset($_infos['customData']['ColorSetting_cmdSetTempColor'])) { - $cmd = cmd::byId($_infos['customData']['ColorSetting_cmdSetTempColor']); + if (isset($execution['params']['color']['temperature'])) { + if (isset($_infos['customData']['ColorSetting_cmdSetTempColor'])) { + $cmd = cmd::byId($_infos['customData']['ColorSetting_cmdSetTempColor']); + } + if (is_object($cmd)) { + $cmd->execCmd(array('slider' => $execution['params']['color']['temperature'])); + } } - if(is_object($cmd)){ - $cmd->execCmd(array('slider' => $execution['params']['color']['temperature'])); + $return = array('status' => 'SUCCESS'); + if (isset($_infos['customData']['OnOff_cmdGetState'])) { + $state = cmd::byId($_infos['customData']['OnOff_cmdGetState']); + if (is_object($state)) { + sleep(1); + $return['on'] = boolval($state->execCmd()); + } } - } - $return = array('status' => 'SUCCESS'); - if(isset($_infos['customData']['OnOff_cmdGetState'])){ - $state = cmd::byId($_infos['customData']['OnOff_cmdGetState']); - if(is_object()){ - sleep(1); - $return['on'] = boolval($state->execCmd()); - } - } - break; + break; } } catch (Exception $e) { log::add('gsh', 'error', $e->getMessage()); @@ -112,25 +112,24 @@ public static function exec($_device, $_executions, $_infos){ } return $return; } - - public static function query($_device, $_infos){ + + public static function query($_device, $_infos) { $return = array(); $cmd = null; if (isset($_infos['customData']['ColorSetting_cmdGetColor'])) { $cmd = cmd::byId($_infos['customData']['ColorSetting_cmdGetColor']); - if(!isset($return['color'])){ + if (!isset($return['color'])) { $return['color'] = array(); } $return['color']['spectrumRGB'] = hexdec(str_replace('#', '', $cmd->execCmd())); } if (isset($_infos['customData']['ColorSetting_cmdGetTempColor'])) { $cmd = cmd::byId($_infos['customData']['ColorSetting_cmdGetTempColor']); - if(!isset($return['color'])){ + if (!isset($return['color'])) { $return['color'] = array(); } $return['color']['temperatureK'] = $cmd->execCmd(); } return $return; } - } diff --git a/docs/fr_FR/changelog.md b/docs/fr_FR/changelog.md index 1bfa08b..f7c8317 100644 --- a/docs/fr_FR/changelog.md +++ b/docs/fr_FR/changelog.md @@ -4,6 +4,11 @@ > >Pour rappel s'il n'y a pas d'information sur la mise à jour, c'est que celle-ci concerne uniquement de la mise à jour de documentation, de traduction ou de texte +# 09/05/2024 + +- Correction de bugs + +# 29/04/2024 - Correction d'un bug avec Jeedom 4.4 - Version uniquement compatible avec Jeedom 4.4 ou plus @@ -45,7 +50,7 @@ - Possibilité d'interdir toute requete de Google en fonction d'une condition - Possibilité de ne pas avoir de code lors d'une demande de déverouillage d'une serrure -# 05/04/2021 +# 05/04/2021 - Passage a nodejs 14 @@ -183,7 +188,6 @@ - Ajout du control de volumes et commande media (stop,pause,lecture,suivant,précedent) pour le type enceinte (nécessite jeedom 3.3.x ou plus) - Correction d'un soucis de non désactivation de la transmission lors de la désactivation d'un équipement - # 07/01/2018 - Mise à jour de la documentation