mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-12 21:18:13 +08:00
web-ha 同步显示插座状态
This commit is contained in:
@@ -167,7 +167,7 @@ exit:
|
||||
static int HttpGetWifiConfig(httpd_request_t *req)
|
||||
{
|
||||
OSStatus err = kNoErr;
|
||||
const unsigned char* status = GetSocketStatus();
|
||||
const unsigned char* status = "???";
|
||||
send_http(status, strlen((char*)status), exit, &err);
|
||||
exit:
|
||||
return err;
|
||||
@@ -243,7 +243,7 @@ static int HttpSetMqttConfig(httpd_request_t *req)
|
||||
require_noerr(err, exit);
|
||||
|
||||
sscanf(buf, "%s %d", MQTT_SERVER, &MQTT_SERVER_PORT);
|
||||
//UserMqttInit();
|
||||
mico_system_context_update(sys_config);
|
||||
|
||||
send_http("OK", 2, exit, &err);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "mico.h"
|
||||
#include "micokit_ext.h"
|
||||
|
||||
#define VERSION "v1.0.3"
|
||||
#define VERSION "v1.0.6"
|
||||
|
||||
#define TYPE 1
|
||||
#define TYPE_NAME "zTC1"
|
||||
|
||||
@@ -215,7 +215,7 @@ bool JsonSocketAnalysis(int udp_flag, unsigned char x, cJSON * pJsonRoot, cJSON
|
||||
if (!pJsonSend) return false;
|
||||
bool return_flag = false;
|
||||
char socket_str[] = "socket_X";
|
||||
socket_str[5] = x + '0';
|
||||
socket_str[7] = x + '0';
|
||||
|
||||
cJSON *p_socket = cJSON_GetObjectItem(pJsonRoot, socket_str);
|
||||
if (!p_socket) return_flag = false;
|
||||
|
||||
@@ -53,6 +53,7 @@ void SetSocketStatus(char* socket_status)
|
||||
for (i = 0; i < SOCKET_NUM; i++)
|
||||
{
|
||||
UserRelaySet(i, ons[i]);
|
||||
UserMqttSendSocketState(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user