diff --git a/.github/workflows/work.yml b/.github/workflows/work.yml new file mode 100644 index 0000000..fbaadcc --- /dev/null +++ b/.github/workflows/work.yml @@ -0,0 +1,15 @@ +on: + # Workflows check plugin Jeedom + push: + branches: + - beta + pull_request: + branches: + - beta + - master + +name : 'Full Workflows Plugin Jeedom' + +jobs: + plugin: + uses: jeedom/workflows/.github/workflows/plugin.yml@main diff --git a/core/class/wazeintime.class.php b/core/class/wazeintime.class.php index 20c662b..baf3923 100644 --- a/core/class/wazeintime.class.php +++ b/core/class/wazeintime.class.php @@ -25,6 +25,7 @@ class wazeintime extends eqLogic { public static $_widgetPossibility = array('custom' => true); public static function cron() { + /** @var wazeintime */ foreach (eqLogic::byType(__CLASS__, true) as $eqLogic) { $autorefresh = $eqLogic->getConfiguration('autorefresh', ''); $cronIsDue = false; @@ -49,32 +50,38 @@ public function refreshRoutes() { $start = $this->getPosition('start'); $end = $this->getPosition('end'); - $row = ($this->getConfiguration('NOA')) ? '' : 'row-'; + $row = ($this->getConfiguration('NOA')) ? '' : 'row-'; // FIXME: don't know which url to use for North America so deactivate for now, not sure anyone uses it $subConfig = $this->getConfiguration('subscription'); $subscription = ($subConfig == '') ? '' : "&subscription={$subConfig}"; - $wazeRouteurl = 'https://www.waze.com/' . $row . 'RoutingManager/routingRequest?from=x%3A' . $start['lon'] . '+y%3A' . $start['lat'] . '&to=x%3A' . $end['lon'] . '+y%3A' . $end['lat'] . '&at=0&returnJSON=true&returnGeometries=true&returnInstructions=true&timeout=60000&nPaths=3&options=AVOID_TRAILS%3At' . $subscription; - log::add(__CLASS__, 'debug', "routeURL: {$wazeRouteurl}"); - $request_http = new com_http($wazeRouteurl); - $request_http->setUserAgent('User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0' . hex2bin('0A') . 'referer: https://www.waze.com '); + $baseUrl = 'https://routing-livemap-row.waze.com/RoutingManager/routingRequest'; + $userAgent = 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0' . hex2bin('0A') . 'referer: https://www.waze.com '; + + $from = str_replace(':', '%3A', "x:{$start['lon']}+y:{$start['lat']}"); + $to = str_replace(':', '%3A', "x:{$end['lon']}+y:{$end['lat']}"); + $options = urlencode('AVOID_TRAILS:t'); + + $wazeRouteUrl = "{$baseUrl}?from={$from}&to={$to}&at=0&returnJSON=true&timeout=60000&nPaths=3&options={$options}{$subscription}"; + log::add(__CLASS__, 'debug', "routeURL: {$wazeRouteUrl}"); + $request_http = new com_http($wazeRouteUrl); + $request_http->setUserAgent($userAgent); $json = json_decode($request_http->exec(60, 2), true); if (isset($json['error'])) { throw new Exception($json['error']); } $data = self::extractInfo($json); - $wazeRoutereturl = 'https://www.waze.com/' . $row . 'RoutingManager/routingRequest?from=x%3A' . $end['lon'] . '+y%3A' . $end['lat'] . '&to=x%3A' . $start['lon'] . '+y%3A' . $start['lat'] . '&at=0&returnJSON=true&returnGeometries=true&returnInstructions=true&timeout=60000&nPaths=3&options=AVOID_TRAILS%3At' . $subscription; - log::add(__CLASS__, 'debug', "routeURL: {$wazeRouteurl}"); - $request_http = new com_http($wazeRoutereturl); - $request_http->setUserAgent('User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0' . hex2bin('0A') . 'referer: https://www.waze.com '); + $wazeRouteRetUrl = "{$baseUrl}?from={$to}&to={$from}&at=0&returnJSON=true&timeout=60000&nPaths=3&options={$options}{$subscription}"; + log::add(__CLASS__, 'debug', "return routeURL: {$wazeRouteUrl}"); + $request_http = new com_http($wazeRouteRetUrl); + $request_http->setUserAgent($userAgent); $json = json_decode($request_http->exec(60, 2), true); if (isset($json['error'])) { throw new Exception($json['error']); } $data = array_merge($data, self::extractInfo($json, 'ret')); - log::add(__CLASS__, 'debug', 'Data: ' . print_r($data, true)); - + log::add(__CLASS__, 'debug', 'Result data: ' . print_r($data, true)); foreach ($this->getCmd('info') as $cmd) { if ($cmd->getLogicalId() == 'lastrefresh') { $cmd->event(date('H:i')); @@ -94,7 +101,7 @@ public function refreshRoutes() { } } - public static function extractInfo($_data, $_prefix = '') { + public static function extractInfo(array $_data, string $_prefix = '') { $return = array(); log::add(__CLASS__, 'debug', 'raw data:' . json_encode($_data)); if (isset($_data['alternatives'])) { @@ -435,6 +442,7 @@ public function toHtml($_version = 'dashboard') { class wazeintimeCmd extends cmd { public function execute($_options = null) { if ($this->getLogicalId() == 'refresh') { + /** @var wazeintime */ $eqlogic = $this->getEqLogic(); $eqlogic->refreshRoutes(); } diff --git a/core/i18n/en_US.json b/core/i18n/en_US.json index 0a1bde6..0105e01 100644 --- a/core/i18n/en_US.json +++ b/core/i18n/en_US.json @@ -29,7 +29,7 @@ "Paramètres du trajet": "Trip parameters", "Départ": "Departure", "Manuel": "Manual", - "Commande": "Ordered", + "Commande": "Command", "Latitude": "Latitude", "48.856614": "48.856614", "Longitude": "Longitude", @@ -56,7 +56,7 @@ "Historiser": "Historize", "Inverser": "Reverse", "Min": "Minimum", - "Max": "Max", + "Max": "Maximum", "Unité": "Unity", "Supprimer la commande": "Delete order" }, diff --git a/core/php/wazeintime.inc.php b/core/php/wazeintime.inc.php index 51edf1e..a5fb7f8 100644 --- a/core/php/wazeintime.inc.php +++ b/core/php/wazeintime.inc.php @@ -20,4 +20,3 @@ require_once dirname(__FILE__) . '/../../../../core/php/core.inc.php'; include_file('core', 'wazeintime', 'class', 'wazeintime'); -?> diff --git a/docs/de_DE/changelog.md b/docs/de_DE/changelog.md index f6dbf40..b0ff902 100644 --- a/docs/de_DE/changelog.md +++ b/docs/de_DE/changelog.md @@ -4,6 +4,16 @@ > >Zur Erinnerung: Wenn keine Informationen zum Update vorhanden sind, bedeutet dies, dass es sich nur um die Aktualisierung von Dokumentation, Übersetzung oder Text handelt +# + +- +- . +- + +# 29/06/2025 + +- Optimisation des requêtes vers Waze afin de réduire la latence + # 17.10.2022 - Befehlsliste für Jeedom v4.3 aktualisieren diff --git a/docs/en_US/changelog.md b/docs/en_US/changelog.md index 68eb50f..3cce286 100644 --- a/docs/en_US/changelog.md +++ b/docs/en_US/changelog.md @@ -4,6 +4,16 @@ > >As a reminder if there is no information on the update, it means that it only concerns the updating of documentation, translation or text +# 29/11/2025 + +- Fixed the URL used following a change by Waze +- Jeedom version 4.4 or higher required +- Debian version 11 or higher required + +# 29/06/2025 + +- Optimized requests to Waze to reduce latency + # 10/17/2022 - Update command list for Jeedom v4.3 diff --git a/docs/es_ES/changelog.md b/docs/es_ES/changelog.md index 56e6188..54b7dd6 100644 --- a/docs/es_ES/changelog.md +++ b/docs/es_ES/changelog.md @@ -4,6 +4,16 @@ > >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 +# + +- +- . +- + +# 29/06/2025 + +- Optimisation des requêtes vers Waze afin de réduire la latence + # 17/10/2022 - Lista de comandos de actualización para Jeedom v4.3 diff --git a/docs/fr_FR/changelog.md b/docs/fr_FR/changelog.md index 6f543d8..5c885a1 100644 --- a/docs/fr_FR/changelog.md +++ b/docs/fr_FR/changelog.md @@ -4,6 +4,16 @@ > >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 +# 29/11/2025 + +- Correction de l'URL utilisée suite à un changement de Waze +- Version Jeedom 4.4 ou plus requis +- Version Debian 11 ou plus requis + +# 29/06/2025 + +- Optimisation des requêtes vers Waze afin de réduire la latence + # 17/10/2022 - Mise à jour liste des commandes pour Jeedom v4.3 diff --git a/docs/i18n/de_DE.json b/docs/i18n/de_DE.json index 9717965..ef72570 100644 --- a/docs/i18n/de_DE.json +++ b/docs/i18n/de_DE.json @@ -2,6 +2,13 @@ "changelog.md": { "Changelog Waze in Time": "Changelog Waze in der Zeit", "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", + "29\/11\/2025": "", + "Correction de l'URL utilisée suite à un changement de Waze": "", + "Version Jeedom 4": "", + "4 ou plus requis": "", + "Version Debian 11 ou plus requis": "", + "29\/06\/2025": "29\/06\/2025", + "Optimisation des requêtes vers Waze afin de réduire la latence": "Optimisation des requêtes vers Waze afin de réduire la latence", "17\/10\/2022": "17.10.2022", "Mise à jour liste des commandes pour Jeedom v4.3": "Befehlsliste für Jeedom v4.3 aktualisieren", "17\/03\/2022": "17.03.2022", diff --git a/docs/i18n/en_US.json b/docs/i18n/en_US.json index 82fc51b..eef654b 100644 --- a/docs/i18n/en_US.json +++ b/docs/i18n/en_US.json @@ -2,6 +2,13 @@ "changelog.md": { "Changelog Waze in Time": "Changelog Waze in Time", "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", + "29\/11\/2025": "", + "Correction de l'URL utilisée suite à un changement de Waze": "", + "Version Jeedom 4": "", + "4 ou plus requis": "", + "Version Debian 11 ou plus requis": "", + "29\/06\/2025": "29\/06\/2025", + "Optimisation des requêtes vers Waze afin de réduire la latence": "Optimisation des requêtes vers Waze afin de réduire la latence", "17\/10\/2022": "10\/17\/2022", "Mise à jour liste des commandes pour Jeedom v4.3": "Update command list for Jeedom v4.3", "17\/03\/2022": "03\/17\/2022", diff --git a/docs/i18n/es_ES.json b/docs/i18n/es_ES.json index 21fbf8c..95818ad 100644 --- a/docs/i18n/es_ES.json +++ b/docs/i18n/es_ES.json @@ -2,6 +2,13 @@ "changelog.md": { "Changelog Waze in Time": "Registro de cambios Waze in Time", "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", + "29\/11\/2025": "", + "Correction de l'URL utilisée suite à un changement de Waze": "", + "Version Jeedom 4": "", + "4 ou plus requis": "", + "Version Debian 11 ou plus requis": "", + "29\/06\/2025": "29\/06\/2025", + "Optimisation des requêtes vers Waze afin de réduire la latence": "Optimisation des requêtes vers Waze afin de réduire la latence", "17\/10\/2022": "17\/10\/2022", "Mise à jour liste des commandes pour Jeedom v4.3": "Lista de comandos de actualización para Jeedom v4.3", "17\/03\/2022": "17\/03\/2022", diff --git a/docs/i18n/fr_FR.json b/docs/i18n/fr_FR.json index 507b26f..7f450ab 100644 --- a/docs/i18n/fr_FR.json +++ b/docs/i18n/fr_FR.json @@ -3,6 +3,13 @@ "Changelog Waze in Time": "Changelog Waze in Time", "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", + "29\/11\/2025": "29\/11\/2025", + "Correction de l'URL utilisée suite à un changement de Waze": "Correction de l'URL utilisée suite à un changement de Waze", + "Version Jeedom 4": "Version Jeedom 4", + "4 ou plus requis": "4 ou plus requis", + "Version Debian 11 ou plus requis": "Version Debian 11 ou plus requis", + "29\/06\/2025": "29\/06\/2025", + "Optimisation des requêtes vers Waze afin de réduire la latence": "Optimisation des requêtes vers Waze afin de réduire la latence", "17\/10\/2022": "17\/10\/2022", "Mise à jour liste des commandes pour Jeedom v4.3": "Mise à jour liste des commandes pour Jeedom v4.3", "17\/03\/2022": "17\/03\/2022", diff --git a/docs/i18n/pt_PT.json b/docs/i18n/pt_PT.json index 6962ae8..08ee949 100644 --- a/docs/i18n/pt_PT.json +++ b/docs/i18n/pt_PT.json @@ -2,6 +2,13 @@ "changelog.md": { "Changelog Waze in Time": "Registro de alterações Waze in Time", "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", + "29\/11\/2025": "", + "Correction de l'URL utilisée suite à un changement de Waze": "", + "Version Jeedom 4": "", + "4 ou plus requis": "", + "Version Debian 11 ou plus requis": "", + "29\/06\/2025": "29\/06\/2025", + "Optimisation des requêtes vers Waze afin de réduire la latence": "Optimisation des requêtes vers Waze afin de réduire la latence", "17\/10\/2022": "17\/10\/2022", "Mise à jour liste des commandes pour Jeedom v4.3": "Atualizar lista de comandos para Jeedom v4.3", "17\/03\/2022": "17\/03\/2022", diff --git a/docs/pt_PT/changelog.md b/docs/pt_PT/changelog.md index df7fb09..c19e606 100644 --- a/docs/pt_PT/changelog.md +++ b/docs/pt_PT/changelog.md @@ -4,6 +4,16 @@ > >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 +# + +- +- . +- + +# 29/06/2025 + +- Optimisation des requêtes vers Waze afin de réduire la latence + # 17/10/2022 - Atualizar lista de comandos para Jeedom v4.3 diff --git a/plugin_info/info.json b/plugin_info/info.json index f116d56..b626965 100644 --- a/plugin_info/info.json +++ b/plugin_info/info.json @@ -14,8 +14,11 @@ "tr": "Plugin pour avoir la durée de trajet entre deux points" }, "licence": "AGPL", - "author": "Ludovic SARAKHA", - "require": "2.3", + "author": "Jeedom SAS", + "require": "4.4", + "os": { + "min": 11 + }, "category": "travel", "changelog": "https:\/\/doc.jeedom.com\/#language#\/plugins\/travel\/wazeintime\/changelog", "documentation": "https:\/\/doc.jeedom.com\/#language#\/plugins\/travel\/wazeintime\/", @@ -32,7 +35,6 @@ "tr" ], "compatibility": [ - "miniplus", "smart", "rpi", "docker", diff --git a/plugin_info/install.php b/plugin_info/install.php index 4eb5ef3..d1f9e98 100644 --- a/plugin_info/install.php +++ b/plugin_info/install.php @@ -23,5 +23,3 @@ function wazeintime_update() { $wazeintime->save(); } } - -?>