add:插口名称与hass设备名称同步

add:配对信息中增加ip内容
fix:尝试修复app无法获取配对结果的问题
This commit is contained in:
Zip
2019-03-29 09:53:44 +08:00
parent 04a8cded7e
commit a5d6eec84b
6 changed files with 13 additions and 4 deletions

View File

@@ -145,12 +145,12 @@ int application_start( void )
// }
wifi_init( );
user_udp_init( );
key_init( );
err = user_mqtt_init( );
require_noerr( err, exit );
err = user_rtc_init( );
require_noerr( err, exit );
user_udp_init( );
// user_power_init();
while ( 1 )
{

View File

@@ -52,6 +52,11 @@ void user_function_cmd_received( int udp_flag, uint8_t *pusrdata )
cJSON_AddStringToObject( pRoot, "mac", strMac );
cJSON_AddNumberToObject( pRoot, "type", TYPE );
cJSON_AddStringToObject( pRoot, "type_name", TYPE_NAME );
IPStatusTypedef para;
micoWlanGetIPStatus( &para, Station );
cJSON_AddStringToObject( pRoot, "ip", para.ip );
char *s = cJSON_Print( pRoot );
// os_log( "pRoot: %s\r\n", s );
user_send( udp_flag, s ); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@@ -227,6 +232,7 @@ bool json_plug_analysis( int udp_flag, unsigned char x, cJSON * pJsonRoot, cJSON
{
return_flag = true;
sprintf( user_config->plug[x].name, p_plug_setting_name->valuestring );
user_mqtt_hass_auto(x);
}
cJSON_AddStringToObject( json_plug_setting_send, "name", user_config->plug[x].name );
}

View File

@@ -9,11 +9,13 @@
static void ota_server_status_handler( OTA_STATE_E state, float progress )
{
char str[64]={0};
char str[64] = { 0 };
switch ( state )
{
case OTA_LOADING:
os_log("ota server is loading, progress %.2f%%", progress);
// if ( (int) progress == progress )
// sprintf( str, "{\"mac\":\"%s\",\"ota_progress\":%d}", strMac,(int) progress );
break;
case OTA_SUCCE:
os_log("ota server daemons success");
@@ -26,9 +28,9 @@ static void ota_server_status_handler( OTA_STATE_E state, float progress )
default:
break;
}
if(str[0]>0)
if ( str[0] > 0 )
{
user_send(true,str);
user_send( true, str );
}
}

View File

@@ -64,6 +64,7 @@ static void wifi_get_ip_callback( IPStatusTypedef *pnet, void * arg )
{
os_log("got IP:%s", pnet->ip);
wifi_status = WIFI_STATE_CONNECTED;
user_function_cmd_received(1,"{\"cmd\":\"device report\"}");
}
//wifi<66><69><EFBFBD><EFBFBD>״̬<D7B4>ı<EFBFBD><C4B1>ص<EFBFBD>
static void wifi_status_callback( WiFiEvent status, void *arg )