nRFCloud, device self-assign to a group

Hello,

I am using nRFCloud with nRF9160 custom board sending data via CoAP.

I have a single firmware on my board, that will behave differently depending on the value of the rotary coded switch that is mounted on the board.

Basically, using the same firmware, my device can be either a temperature sensor, a presence sensor, a light sensor, etc. I call that "device type"

In nRFCloud, I would like to use the group feature, and group my fleet by "device type".

This is doable using the API or the nRFCloud dashboard. However, it would be much easier if this could be done remotely : the device sending the name of the group it want to be in.

Is this possible ? If so, how ? If not, is there any plan to have this feature in the near future ?

Thanks !

Parents Reply
  • Hi Charlie,

    My question concerns the device side.

    Is it possible to implement this from the device side ? If so, how ?

    For example, functions such as nrf_cloud_rest_shadow_device_status_update() will send some device's info to nRFCloud. However, I couldn't find any function that allows setting a group for the device.

    Would nrf_cloud_rest_send_device_message() be the one to use

    Thanks

Children
  • Hi Vincent,

    You can use any https client, including HTTPS Client (nordicsemi.com) to send REST API request.

    Following is the REST API to change device tags. Remember to set CONFIG_HTTPS_HOSTNAME="api.nrfcloud.com" and replace nrf\samples\net\https_client\cert\DigiCertGlobalG2.pem with amazontrust.com/repository/AmazonRootCA1.pem since nRF Cloud is running on top of AWS.

    #define HTTP_HEAD  \
    	"PUT /v1/devices/50363953-3234-4ab4-8025-xxxxxxxxxxxxxx/tags HTTP/1.1\r\n"  \
        "Host: "CONFIG_HTTPS_HOSTNAME"\r\n"  \
    	"Content-Type: application/json\r\n"  \
        "Authorization: Bearer a6a0d3f0fc4fd3b61ab47366772a7dxxxxxxxxxxxxx\r\n"  \
    	"Content-Length: 17\r\n" \
    	"Connection: close\r\n\r\n"\
    	"[\"test3\",\"test4\"]"

    Best regards,

    Charlie

Related