-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Включение/выключение режима разработчика на шлюзах Mijia и Aqara AC Companion. * Ссылка на документацию в About. * Исправлен пример flow-сценария заката. * Добавлено изображение кубика Aqara.
- Loading branch information
1 parent
ee5a5c5
commit be68471
Showing
14 changed files
with
336 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
/* | ||
* @author <[email protected]> | ||
* @copyright 2017-2018 Agaphonov Dmitri aka skysilver <[email protected]> (c) | ||
* @version 1.7b | ||
* @version 1.8b | ||
*/ | ||
|
||
if ($this->owner->name == 'panel') { | ||
|
@@ -221,7 +221,7 @@ | |
elseif ($properties[$i]['TITLE'] == 'limit_hum') $properties[$i]['SDEVICE_TYPE'] = 'sensor_humidity'; | ||
} | ||
} | ||
$out['PROPERTIES'] = $properties; | ||
$out['PROPERTIES'] = $properties; | ||
} | ||
|
||
if ($this->tab == 'gwradio' && (($rec['DEVICE_TYPE'] == 'lumi.gateway.v3') || ($rec['DEVICE_TYPE'] == 'lumi.acpartner.v3'))) { | ||
|
@@ -271,6 +271,18 @@ | |
|
||
} | ||
|
||
if ($this->tab == '' && (($rec['DEVICE_TYPE'] == 'lumi.gateway.v3') || ($rec['DEVICE_TYPE'] == 'lumi.acpartner.v3'))) { | ||
|
||
$lanKey = SQLSelectOne("SELECT VALUE FROM miio_commands WHERE DEVICE_ID='" . $rec['ID'] . "' AND TITLE='lumi_dpf_aes_key'"); | ||
|
||
if (!empty($lanKey) && isset($lanKey['VALUE']) && $lanKey['VALUE'] != '') { | ||
$out['LAN_KEY'] = $lanKey['VALUE']; | ||
} else { | ||
$out['LAN_KEY'] = ''; | ||
} | ||
//$out['LAN_KEY'] = ''; | ||
} | ||
|
||
if ($this->tab == 'help') { | ||
$out['LANG'] = SETTINGS_SITE_LANGUAGE; | ||
if ($rec['DEVICE_TYPE'] != '') { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* @package project | ||
* @author <[email protected]> | ||
* @copyright 2017-2018 Agaphonov Dmitri aka skysilver <[email protected]> (c) | ||
* @version 1.7b | ||
* @version 1.8b | ||
*/ | ||
|
||
define ('MIIO_YEELIGHT_WHITE_BULB_PROPS', 'power,bright,flow_params,flowing'); | ||
|
@@ -636,9 +636,9 @@ function requestStatus($device_id) { | |
* | ||
* @access public | ||
*/ | ||
|
||
function usual(&$out) { | ||
|
||
if ($this->ajax) { | ||
global $op; | ||
if ($op == 'process') { | ||
|
@@ -652,62 +652,73 @@ function usual(&$out) { | |
$this->discover(); | ||
if ($this->config['API_LOG_DEBMES']) DebMes('Periodic search for devices in the network is finished', 'xiaomimiio'); | ||
} else if ($op == 'get_miio_info') { | ||
|
||
$dip = $_GET['dip']; | ||
$dtoken = $_GET['dtoken']; | ||
|
||
header("HTTP/1.0: 200 OK\n"); | ||
header('Content-Type: text/html; charset=utf-8'); | ||
|
||
if (!class_exists('miIO', false)) { | ||
include_once(DIR_MODULES . 'xiaomimiio/lib/miio.class.php'); | ||
} | ||
$this->getConfig(); | ||
|
||
if ($miio_module->config['API_IP']) $bind_ip = $miio_module->config['API_IP']; | ||
else $bind_ip = '0.0.0.0'; | ||
if ($miio_module->config['API_LOG_MIIO']) $miio_debug = true; | ||
else $miio_debug = false; | ||
|
||
$dev = new miIO($dip, $bind_ip, $dtoken, $miio_debug); | ||
|
||
if ($dev->getInfo(time())) { | ||
if ($dev->data == '') $info = 'Сведения miIO.info не получены. Вероятно, указан неверный токен.'; | ||
else $info = $dev->data; | ||
} else $info = 'Что-то пошло не так...'; | ||
|
||
echo $info; | ||
exit; | ||
} else if ($op == 'test_api_cmd') { | ||
|
||
$dip = $_GET['dip']; | ||
$dtoken = $_GET['dtoken']; | ||
$cmd = $_GET['dcmd']; | ||
$opt = $_GET['dopt']; | ||
|
||
header("HTTP/1.0: 200 OK\n"); | ||
header('Content-Type: text/html; charset=utf-8'); | ||
|
||
if (!class_exists('miIO', false)) { | ||
include_once(DIR_MODULES . 'xiaomimiio/lib/miio.class.php'); | ||
} | ||
$this->getConfig(); | ||
|
||
if ($miio_module->config['API_IP']) $bind_ip = $miio_module->config['API_IP']; | ||
else $bind_ip = '0.0.0.0'; | ||
if ($miio_module->config['API_LOG_MIIO']) $miio_debug = true; | ||
else $miio_debug = false; | ||
|
||
$dev = new miIO($dip, $bind_ip, $dtoken, $miio_debug); | ||
|
||
if ($dev->msgSendRcv($cmd, $opt, time())) { | ||
if ($dev->data == '') $info = 'Результат выполнения команды не получен. Вероятно, указан неверный токен.'; | ||
else $info = $dev->data; | ||
} else $info = 'Что-то пошло не так...'; | ||
|
||
echo $info; | ||
exit; | ||
} | ||
} else if ($op == 'prop_update') { | ||
$did = $_GET['did']; | ||
$this->requestStatus($did); | ||
if ($this->config['API_LOG_DEBMES']) DebMes('Manual update the properties of the device ' . $did, 'xiaomimiio'); | ||
} else if ($op == 'single_prop_update') { | ||
$did = $_GET['did']; | ||
$cmd = $_GET['dcmd']; | ||
$opt = $_GET['dopt']; | ||
$this->addToQueue($did, $cmd, $opt); | ||
$this->getConfig(); | ||
if ($this->config['API_LOG_DEBMES']) DebMes('Manual update the one propertie ' . $cmd . 'of the device ' . $did, 'xiaomimiio'); | ||
} | ||
echo 'OK'; | ||
exit; | ||
} | ||
|
@@ -1081,7 +1092,12 @@ function processMessage($message, $command, $device_id) { | |
|
||
$data = json_decode($message, true); | ||
|
||
if ($command == 'discover_all') { | ||
if (isset($data['error']) && $data['error'] == 'Device not answered') { | ||
if ($device['ID']) { | ||
$res_commands[] = array('command' => 'online', 'value' => 0); | ||
$res_commands[] = array('command' => 'message', 'value' => $message); | ||
} | ||
} elseif ($command == 'discover_all') { | ||
if (is_array($data['devices'])) { | ||
foreach($data['devices'] as $dev) { | ||
$dev = json_decode($dev, true); | ||
|
@@ -1349,18 +1365,18 @@ function processMessage($message, $command, $device_id) { | |
$res_commands[] = array('command' => 'rel_time', 'value' => $data['result'][2]); | ||
} | ||
} | ||
|
||
foreach ($res_commands as $c) { | ||
$cmd = $c['command']; | ||
$val = $c['value']; | ||
if ($cmd == 'power' || $cmd == 'wifi_led' || $cmd == 'buzzer' || $cmd == 'led' || $cmd == 'child_lock'|| $cmd == 'dry') { | ||
if ($val == 'on') $val = 1; | ||
else if ($val == 'off') $val = 0; | ||
} | ||
$this->processCommand($device['ID'], $cmd, $val); | ||
} | ||
|
||
} | ||
foreach ($res_commands as $c) { | ||
$cmd = $c['command']; | ||
$val = $c['value']; | ||
if ($cmd == 'power' || $cmd == 'wifi_led' || $cmd == 'buzzer' || $cmd == 'led' || $cmd == 'child_lock'|| $cmd == 'dry') { | ||
if ($val == 'on') $val = 1; | ||
else if ($val == 'off') $val = 0; | ||
} | ||
$this->processCommand($device['ID'], $cmd, $val); | ||
} | ||
|
||
} | ||
|
||
/** | ||
* Install | ||
|
Oops, something went wrong.