mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-16 15:08:15 +08:00
后台支持设备重命名
This commit is contained in:
@@ -543,12 +543,12 @@ void UserMqttHassAuto(char socket_id) {
|
||||
"\"pl_off\":\"set socket %s %d 0\","
|
||||
"\"device\":{"
|
||||
"\"identifiers\":[\"tc1_%s\"],"
|
||||
"\"name\":\"TC1\","
|
||||
"\"name\":\"%s\","
|
||||
"\"model\":\"TC1\","
|
||||
"\"manufacturer\":\"PHICOMM\"}}",
|
||||
user_config->socket_names[(int)socket_id], str_mac, socket_id,str_mac, socket_id, str_mac, socket_id,
|
||||
str_mac,
|
||||
socket_id, str_mac, socket_id, str_mac);
|
||||
socket_id, str_mac, socket_id, str_mac,sys_config->micoSystemConfig.name);
|
||||
UserMqttSendTopic(topic_buf, send_buf, 1);
|
||||
}
|
||||
if (send_buf)
|
||||
@@ -574,10 +574,10 @@ void UserMqttHassAutoLed(void) {
|
||||
"\"pl_off\":\"set led %s 0\","
|
||||
"\"device\":{"
|
||||
"\"identifiers\":[\"tc1_%s\"],"
|
||||
"\"name\":\"TC1\","
|
||||
"\"name\":\"%s\","
|
||||
"\"model\":\"TC1\","
|
||||
"\"manufacturer\":\"PHICOMM\"}}",
|
||||
str_mac,str_mac,str_mac, str_mac, str_mac, str_mac);
|
||||
str_mac,str_mac,str_mac, str_mac, str_mac, str_mac,sys_config->micoSystemConfig.name);
|
||||
UserMqttSendTopic(topic_buf, send_buf, 1);
|
||||
}
|
||||
if (send_buf)
|
||||
@@ -603,10 +603,10 @@ void UserMqttHassAutoChildLock(void) {
|
||||
"\"pl_off\":\"set childLock %s 0\","
|
||||
"\"device\":{"
|
||||
"\"identifiers\":[\"tc1_%s\"],"
|
||||
"\"name\":\"TC1\","
|
||||
"\"name\":\"%s\","
|
||||
"\"model\":\"TC1\","
|
||||
"\"manufacturer\":\"PHICOMM\"}}",
|
||||
str_mac,str_mac,str_mac, str_mac, str_mac, str_mac);
|
||||
str_mac,str_mac,str_mac, str_mac, str_mac, str_mac,sys_config->micoSystemConfig.name);
|
||||
UserMqttSendTopic(topic_buf, send_buf, 1);
|
||||
}
|
||||
if (send_buf)
|
||||
@@ -632,10 +632,10 @@ void UserMqttHassAutoTotalSocket(void) {
|
||||
"\"pl_off\":\"set total_socket %s 0\","
|
||||
"\"device\":{"
|
||||
"\"identifiers\":[\"tc1_%s\"],"
|
||||
"\"name\":\"TC1\","
|
||||
"\"name\":\"%s\","
|
||||
"\"model\":\"TC1\","
|
||||
"\"manufacturer\":\"PHICOMM\"}}",
|
||||
str_mac, str_mac, str_mac, str_mac, str_mac, str_mac);
|
||||
str_mac, str_mac, str_mac, str_mac, str_mac, str_mac,sys_config->micoSystemConfig.name);
|
||||
UserMqttSendTopic(topic_buf, send_buf, 1);
|
||||
}
|
||||
if (send_buf)
|
||||
@@ -661,10 +661,10 @@ void UserMqttHassAutoPower(void) {
|
||||
"\"icon\":\"mdi:gauge\","
|
||||
"\"value_template\":\"{{ value_json.power }}\",""\"device\":{"
|
||||
"\"identifiers\":[\"tc1_%s\"],"
|
||||
"\"name\":\"TC1\","
|
||||
"\"name\":\"%s\","
|
||||
"\"model\":\"TC1\","
|
||||
"\"manufacturer\":\"PHICOMM\"}}",
|
||||
str_mac,str_mac, str_mac, str_mac);
|
||||
str_mac,str_mac, str_mac, str_mac,sys_config->micoSystemConfig.name);
|
||||
UserMqttSendTopic(topic_buf, send_buf, 1);
|
||||
sprintf(topic_buf, "homeassistant/sensor/%s/powerConsumption/config", str_mac);
|
||||
sprintf(send_buf,
|
||||
@@ -676,10 +676,10 @@ void UserMqttHassAutoPower(void) {
|
||||
"\"icon\":\"mdi:fence-electric\","
|
||||
"\"value_template\":\"{{ value_json.powerConsumption }}\",""\"device\":{"
|
||||
"\"identifiers\":[\"tc1_%s\"],"
|
||||
"\"name\":\"TC1\","
|
||||
"\"name\":\"%s\","
|
||||
"\"model\":\"TC1\","
|
||||
"\"manufacturer\":\"PHICOMM\"}}",
|
||||
str_mac, str_mac, str_mac, str_mac);
|
||||
str_mac, str_mac, str_mac, str_mac,sys_config->micoSystemConfig.name);
|
||||
UserMqttSendTopic(topic_buf, send_buf, 1);
|
||||
|
||||
sprintf(topic_buf, "homeassistant/sensor/%s/powerConsumptionToday/config", str_mac);
|
||||
@@ -692,10 +692,10 @@ void UserMqttHassAutoPower(void) {
|
||||
"\"icon\":\"mdi:fence-electric\","
|
||||
"\"value_template\":\"{{ value_json.powerConsumptionToday }}\",""\"device\":{"
|
||||
"\"identifiers\":[\"tc1_%s\"],"
|
||||
"\"name\":\"TC1\","
|
||||
"\"name\":\"%s\","
|
||||
"\"model\":\"TC1\","
|
||||
"\"manufacturer\":\"PHICOMM\"}}",
|
||||
str_mac,str_mac, str_mac, str_mac);
|
||||
str_mac,str_mac, str_mac, str_mac,sys_config->micoSystemConfig.name);
|
||||
UserMqttSendTopic(topic_buf, send_buf, 1);
|
||||
|
||||
sprintf(topic_buf, "homeassistant/sensor/%s/powerConsumptionYesterday/config", str_mac);
|
||||
@@ -708,10 +708,10 @@ void UserMqttHassAutoPower(void) {
|
||||
"\"icon\":\"mdi:fence-electric\","
|
||||
"\"value_template\":\"{{ value_json.powerConsumptionYesterday }}\",""\"device\":{"
|
||||
"\"identifiers\":[\"tc1_%s\"],"
|
||||
"\"name\":\"TC1\","
|
||||
"\"name\":\"%s\","
|
||||
"\"model\":\"TC1\","
|
||||
"\"manufacturer\":\"PHICOMM\"}}",
|
||||
str_mac,str_mac, str_mac, str_mac);
|
||||
str_mac,str_mac, str_mac, str_mac,sys_config->micoSystemConfig.name);
|
||||
UserMqttSendTopic(topic_buf, send_buf, 1);
|
||||
}
|
||||
if (send_buf) free(send_buf);
|
||||
|
||||
Reference in New Issue
Block a user