diff --git a/.github/workflows/translations.yml b/.github/workflows/translations.yml new file mode 100644 index 0000000..d214266 --- /dev/null +++ b/.github/workflows/translations.yml @@ -0,0 +1,18 @@ +name: translate + +on: + workflow_dispatch: + push: + branches: + - beta + +jobs: + auto-translate: + runs-on: ubuntu-latest + steps: + - uses: jeedom/jeetranslate@main + with: + deepl_api_key: ${{ secrets.DEEPL_API_KEY }} + include_empty_translation: false + target_languages: "en_US,es_ES,de_DE,it_IT,pt_PT" + use_core_translations: true \ No newline at end of file diff --git a/core/class/ash.class.php b/core/class/ash.class.php old mode 100644 new mode 100755 index 7749eaa..28f0044 --- a/core/class/ash.class.php +++ b/core/class/ash.class.php @@ -36,6 +36,7 @@ include_file('core', 'ash_PowerLevelController', 'class', 'ash'); include_file('core', 'ash_ToggleController', 'class', 'ash'); include_file('core', 'ash_LockController', 'class', 'ash'); +include_file('core', 'ash_GarageDoorController', 'class', 'ash'); class ash extends eqLogic { @@ -68,7 +69,7 @@ public static function getSupportedType() { 'DOOR' => array('name' => __('Porte', __FILE__), 'skills' => array('ContactSensor', 'LockController')), 'EXTERIOR_BLIND' => array('name' => __('Volet', __FILE__), 'skills' => array('RangeController')), 'FAN' => array('name' => __('Ventilateur', __FILE__), 'skills' => array('PowerController', 'RangeController')), - 'GARAGE_DOOR' => array('name' => __('Porte de garage', __FILE__), 'skills' => array('ContactSensor')), + 'GARAGE_DOOR' => array('name' => __('Porte de garage', __FILE__), 'skills' => array('ContactSensor', 'GarageDoorController')), 'MICROWAVE' => array('name' => __('Micro-onde', __FILE__), 'skills' => array('PowerController')), 'NETWORK_HARDWARE' => array('name' => __('Equipement réseaux', __FILE__), 'skills' => array('PowerController')), 'PRINTER' => array('name' => __('Imprimante', __FILE__), 'skills' => array('PowerController')), @@ -204,6 +205,7 @@ public static function exec($_data) { if (isset($return['event']['endpoint']['cookie'])) { unset($return['event']['endpoint']['cookie']); } + $return['event']['header']['messageId'] = vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex(random_bytes(16)), 4)); return $return; } diff --git a/core/class/ash_GarageDoorController.class.php b/core/class/ash_GarageDoorController.class.php new file mode 100644 index 0000000..1dbadf3 --- /dev/null +++ b/core/class/ash_GarageDoorController.class.php @@ -0,0 +1,129 @@ + 'AlexaInterface', + 'interface' => 'Alexa.ModeController', + 'instance' => 'GarageDoor.Position', + 'version' => '3', + 'properties' => array ( + 'supported' => array(array('name' => 'mode')), + 'proactivelyReported' => false, + 'retrievable' => false, + ), + 'capabilityResources' => array ( + 'friendlyNames' => array( + array('@type' => 'asset', 'value' => array ('assetId' => 'Alexa.Setting.Opening')) + ), + ), + 'configuration' => array ( + 'ordered' => false, + 'supportedModes' => array ( + array( + 'value' => 'Position.Up', + 'modeResources' => array('friendlyNames' => array(array('@type' => 'asset', 'value' => array('assetId' => 'Alexa.Value.Open')))) + ), + array( + 'value' => 'Position.Down', + 'modeResources' => array('friendlyNames' => array(array('@type' => 'asset', 'value' => array('assetId' => 'Alexa.Value.Close')))) + ) + ) + ), + 'semantics' => array ( + 'actionMappings' => array ( + array ( + '@type' => 'ActionsToDirective', + 'actions' => array ('Alexa.Actions.Open', 'Alexa.Actions.Raise'), + 'directive' => array ('name' => 'SetMode', 'payload' => array ('mode' => 'Position.Up')) + ), + array ( + '@type' => 'ActionsToDirective', + 'actions' => array ('Alexa.Actions.Close', 'Alexa.Actions.Lower'), + 'directive' => array ('name' => 'SetMode', 'payload' => array ('mode' => 'Position.Down')) + ), + ), + 'stateMappings' => array ( + array ('@type' => 'StatesToValue', 'states' => array ('Alexa.States.Open'), 'value' => 'Position.Up'), + array ('@type' => 'StatesToValue', 'states' => array ('Alexa.States.Closed'), 'value' => 'Position.Down'), + ), + ), + ); + + foreach ($_eqLogic->getCmd() as $cmd) { + if (in_array($cmd->getGeneric_type(), self::$_OPEN)) { + $return['cookie']['GarageDoorController_setOpen'] = $cmd->getId(); + } + if (in_array($cmd->getGeneric_type(), self::$_CLOSE)) { + $return['cookie']['GarageDoorController_setClose'] = $cmd->getId(); + } + if (in_array($cmd->getGeneric_type(), self::$_STATE)) { + $return['capabilities']['Alexa.GarageDoorController']['properties']['retrievable'] = true; + $return['cookie']['GarageDoorController_getState'] = $cmd->getId(); + } + } + + if (!isset($return['cookie']['GarageDoorController_setOpen']) || !isset($return['cookie']['GarageDoorController_setClose'])) { + return array(); + } + + return $return; + } + + public static function needGenericType(){ + return array( + __('Ouvrir',__FILE__) => self::$_OPEN, + __('Fermer',__FILE__) => self::$_CLOSE, + __('Etat',__FILE__) => self::$_STATE + ); + } + + public static function exec($_device, $_directive) { + if ($_directive['header']['name'] == 'SetMode') { + $mode = $_directive['payload']['mode']; + if ($mode == 'Position.Up' && isset($_directive['endpoint']['cookie']['GarageDoorController_setOpen'])) { + $cmd = cmd::byId($_directive['endpoint']['cookie']['GarageDoorController_setOpen']); + if (is_object($cmd)) $cmd->execCmd(); + } else if ($mode == 'Position.Down' && isset($_directive['endpoint']['cookie']['GarageDoorController_setClose'])) { + $cmd = cmd::byId($_directive['endpoint']['cookie']['GarageDoorController_setClose']); + if (is_object($cmd)) $cmd->execCmd(); + } + } + return self::getState($_device, $_directive); + } + + public static function getState($_device, $_directive) { + $return = array(); + $cmd = null; + if (isset($_directive['endpoint']['cookie']['GarageDoorController_getState'])) { + $cmd = cmd::byId($_directive['endpoint']['cookie']['GarageDoorController_getState']); + } + if (!is_object($cmd)) return $return; + + $value = $cmd->execCmd(); + if ($cmd->getSubtype() == 'binary' && $cmd->getDisplay('invertBinary') == 1) { + $value = ($value) ? 0 : 1; + } + + $modeValue = ($value) ? 'Position.Up' : 'Position.Down'; + + $return[] = array( + 'namespace' => 'Alexa.ModeController', + 'instance' => 'GarageDoor.Position', + 'name' => 'mode', + 'value' => $modeValue, + 'timeOfSample' => date('Y-m-d\TH:i:s\Z', strtotime($cmd->getValueDate())), + 'uncertaintyInMilliseconds' => 0, + ); + return array('properties' => $return); + } +} diff --git a/core/class/ash_PowerController.class.php b/core/class/ash_PowerController.class.php old mode 100644 new mode 100755 index ff1e15b..3b3e3bc --- a/core/class/ash_PowerController.class.php +++ b/core/class/ash_PowerController.class.php @@ -117,6 +117,7 @@ public static function exec($_device, $_directive) { } break; } + usleep(500000); return self::getState($_device, $_directive); } diff --git a/core/class/ash_RangeController.class.php b/core/class/ash_RangeController.class.php index be929ce..74a57d7 100644 --- a/core/class/ash_RangeController.class.php +++ b/core/class/ash_RangeController.class.php @@ -159,8 +159,8 @@ public static function exec($_device, $_directive) { $cmd->execCmd(array('slider' => $cmdState->execCmd() + $value)); } case 'SetRangeValue': - if($_device->getOptions('OpenClose::invertSet',0) == 1){ - $execution['payload']['rangeValue'] = 100 - $execution['payload']['rangeValue']; + if($_device->getOptions('RangeController::invertSet',0) == 1){ + $_directive['payload']['rangeValue'] = 100 - $_directive['payload']['rangeValue']; } if (isset($_directive['endpoint']['cookie']['RangeController_setSlider'])) { $cmd = cmd::byId($_directive['endpoint']['cookie']['RangeController_setSlider']); diff --git a/docs/de_DE/changelog.md b/docs/de_DE/changelog.md index 4e67bde..b62acab 100644 --- a/docs/de_DE/changelog.md +++ b/docs/de_DE/changelog.md @@ -4,6 +4,10 @@ > >Zur Erinnerung: Wenn keine Informationen zum Update vorhanden sind, bedeutet dies, dass es sich nur um die Aktualisierung von Dokumentation, Übersetzung oder Text handelt +- + +# 11.06.2024 + - Ein Problem mit PHP8 wurde behoben # 23.09.2024 diff --git a/docs/en_US/changelog.md b/docs/en_US/changelog.md index 0f23685..d45e831 100644 --- a/docs/en_US/changelog.md +++ b/docs/en_US/changelog.md @@ -4,6 +4,10 @@ > >As a reminder if there is no information on the update, it means that it only concerns the updating of documentation, translation or text +- + +# 06/11/2024 + - Fixed an issue with PHP8 # 09/23/2024 diff --git a/docs/es_ES/changelog.md b/docs/es_ES/changelog.md index 9d08782..d629bf1 100644 --- a/docs/es_ES/changelog.md +++ b/docs/es_ES/changelog.md @@ -4,6 +4,10 @@ > >Como recordatorio si no hay información sobre la actualización, significa que solo se refiere a la actualización de documentación, traducción o texto +- + +# 11/06/2024 + - Se solucionó un problema con PHP8 # 23/09/2024 diff --git a/docs/fr_FR/changelog.md b/docs/fr_FR/changelog.md index cab62ee..8ef786a 100644 --- a/docs/fr_FR/changelog.md +++ b/docs/fr_FR/changelog.md @@ -4,6 +4,13 @@ > >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 +# 24/07/2026 + +- Correction d'un bug sur l'inversion des volets +- Correction de bugs +- Ajout porte de garage (merci @ripleyXLR8) + + # 06/11/2024 - Correction d'un soucis avec PHP8 diff --git a/docs/i18n/de_DE.json b/docs/i18n/de_DE.json index fb58a95..26ca032 100644 --- a/docs/i18n/de_DE.json +++ b/docs/i18n/de_DE.json @@ -2,6 +2,8 @@ "changelog.md": { "Changelog Alexa": "Changelog Alexa", "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": "Zur Erinnerung: Wenn keine Informationen zum Update vorhanden sind, bedeutet dies, dass es sich nur um die Aktualisierung von Dokumentation, Übersetzung oder Text handelt", + "Correction d'un bug sur l'inversion des volets": "", + "06\/11\/2024": "11.06.2024", "Correction d'un soucis avec PHP8": "Ein Problem mit PHP8 wurde behoben", "23\/09\/2024": "23.09.2024", "Correction d'un bug sur jeedom 4.4": "Ein Fehler in Jeedom 4.4 wurde behoben", diff --git a/docs/i18n/en_US.json b/docs/i18n/en_US.json index 29bc197..be5f538 100644 --- a/docs/i18n/en_US.json +++ b/docs/i18n/en_US.json @@ -2,6 +2,8 @@ "changelog.md": { "Changelog Alexa": "Changelog Alexa", "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": "As a reminder if there is no information on the update, it means that it only concerns the updating of documentation, translation or text", + "Correction d'un bug sur l'inversion des volets": "", + "06\/11\/2024": "06\/11\/2024", "Correction d'un soucis avec PHP8": "Fixed an issue with PHP8", "23\/09\/2024": "09\/23\/2024", "Correction d'un bug sur jeedom 4.4": "Fixed a bug on jeedom 4.4", diff --git a/docs/i18n/es_ES.json b/docs/i18n/es_ES.json index 489690e..d11ea03 100644 --- a/docs/i18n/es_ES.json +++ b/docs/i18n/es_ES.json @@ -2,6 +2,8 @@ "changelog.md": { "Changelog Alexa": "Registro de cambios Alexa", "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": "Como recordatorio si no hay información sobre la actualización, significa que solo se refiere a la actualización de documentación, traducción o texto", + "Correction d'un bug sur l'inversion des volets": "", + "06\/11\/2024": "11\/06\/2024", "Correction d'un soucis avec PHP8": "Se solucionó un problema con PHP8", "23\/09\/2024": "23\/09\/2024", "Correction d'un bug sur jeedom 4.4": "Se corrigió un error en Jeedom 4.4", diff --git a/docs/i18n/fr_FR.json b/docs/i18n/fr_FR.json index 95daa74..65e1f77 100644 --- a/docs/i18n/fr_FR.json +++ b/docs/i18n/fr_FR.json @@ -3,6 +3,8 @@ "Changelog Alexa": "Changelog Alexa", "IMPORTANT": "IMPORTANT", "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": "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", + "Correction d'un bug sur l'inversion des volets": "Correction d'un bug sur l'inversion des volets", + "06\/11\/2024": "06\/11\/2024", "Correction d'un soucis avec PHP8": "Correction d'un soucis avec PHP8", "23\/09\/2024": "23\/09\/2024", "Correction d'un bug sur jeedom 4.4": "Correction d'un bug sur jeedom 4.4", diff --git a/docs/i18n/pt_PT.json b/docs/i18n/pt_PT.json index d971db8..cd50c9b 100644 --- a/docs/i18n/pt_PT.json +++ b/docs/i18n/pt_PT.json @@ -2,6 +2,8 @@ "changelog.md": { "Changelog Alexa": "Changelog Alexa", "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": "Como lembrete, se não houver informações sobre a atualização, isso significa que se trata apenas da atualização da documentação, tradução ou texto", + "Correction d'un bug sur l'inversion des volets": "", + "06\/11\/2024": "11\/06\/2024", "Correction d'un soucis avec PHP8": "Corrigido um problema com PHP8", "23\/09\/2024": "23\/09\/2024", "Correction d'un bug sur jeedom 4.4": "Corrigido um bug no Jeedom 4.4", diff --git a/docs/pt_PT/changelog.md b/docs/pt_PT/changelog.md index cbf51a4..4b99381 100644 --- a/docs/pt_PT/changelog.md +++ b/docs/pt_PT/changelog.md @@ -4,6 +4,10 @@ > >Como lembrete, se não houver informações sobre a atualização, isso significa que se trata apenas da atualização da documentação, tradução ou texto +- + +# 11/06/2024 + - Corrigido um problema com PHP8 # 23/09/2024