Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zhimi.heater.mc2 #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions modules/xiaomimiio/xiaomimiio.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,21 @@ function requestStatus($device_id)
array('did' => 'temperature', 'siid' => 5, 'piid' => 8)
);
$this->addToQueue($device_id, 'get_properties', json_encode($props));
} elseif ($device_rec['DEVICE_TYPE'] == 'zhimi.heater.mc2') {
$props = array(
array('did' => 'power', 'siid' => 2, 'piid' => 1),
array('did' => 'fault', 'siid' => 2, 'piid' => 2),
array('did' => 'target_temperature', 'siid' => 2, 'piid' => 5),
array('did' => 'buzzer', 'siid' => 6, 'piid' => 1),
array('did' => 'led', 'siid' => 7, 'piid' => 3),
array('did' => 'child_lock', 'siid' => 5, 'piid' => 1),
array('did' => 'countdown_time', 'siid' => 3, 'piid' => 1),
//array('did' => 'use_time', 'siid' => 8, 'piid' => 9),
//array('did' => 'button', 'siid' => 8, 'piid' => 1),
array('did' => 'temperature', 'siid' => 4, 'piid' => 7)
);
$this->addToQueue($device_id, 'get_properties', json_encode($props));

} elseif ($device_rec['DEVICE_TYPE'] == 'xiaomi.repeater.v6') {
// https://home.miot-spec.com/spec/xiaomi.repeater.v6
} elseif ($device_rec['DEVICE_TYPE'] == 'isa.camera.hlc7') {
Expand Down Expand Up @@ -2029,6 +2044,33 @@ function propertySetHandle($object, $property, $value)
}
//zhimi.heater.zb1a
}
if ($properties[$i]['DEVICE_TYPE'] == 'zhimi.heater.mc2') {
if ($properties[$i]['TITLE'] == 'power') {
$params = '[{"did":"power","siid":2,"piid":1,"value":' . ($value ? 'true' : 'false') . '}]';
$this->addToQueue($properties[$i]['DEVICE_ID'], 'set_properties', $params);
} elseif ($properties[$i]['TITLE'] == 'target_temperature') {
if ($value < 18) $value = 18;
if ($value > 28) $value = 28;
$params = '[{"did":"target_temperature","siid":2,"piid":5,"value":' . $value . '}]';
$this->addToQueue($properties[$i]['DEVICE_ID'], 'set_properties', $params);
} elseif ($properties[$i]['TITLE'] == 'buzzer') {
$params = '[{"did":"buzzer","siid":6,"piid":1,"value":' . ($value ? 'true' : 'false') . '}]';
$this->addToQueue($properties[$i]['DEVICE_ID'], 'set_properties', $params);
} elseif ($properties[$i]['TITLE'] == 'led') {
$params = '[{"did":"led","siid":7,"piid":3,"value":' . ($value ? 'true' : 'false') . '}]';
$this->addToQueue($properties[$i]['DEVICE_ID'], 'set_properties', $params);
} elseif ($properties[$i]['TITLE'] == 'child_lock') {
$params = '[{"did":"child_lock","siid":5,"piid":1,"value":' . ($value ? 'true' : 'false') . '}]';
$this->addToQueue($properties[$i]['DEVICE_ID'], 'set_properties', $params);
} elseif ($properties[$i]['TITLE'] == 'countdown_time') {
if ($value < 0) $value = 0;
if ($value > 12) $value = 12;
$params = '[{"did":"countdown_time","siid":3,"piid":1,"value":' . $value . '}]';
$this->addToQueue($properties[$i]['DEVICE_ID'], 'set_properties', $params);
}
//zhimi.heater.mc2
}

