espressif / esp-rainmaker

ESP RainMaker Agent for firmware development
Apache License 2.0
453 stars 152 forks source link

Problem with delete device from node (MEGH-3737) #157

Closed jacek12345 closed 2 years ago

jacek12345 commented 2 years ago

I try to delete device from node:

    err = esp_rmaker_node_remove_device(node, sensor_device[sensnum]);
    if(!err)
    {
        err = esp_rmaker_device_delete(sensor_device[sensnum]);
        if(!err)
        {
            dev_map[sensnum]=0xFF;
            sensor_device[sensnum]=NULL; 
        }
        else
            ESP_LOGE(TAG, "esp_rmaker_device_delete() failed: %u", err);

    }
    else
        ESP_LOGE(TAG, "esp_rmaker_node_remove_device() failed: %u", err);

Am I doing something wrong? After that it deletes from iOS app (need to refresh), but ONLY if there is local control enabled. If it is disabled in menuconfig, device remains in mobile app. The second problem, even when local control enabled and device dissapeared, it backs to app on each refresh (when "Reachable on WLAN" message dissapear) and stay there for the moment when message comeback.

https://user-images.githubusercontent.com/34368502/183582250-d8d6f97d-ab43-45cf-b283-1d0111b3bb1b.MP4

Suspected iOS app related issue, but uninstalled app, restarted phone, installed again and deleted device still remains (each time when "Reachable on WLAN" message dissapear). So think, that it is not (or not only) iOS app related.

shahpiyushv commented 2 years ago

After adding or removing a device or params, please call the esp_rmaker_report_node_details() API to report updated data to cloud.

jacek12345 commented 2 years ago

Thank You for help, it works now.