Skip to content

Commit

Permalink
Merge branch 'support/insights_cmd_resp' into 'master'
Browse files Browse the repository at this point in the history
Enable Insights command response module

See merge request app-frameworks/esp-rainmaker!447
  • Loading branch information
shahpiyushv committed Aug 22, 2024
2 parents 082f5e3 + 3e375f4 commit e62c52a
Show file tree
Hide file tree
Showing 17 changed files with 68 additions and 6 deletions.
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changes

## 7-Aug-2024: Enabled ESP-Insights command response feature
- With ESP-Insights updated to the newer component, the command response feature from rainmaker can be used.
- To use the same, in addition to enabling esp-insights, please set below option from menuconfig:
```bash
CONFIG_ESP_INSIGHTS_CMD_RESP_ENABLED=y
```
- More info on this can be found [here](https://github.com/espressif/esp-insights/blob/main/FEATURES.md#command-response).

## 18-Jul-2024: Use network_provsioning for ESP-IDF v5.1 or later to support RainMaker over Thread
- The network_provisioning component can be used for provisioning both Wi-Fi or Thread devices. It also stays backward capabitable with wifi_provisioning component.

Expand Down
2 changes: 1 addition & 1 deletion components/esp-insights
Submodule esp-insights updated 41 files
+189 −37 .gitlab-ci.yml
+29 −0 CHANGELOG.md
+7 −2 FEATURES.md
+6 −0 components/esp_diag_data_store/Kconfig
+1 −2 components/esp_diag_data_store/src/rtc_store/rtc_store.c
+0 −1 components/esp_diag_data_store/src/rtc_store/rtc_store.h
+8 −39 components/esp_diag_data_store/test/python_tests/stress_tests.py
+4 −2 components/esp_diagnostics/CMakeLists.txt
+1 −1 components/esp_diagnostics/idf_component.yml
+10 −1 components/esp_diagnostics/include/esp_diagnostics.h
+125 −18 components/esp_diagnostics/include/esp_diagnostics_metrics.h
+141 −9 components/esp_diagnostics/include/esp_diagnostics_variables.h
+70 −4 components/esp_diagnostics/src/esp_diagnostics_heap_metrics.c
+139 −12 components/esp_diagnostics/src/esp_diagnostics_metrics.c
+90 −2 components/esp_diagnostics/src/esp_diagnostics_network_variables.c
+1 −0 components/esp_diagnostics/src/esp_diagnostics_utils.c
+130 −12 components/esp_diagnostics/src/esp_diagnostics_variables.c
+45 −1 components/esp_diagnostics/src/esp_diagnostics_wifi_metrics.c
+1 −0 components/esp_insights/CMakeLists.txt
+17 −0 components/esp_insights/Kconfig
+2 −2 components/esp_insights/idf_component.yml
+48 −0 components/esp_insights/include/esp_insights.h
+152 −18 components/esp_insights/src/esp_insights.c
+99 −0 components/esp_insights/src/esp_insights_cbor_decoder.c
+24 −0 components/esp_insights/src/esp_insights_cbor_decoder.h
+238 −10 components/esp_insights/src/esp_insights_cbor_encoder.c
+39 −0 components/esp_insights/src/esp_insights_cbor_encoder.h
+679 −0 components/esp_insights/src/esp_insights_cmd_resp.c
+55 −1 components/esp_insights/src/esp_insights_encoder.c
+1 −1 components/esp_insights/src/esp_insights_encoder.h
+11 −0 components/esp_insights/src/esp_insights_internal.h
+11 −1 components/esp_insights/src/transport/esp_insights_mqtt.c
+1 −1 components/rmaker_common
+1 −1 examples/diagnostics_smoke_test/main/idf_component.yml
+2 −2 examples/diagnostics_smoke_test/partitions.csv
+4 −0 examples/diagnostics_smoke_test/sdkconfig.ci
+1 −0 examples/diagnostics_smoke_test/sdkconfig.defaults
+1 −1 examples/minimal_diagnostics/main/idf_component.yml
+2 −2 examples/minimal_diagnostics/partitions.csv
+8 −0 examples/minimal_diagnostics/sdkconfig.ci
+1 −0 examples/minimal_diagnostics/sdkconfig.defaults
10 changes: 8 additions & 2 deletions examples/common/app_insights/app_insights.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#define APP_INSIGHTS_LOG_TYPE ESP_DIAG_LOG_TYPE_ERROR
#endif /* CONFIG_APP_INSIGHTS_ENABLE_LOG_TYPE_ALL */

esp_err_t esp_insights_enable(esp_insights_config_t *config);

#define INSIGHTS_TOPIC_SUFFIX "diagnostics/from-node"
#define INSIGHTS_TOPIC_RULE "insights_message_delivery"

Expand Down Expand Up @@ -80,6 +78,9 @@ static void rmaker_common_event_handler(void* arg, esp_event_base_t event_base,
esp_err_t app_insights_enable(void)
{
#ifdef CONFIG_ESP_INSIGHTS_ENABLED
#ifndef CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT
ESP_LOGE(TAG, "Please select the CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT option from menuconfig");
#endif
/* Initialize the event loop, if not done already. */
esp_err_t err = esp_event_loop_create_default();
/* If the default event loop is already initialized, we get ESP_ERR_INVALID_STATE */
Expand Down Expand Up @@ -108,7 +109,12 @@ esp_err_t app_insights_enable(void)
.node_id = node_id,
.alloc_ext_ram = true,
};

esp_insights_enable(&config);

if (esp_insights_cmd_resp_enable()!= ESP_OK) {
ESP_LOGE(TAG, "Failed to enabled insights command response");
}
#else
ESP_LOGI(TAG, "Enable CONFIG_ESP_INSIGHTS_ENABLED to get Insights.");
#endif /* ! CONFIG_ESP_INSIGHTS_ENABLED */
Expand Down
4 changes: 2 additions & 2 deletions examples/common/app_insights/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## IDF Component Manager Manifest File
dependencies:
espressif/esp_rainmaker:
version: "~=1.0"
version: ">=1.0"
override_path: '../../../components/esp_rainmaker/'
espressif/esp_insights:
version: "~1.0.1"
version: "~1.2.0"
override_path: '../../../components/esp-insights/components/esp_insights/'
4 changes: 4 additions & 0 deletions examples/fan/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ CONFIG_ESP_RMAKER_LOCAL_CTRL_SECURITY_1=y

# Application Rollback
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y

# If ESP-Insights is enabled, we need MQTT transport selected
# Takes out manual efforts to enable this option
CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT=y
4 changes: 4 additions & 0 deletions examples/gpio/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ CONFIG_ESP_RMAKER_LOCAL_CTRL_SECURITY_1=y

# Application Rollback
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y

# If ESP-Insights is enabled, we need MQTT transport selected
# Takes out manual efforts to enable this option
CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT=y
4 changes: 4 additions & 0 deletions examples/homekit_switch/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y

# Change default log level to reduce binary size
CONFIG_LOG_DEFAULT_LEVEL_WARN=y

# If ESP-Insights is enabled, we need MQTT transport selected
# Takes out manual efforts to enable this option
CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT=y
4 changes: 4 additions & 0 deletions examples/led_light/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ CONFIG_ESP_RMAKER_LOCAL_CTRL_SECURITY_1=y

# Application Rollback
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y

# If ESP-Insights is enabled, we need MQTT transport selected
# Takes out manual efforts to enable this option
CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT=y
4 changes: 4 additions & 0 deletions examples/matter/matter_controller/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,7 @@ CONFIG_LWIP_IPV6_NUM_ADDRESSES=6
CONFIG_ESP_MATTER_ATTRIBUTE_BUFFER_LARGEST=2050

CONFIG_ESP_MATTER_CONTROLLER_CUSTOM_CLUSTER_ENABLE=y

# If ESP-Insights is enabled, we need MQTT transport selected
# Takes out manual efforts to enable this option
CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT=y
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,7 @@ CONFIG_BSP_BOARD_ESP32_S3_BOX_3=y

# Enable custom commission data to use dynamic qrcode
CONFIG_CUSTOM_COMMISSIONABLE_DATA_PROVIDER=y

# If ESP-Insights is enabled, we need MQTT transport selected
# Takes out manual efforts to enable this option
CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT=y
4 changes: 4 additions & 0 deletions examples/matter/matter_light/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ CONFIG_ESP_MATTER_NVS_USE_COMPACT_ATTR_STORAGE=y
# Increase LwIP IPv6 address number to 6 (MAX_FABRIC + 1)
# unique local addresses for fabrics(MAX_FABRIC), a link local address(1)
CONFIG_LWIP_IPV6_NUM_ADDRESSES=6

# If ESP-Insights is enabled, we need MQTT transport selected
# Takes out manual efforts to enable this option
CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT=y
4 changes: 4 additions & 0 deletions examples/matter/matter_switch/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ CONFIG_ESP_MATTER_NVS_USE_COMPACT_ATTR_STORAGE=y
# Increase LwIP IPv6 address number to 6 (MAX_FABRIC + 1)
# unique local addresses for fabrics(MAX_FABRIC), a link local address(1)
CONFIG_LWIP_IPV6_NUM_ADDRESSES=6

# If ESP-Insights is enabled, we need MQTT transport selected
# Takes out manual efforts to enable this option
CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT=y
4 changes: 4 additions & 0 deletions examples/multi_device/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ CONFIG_ESP_RMAKER_LOCAL_CTRL_SECURITY_1=y

# Application Rollback
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y

# If ESP-Insights is enabled, we need MQTT transport selected
# Takes out manual efforts to enable this option
CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT=y
4 changes: 4 additions & 0 deletions examples/switch/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ CONFIG_ESP_RMAKER_LOCAL_CTRL_SECURITY_1=y

# Application Rollback
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y

# If ESP-Insights is enabled, we need MQTT transport selected
# Takes out manual efforts to enable this option
CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT=y
4 changes: 4 additions & 0 deletions examples/temperature_sensor/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ CONFIG_ESP_RMAKER_LOCAL_CTRL_SECURITY_1=y

# Application Rollback
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y

# If ESP-Insights is enabled, we need MQTT transport selected
# Takes out manual efforts to enable this option
CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT=y
4 changes: 4 additions & 0 deletions examples/zigbee_gateway/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,7 @@ CONFIG_PIN_TO_RCP_RX=18
#
CONFIG_IEEE802154_RECEIVE_DONE_HANDLER=y
# end of IEEE802154

# If ESP-Insights is enabled, we need MQTT transport selected
# Takes out manual efforts to enable this option
CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT=y

0 comments on commit e62c52a

Please sign in to comment.