去除web后台没数据时的默认值,修复hass中重启按钮按了以后 同一mqtt服务中的所有插座都重启的问题

This commit is contained in:
nhkefus
2025-04-28 16:11:35 +08:00
parent 5eecfefc74
commit eaf8f5bf60
2 changed files with 11 additions and 23 deletions

View File

@@ -438,20 +438,6 @@
<th>循环</th>
<th>操作</th>
</tr>
<tr>
<td>02-15 07:11</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td><a>删除</a></td>
</tr>
<tr>
<td>2020-02-15<br>07:11:08</td>
<td>1</td>
<td>0</td>
<td>6</td>
<td><a>删除</a></td>
</tr>
</table>
</div>
@@ -610,23 +596,23 @@
<table class="mdl-data-table mdl-js-data-table">
<tr>
<th>版本</th>
<th id="info_version">v1.0.33</th>
<th id="info_version"></th>
</tr>
<tr>
<td>IP</td>
<td id="info_ip">192.168.33.222</td>
<td id="info_ip"></td>
</tr>
<tr>
<td>子网掩码</td>
<td id="info_mask">255.255.255.0</td>
<td id="info_mask"></td>
</tr>
<tr>
<td>网关</td>
<td id="info_gateway">192.168.33.1</td>
<td id="info_gateway"></td>
</tr>
<tr>
<td>启动时间</td>
<td id="uptime">10:13:43</td>
<td id="uptime"></td>
</tr>
</table>
<div class="mdl-card__actions mdl-card--border" style="display: flex; align-items: center; flex-wrap: wrap;">
@@ -638,7 +624,7 @@
</svg>
</i>
<!-- <span>2020-02-22</span> -->
<a class="mdl-button" id="st-date">2020-02-22</a>
<a class="mdl-button" id="st-date"></a>
</div>
</div>

View File

@@ -471,7 +471,9 @@ void ProcessHaCmd(char *cmd) {
childLockEnabled = on;
UserMqttSendChildLockState();
mico_system_context_update(sys_config);
}else if (strcmp(cmd, "reboot") == 0) {
}else if (strcmp(cmd, "reboot") == ' ') {
sscanf(cmd, "reboot %s", mac);
if (strcmp(mac, str_mac)) return;
MicoSystemReboot(); // 立即重启设备
}
}
@@ -626,13 +628,13 @@ void UserMqttHassAutoRebootButton(void) {
"\"uniq_id\":\"tc1_%s_reboot\","
"\"object_id\":\"tc1_%s_reboot\","
"\"cmd_t\":\"device/ztc1/set\","
"\"pl_prs\":\"reboot\","
"\"pl_prs\":\"reboot %s\","
"\"device\":{"
"\"identifiers\":[\"tc1_%s\"],"
"\"name\":\"%s\","
"\"model\":\"TC1\","
"\"manufacturer\":\"PHICOMM\"}}",
str_mac,str_mac,str_mac, sys_config->micoSystemConfig.name);
str_mac,str_mac,str_mac,str_mac, sys_config->micoSystemConfig.name);
UserMqttSendTopic(topic_buf, send_buf, 1);
}
if (send_buf) free(send_buf);