Skip to content

Commit

Permalink
All xiaomi now supported thru model 'private' entry
Browse files Browse the repository at this point in the history
  • Loading branch information
tcharp38 committed Dec 5, 2023
1 parent 51cd502 commit 1da5b9e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
8 changes: 4 additions & 4 deletions core/class/Abeille.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', []);
Expand Down
6 changes: 3 additions & 3 deletions core/php/AbeilleParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']));
Expand Down Expand Up @@ -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']))
Expand Down
13 changes: 13 additions & 0 deletions plugin_info/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1da5b9e

Please sign in to comment.