if ($properties[$i]['DEVICE_TYPE'] == 'isa.camera.hlc7') {
if ($properties[$i]['TITLE'] == 'on') {
if ($value) {
Expand Down
53 changes: 53 additions & 0 deletions templates/xiaomimiio/help/ru/help_zhimi.heater.mc2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<br>
<div>
<table border="0" cellpadding="8">
<tr>
<td rowspan="2" style="width:65px">
[#if DEVICE_TYPE!=""#]
<img src="../templates/xiaomimiio/img/small/[#DEVICE_TYPE#].png" height="60px" onError="this.src='../templates/xiaomimiio/img/small/unknown.png'">
[#else#]
<img src="../templates/xiaomimiio/img/small/unknown.png" height="60px">
[#endif#]
</td>
<td style="height:33px;vertical-align:middle"><b>Smartmi Smart Convector Heater 1S (.mc2) </b></td>
<td style="height:33px;vertical-align:middle"> &nbsp; IP: <b>[#IP#]</b></td>
</tr>
<tr>
<td style="height:33px;vertical-align:middle">Модель: <b>[#DEVICE_TYPE#]</b></td>
<td style="height:33px;vertical-align:middle">Системный ID: <span class="badge">[#ID#]</span></td>
</tr>
</table>
</div>
<br>
<div class="panel-group" id="accordion" style="width:98%">
<div class="panel panel-info">
<div class="panel-heading">
<a data-toggle="collapse" data-parent="#accordion" href="#metrics_help">Описание метрик устройства</a>
</div>
<div class="panel-body collapse" id="metrics_help">
<div style="width:800px">
<table class="table table-hover" align="left">
<thead>
<th>Метрика</th><th>Описание</th><th>Значения</th><th nowrap>Чтение/запись</th>
</thead>
<tbody>
<tr><td><b>power</b></td><td>Включение и выключение питания</td><td>0 или 1</td><td nowrap>Чтение и запись</td></tr>
<tr><td><b>temperature</b></td><td>Температура воздуха</td><td>C</td><td>Чтение</td></tr>
<tr><td><b>message</b></td><td>Предыдущая отправленая команда</td><td>Текст</td><td nowrap>Чтение</td></tr>
<tr><td><b>online</b></td><td>Устройство в сети</td><td>0 или 1</td><td nowrap>Чтение</td></tr>
<tr><td><b>fault</b></td><td>Наличие проблемы при работе увлажгителя</td><td>0 или 1</td><td nowrap>Чтение и запись</td></tr>
<tr><td><b>led</b></td><td>Включение выключение подсветки (не всегда работает)</td><td>0 или 1</td><td nowrap>Чтение и запись</td></tr>
<tr><td><b>buzzer</b></td><td>Включение и выключение звукового сигнала</td><td>0 или 1</td><td nowrap>Чтение и запись</td></tr>
<tr><td><b>target_temperature</b></td><td>Температура которую поддерживает обогреватель</td><td>18 - 28 С</td><td nowrap>Чтение и запись</td></tr>
<tr><td><b>countdown_time</b></td><td>Время через которое выключится обогреватель в часах</td><td>0 - 12 ч</td><td nowrap>Чтение и запись</td></tr>
<tr><td><b>child_lock</b></td><td>Блокировка клавиш.</td><td>0 или 1</td><td nowrap>Чтение и запись</td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<br>
<div>
<a href="?data_source=<#DATA_SOURCE#>" class="btn btn-default"><#LANG_STRING_BACK#></a>
</div>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 8 additions & 7 deletions templates/xiaomimiio/miio_devices_edit_default.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@

<option data-content="<img src='../templates/xiaomimiio/img/small/zhimi.airpurifier.v3.png' width='20' height='20'> Mi Air Purifier" value="zhimi.airpurifier.v3" [#if DEVICE_TYPE="zhimi.airpurifier.v3"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/zhimi.airpurifier.ma2.png' width='20' height='20'> Mi Air Purifier 2S" value="zhimi.airpurifier.ma2" [#if DEVICE_TYPE="zhimi.airpurifier.ma2"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/zhimi.airpurifier.mb3.png' width='20' height='20'> Mi Air Purifier 3/3H" value="zhimi.airpurifier.mb3" [#if DEVICE_TYPE="zhimi.airpurifier.mb3"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/zhimi.airpurifier.mb4.png' width='20' height='20'> Mi Air Purifier 3C" value="zhimi.airpurifier.mb4" [#if DEVICE_TYPE="zhimi.airpurifier.mb4"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/zhimi.airpurifier.mb3.png' width='20' height='20'> Mi Air Purifier 3/3H" value="zhimi.airpurifier.mb3" [#if DEVICE_TYPE="zhimi.airpurifier.mb3"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/zhimi.airpurifier.mb4.png' width='20' height='20'> Mi Air Purifier 3C" value="zhimi.airpurifier.mb4" [#if DEVICE_TYPE="zhimi.airpurifier.mb4"#] selected[#endif#]></option>

<option data-content="<img src='../templates/xiaomimiio/img/small/cgllc.airmonitor.b1.png' width='20' height='20'> Mi ClearGrass Air Monitor B1" value="cgllc.airmonitor.b1" [#if DEVICE_TYPE="cgllc.airmonitor.b1"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/cgllc.airmonitor.s1.png' width='20' height='20'> Mi ClearGrass Air Monitor S1" value="cgllc.airmonitor.s1" [#if DEVICE_TYPE="cgllc.airmonitor.s1"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/cgllc.airmonitor.s1.png' width='20' height='20'> Mi ClearGrass Air Monitor S1" value="cgllc.airmonitor.s1" [#if DEVICE_TYPE="cgllc.airmonitor.s1"#] selected[#endif#]></option>

<option data-content="<img src='../templates/xiaomimiio/img/small/chuangmi.ir.v2.png' width='20' height='20'> Mi IR Remote 360" value="chuangmi.ir.v2" [#if DEVICE_TYPE="chuangmi.ir.v2"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/xiaomi.wifispeaker.v1.png' width='20' height='20'> Mi Internet Speaker" value="xiaomi.wifispeaker.v1" [#if DEVICE_TYPE="xiaomi.wifispeaker.v1"#] selected[#endif#]></option>
Expand Down Expand Up @@ -95,9 +95,9 @@

<option data-content="<img src='../templates/xiaomimiio/img/small/roborock.vacuum.s5.png' width='20' height='20'> Mi Roborock S50/S51" value="roborock.vacuum.s5" [#if DEVICE_TYPE="roborock.vacuum.s5"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/rockrobo.vacuum.v1.png' width='20' height='20'> Mi Vacuum Cleaner" value="rockrobo.vacuum.v1" [#if DEVICE_TYPE="rockrobo.vacuum.v1"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/roborock.vacuum.s5.png' width='20' height='20'> Mi Roborock M1S" value="roborock.vacuum.m1s" [#if DEVICE_TYPE="roborock.vacuum.m1s"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/viomi.vacuum.v7.png' width='20' height='20'> Mi Robot Vacuum Mop P" value="viomi.vacuum.v7" [#if DEVICE_TYPE="viomi.vacuum.v7"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/dreame.vacuum.mc1808.png' width='20' height='20'> Mi Robot Vacuum Mop 1C" value="dreame.vacuum.mc1808" [#if DEVICE_TYPE="dreame.vacuum.mc1808"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/roborock.vacuum.s5.png' width='20' height='20'> Mi Roborock M1S" value="roborock.vacuum.m1s" [#if DEVICE_TYPE="roborock.vacuum.m1s"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/viomi.vacuum.v7.png' width='20' height='20'> Mi Robot Vacuum Mop P" value="viomi.vacuum.v7" [#if DEVICE_TYPE="viomi.vacuum.v7"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/dreame.vacuum.mc1808.png' width='20' height='20'> Mi Robot Vacuum Mop 1C" value="dreame.vacuum.mc1808" [#if DEVICE_TYPE="dreame.vacuum.mc1808"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/dreame.vacuum.p2140p.png' width='20' height='20'> Mi Robot Vacuum Mop 2" value="dreame.vacuum.p2140p" [#if DEVICE_TYPE="dreame.vacuum.p2140p"#] selected[#endif#]></option>

<option data-content="<img src='../templates/xiaomimiio/img/small/yunmi.kettle.r1.png' width='20' height='20'> Mi Heating Water Dispenser MINI (R1/R2)" value="yunmi.kettle.r1" [#if DEVICE_TYPE="yunmi.kettle.r1"#] selected[#endif#]></option>
Expand All @@ -111,8 +111,9 @@

<option data-content="<img src='../templates/xiaomimiio/img/small/uvfive.s_lamp.slmap2.png' width='20' height='20'> Mi Five Disinfection Lamp" value="uvfive.s_lamp.slmap2" [#if DEVICE_TYPE="uvfive.s_lamp.slmap2"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/zhimi.heater.zb1a.png' width='20' height='20'> Smartmi Smart Convector Heater 1S" value="zhimi.heater.zb1a" [#if DEVICE_TYPE="zhimi.heater.zb1a"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/zhimi.heater.mc2.png' width='20' height='20'> Smartmi Smart Convector Heater 1S (.mc2)" value="zhimi.heater.mc2" [#if DEVICE_TYPE="zhimi.heater.mc2"#] selected[#endif#]></option>

<option data-content="<img src='../templates/xiaomimiio/img/small/mmgg.pet_waterer.s1.png' width='20' height='20'> Mijia Smart Pet Water Dispenser" value="mmgg.pet_waterer.s1" [#if DEVICE_TYPE="mmgg.pet_waterer.s1"#] selected[#endif#]></option>
<option data-content="<img src='../templates/xiaomimiio/img/small/mmgg.pet_waterer.s1.png' width='20' height='20'> Mijia Smart Pet Water Dispenser" value="mmgg.pet_waterer.s1" [#if DEVICE_TYPE="mmgg.pet_waterer.s1"#] selected[#endif#]></option>
</optgroup>

<optgroup label="Philips">
Expand Down