Skip to content

Commit

Permalink
Compatibility list update
Browse files Browse the repository at this point in the history
  • Loading branch information
tcharp38 committed Jan 2, 2024
1 parent 67facb4 commit d108d88
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
4 changes: 2 additions & 2 deletions core/php/AbeilleModels.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

/* Get list of supported devices ($from="Abeille"), or user/custom ones ($from="local")
Returns: false if error
or associative array $modelsList[$modelName] = array(
'modelSig' => model signature
or associative array $modelsList[$modelSig+$modelVariant] = array(
'modelSig' => model signature (the Zigbee signature that leads to this model)
'modelName' => model file name WITHOUT '.json' extension
'modelSource' => model file location ('Abeille' or 'local')
'modelPath' => OPTIONAL: Path relative to 'modelSource' (default='<modelName>/<modelName>.json')
Expand Down
43 changes: 26 additions & 17 deletions desktop/modal/AbeilleCompatibility.modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,38 +117,47 @@ function addToFile($fileName, $text, $append = true) {
//----------------------------------------------------------------------------------------------------

require_once __DIR__.'/../../core/config/Abeille.config.php';
require_once __DIR__.'/../../core/class/AbeilleTools.class.php';
// require_once __DIR__.'/../../core/class/AbeilleTools.class.php';
require_once __DIR__.'/../../core/php/AbeilleModels.php';

// Collecting list of supported devices (by their JSON)
$modelsList = AbeilleTools::getDevicesList('Abeille');
// $modelsList = AbeilleTools::getDevicesList('Abeille');
$modelsList = getModelsList('Abeille');
// logDebug("modelsList=".json_encode($modelsList));
$eqList = [];
$resultRaw = [];
$result = [];
foreach ($modelsList as $modelSig => $model) {
foreach ($modelsList as $modelSigV => $model) {
// logDebug("LA model=".json_encode($model));

$modelName = $model['modelName'];
$path = __DIR__.'/../../core/config/devices/'.$modelName.'/'.$modelName.'.json';
if (!file_exists($path)) {
logDebug("ERROR: Path does not exists: ${path}");
continue;
}
$contentJSON = file_get_contents($path);
$content = json_decode($contentJSON, true);
$content = $content[$modelName]; // Skip top 'modelName' key
// $path = __DIR__.'/../../core/config/devices/'.$modelName.'/'.$modelName.'.json';
// if (!file_exists($path)) {
// logDebug("ERROR: Path does not exists: ${path}");
// continue;
// }
// $contentJSON = file_get_contents($path);
// $content = json_decode($contentJSON, true);
// $content = $content[$modelName]; // Skip top 'modelName' key
// logDebug("LA2 content=".json_encode($content));

$eqList[] = array(
'modelSig' => $modelSig,
'modelName' => $modelName,
'manufacturer' => isset($content["manufacturer"]) ? $content["manufacturer"] : '',
'model' => isset($content["model"]) ? $content["model"] : '',
'type' => isset($content["type"]) ? $content["type"] : '',
'icon' => isset($content["configuration"]["icon"]) ? $content["configuration"]["icon"] : '',
'modelSig' => $model['modelSig'],
'modelName' => $model['modelName'],
'manufacturer' => $model["manufacturer"],
'model' => $model["model"],
'type' => $model["type"],
'icon' => $model["icon"],
);

// Collect all information related to Command used by the products
if (isset($model['modelPath']))
$path = __DIR__.'/../../core/config/devices/'.$model['modelPath'];
else
$path = __DIR__.'/../../core/config/devices/'.$modelName.'/'.$modelName.'.json';
$contentJSON = file_get_contents($path);
$content = json_decode($contentJSON, true);
$content = $content[$modelName]; // Skip top 'modelName' key
if (isset($content['commands'])) {
$commands = $content['commands'];
// logDebug("LA commands=".json_encode($commands));
Expand Down
1 change: 1 addition & 0 deletions docs/fr_FR/Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ChangeLog
- Interne: Cmd: Plus que 3 niveaux de priorités.
- Owon-THS317-ET: Ajout d'un modèle pour les vieux équipements (EP=03 au lieu de 01, voir 2319).
- Interne: Nouvelle lib 'AbeilleModels.php'.
- Page compatibilité: Mise-à-jour.

231231-STABLE-1
---------------
Expand Down

0 comments on commit d108d88

Please sign in to comment.