From 1da5b9e7bcc26051e6152e6002ad8b515eb265bf Mon Sep 17 00:00:00 2001 From: Tcharp38 Date: Mon, 4 Dec 2023 23:10:00 +0100 Subject: [PATCH] All xiaomi now supported thru model 'private' entry --- core/class/Abeille.class.php | 8 ++++---- core/php/AbeilleParser.php | 6 +++--- plugin_info/install.php | 13 +++++++++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/core/class/Abeille.class.php b/core/class/Abeille.class.php index f3aabea1d7..ee6f980c39 100644 --- a/core/class/Abeille.class.php +++ b/core/class/Abeille.class.php @@ -3018,10 +3018,10 @@ public static function createDevice($action, $dev) { $eqLogic->setConfiguration('ab::tuyaEF00', null); // Xiaomi specific infos: OBSOLETE soon. Replaced by 'fromDevice' - if (isset($model['xiaomi'])) - $eqLogic->setConfiguration('ab::xiaomi', $model['xiaomi']); - else - $eqLogic->setConfiguration('ab::xiaomi', null); + // if (isset($model['xiaomi'])) + // $eqLogic->setConfiguration('ab::xiaomi', $model['xiaomi']); + // else + // $eqLogic->setConfiguration('ab::xiaomi', null); // Zigbee & customization from model $zigbee = $eqLogic->getConfiguration('ab::zigbee', []); diff --git a/core/php/AbeilleParser.php b/core/php/AbeilleParser.php index e41361dab9..b9fc230d74 100644 --- a/core/php/AbeilleParser.php +++ b/core/php/AbeilleParser.php @@ -369,8 +369,8 @@ function updateDeviceFromDB($eqId) { unset($GLOBALS['eqList'][$net][$addr]['fromDevice']); $eq['tuyaEF00'] = $eqLogic->getConfiguration('ab::tuyaEF00', null); // OBSOLETE soon. Replaced by 'private' parserLog('debug', " 'tuyaEF00' updated to ".json_encode($eq['tuyaEF00'])); // OBSOLETE soon. Replaced by 'private' - $eq['xiaomi'] = $eqLogic->getConfiguration('ab::xiaomi', null); // OBSOLETE soon. Replaced by 'private' - parserLog('debug', " 'xiaomi' updated to ".json_encode($eq['xiaomi'])); // OBSOLETE soon. Replaced by 'private' + // $eq['xiaomi'] = $eqLogic->getConfiguration('ab::xiaomi', null); // OBSOLETE soon. Replaced by 'private' + // parserLog('debug', " 'xiaomi' updated to ".json_encode($eq['xiaomi'])); // OBSOLETE soon. Replaced by 'private' $eq['customization'] = $eqLogic->getConfiguration('ab::customization', null); parserLog('debug', " 'customization' updated to ".json_encode($eq['customization'])); @@ -498,7 +498,7 @@ function signalHandler($signal) { //'private' => // Set if exists in model //'fromDevice' => // Set if exists in model // OBSOLETE soon 'tuyaEF00' => $eqLogic->getConfiguration('ab::tuyaEF00', null), // OBSOLETE soon => replaced by 'private' - 'xiaomi' => $eqLogic->getConfiguration('ab::xiaomi', null), // OBSOLETE soon => replaced by 'private' + // 'xiaomi' => $eqLogic->getConfiguration('ab::xiaomi', null), // OBSOLETE soon => replaced by 'private' // Optional 'notStandard-0400-0000' ); if (isset($eqModel['private'])) diff --git a/plugin_info/install.php b/plugin_info/install.php index 571b7f4448..109bb0735c 100755 --- a/plugin_info/install.php +++ b/plugin_info/install.php @@ -878,6 +878,7 @@ function updateConfigDB() { * - eqLogic DB: Removed 'ab::txAck' for devices not always listening * - eqLogic DB: 'ab::eqModel', sig/id/location renamed to modelSig/modelName/modelSource * - eqLogic DB: 'ab::eqModel', 'forcedByUser' => 'modelForced' + * - eqLogic DB: 'ab::xiaomi' replaced by 'ab::eqModel['private']' + type=xiaomi * - Cmds DB: For 'Online' adding 'repeatEventManagement=always' * - Cmds DB: 'OnOff' cmd replaced by 'cmd-0006' * - Cmds DB: 'OnOffGroup' replaced by 'cmd-0006' @@ -940,6 +941,18 @@ function updateConfigDB() { log::add('Abeille', 'debug', ' '.$eqHName.": 'ab::eqModel' update '${oldK}' to '${newK}"); $saveEqModel = true; } + // ab::xiaomi replaced by ab::eqModel['private'] + type=xiaomi + $xiaomi = $eqLogic->getConfiguration('ab::xiaomi', null); + if ($xiaomi !== null) { + $eqMode['private'] = []; + foreach ($xiaomi['fromDevice'] as $pKey => $pVal) { + $pVal['type'] = "xiaomi"; + $eqModel['private'][$pKey] = $pVal; + } + $eqLogic->setConfiguration('ab::xiaomi', null); + log::add('Abeille', 'debug', ' '.$eqHName.": 'ab::xiaomi' replaced by 'private' entries"); + $saveEqModel = true; + } if ($saveEqModel) { $eqLogic->setConfiguration('ab::eqModel', $eqModel);