Skip to content

Commit

Permalink
samples: net: azure_iot_hub: Reword log messages for device twin
Browse files Browse the repository at this point in the history
* Reduce log level to DBG for the message logged when a
  `telemetryInterval` object is not found in the incoming device
  twin document. This is a common occurrence and the log message
  is confusing when for instance receiveing FOTA metadata.

* Add DBG level log message for when the incoming device twin
  document contains only a `desired` object.

Signed-off-by: Jan Tore Guggedal <[email protected]>
  • Loading branch information
jtguggedal authored and jfischer-no committed Feb 22, 2024
1 parent eef7486 commit 94e2c1c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion samples/net/azure_iot_hub/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,17 @@ static int event_interval_get(char *buf)
*/
desired_obj = cJSON_GetObjectItem(root_obj, "desired");
if (desired_obj == NULL) {
LOG_DBG("Incoming device twin document contains only the 'desired' object");

desired_obj = root_obj;
}

/* Update only recognized properties. */
event_interval_obj = cJSON_GetObjectItem(desired_obj,
"telemetryInterval");
if (event_interval_obj == NULL) {
LOG_INF("No 'telemetryInterval' object in the device twin");
LOG_DBG("No 'telemetryInterval' object found in the device twin document");

goto clean_exit;
}

Expand Down

0 comments on commit 94e2c1c

Please sign in to comment.