78 Commits

Author SHA1 Message Date
Piyush Shah
8ae0a34001 feat(rmaker): Add on-network challenge-response service for user-node mapping
This feature is intended for mapping already-provisioned nodes to user
accounts without re-provisioning.

Common features (both implementations):
- mDNS service: _esp_rmaker_chal_resp._tcp
- TXT records: node_id, port, sec_version, pop_required
- Optional instance name support (NULL uses node_id as default)
- Supports Security 0, 1 (with/without PoP), and 2 (SRP6a)
- Both use the same mDNS service type, simplifying CLI discovery

1. Standalone HTTP protocomm based challenge-response service.

   - Config: CONFIG_ESP_RMAKER_ON_NETWORK_CHAL_RESP_ENABLE
   - Endpoint: ch_resp (on protocomm HTTP server, default port 80)
   - Instance name via config.mdns_instance_name

   APIs:
   - esp_rmaker_on_network_chal_resp_start()
   - esp_rmaker_on_network_chal_resp_stop()
   - esp_rmaker_on_network_chal_resp_is_running()

   Note: Mutually exclusive with Local Control

2. Challenge-response support on local control.

   - Config: CONFIG_ESP_RMAKER_LOCAL_CTRL_CHAL_RESP_ENABLE
   - Endpoint: ch_resp (via esp_local_ctrl_set_handler)
   - Instance name via parameter to enable function

   APIs:
   - esp_rmaker_local_ctrl_enable_chal_resp(instance_name)
   - esp_rmaker_local_ctrl_disable_chal_resp()

3. CLI and console improvements.

   - CLI simplified to discover only _esp_rmaker_chal_resp._tcp service
   - Console command supports optional instance name: chal-resp-enable [instance_name]
   - Device discovery output shows instance name column

Clients can choose to disable the challenge-response endpoint after
usage to avoid potential misuse by other entities on the network.

commit
2026-01-08 19:05:35 +05:30
Piyush Shah
7e2ee79b20 esp_rmaker_groups: Add handling for group ids for direct MQTT messaging
This change allows adding a RainMaker service on which phone apps can
set id of the parent group (group_id) in which the node is added.

Once set, all local params will be reported on
node/<node_id>/params/local/<group_id> instead of node/<node_id>/params/local/

Additionally, application code can use the esp_rmaker_publish_direct()
API to publish any message on node/<node_id>/direct/params/local/<group_id>

Phone apps can subscribe to these topics to get these messages directly
from the MQTT broker

node/+/params/local/<group_id>
node/+/direct/params/local/<group_id>

For local params update, this change just helps to improve the latency
of param reporting.

The direct reporting allows to bypass the cloud side processing to send
messages directly to phone apps at very low cost

Phone apps can also publish param updates directly to node/<node_id>/params/remote/<group_id>
instead of using the set params API.
2025-12-22 17:00:42 +05:30
Jim
309dafb7ae feat(controller): Add RainMaker controller type 2025-12-16 14:52:46 +08:00
Vikram Dattu
a5825e5e80 Move rainmaker register commands publically
- One can chose to use just the register command API while doing console init separate
2025-12-09 14:37:35 +05:30
Piyush Shah
b442dfcf3c node_info: Add an optional field "readme" in node info
This can point to some README url that the phone apps can fetch and show
at appropriate places.
2025-12-08 12:43:45 +05:30
Wang Qixiang
209087c7a5 esp_rainmaker: decouple esp_rcp_update from esp_rainmaker 2025-12-08 01:56:43 +05:30
Piyush Shah
9e4d1a683e esp_rmaker_params: Add "Firmware" as a new request source for set-params
Useful for identifying set params triggered from the firmware itself,
like from the CLI
2025-11-12 20:50:06 +05:30
Vikram Dattu
54ff0faf20 Added AWS credential provider APIs
- Two APIs added: get_aws_region and get_security_token
 - Useful, if an application needs to get credentials for a role
 - Also, added the facility to set MQTT_CRED_HOST
2025-10-27 10:27:55 +05:30
WanqQixiang
11acb5496e rmaker: use OpenThread Partition ID as the network-id and add it to node attributes 2025-09-15 14:37:00 +08:00
Piyush Shah
2ab70b5d06 feature: Add parameter updates via command-response (command id 1)
Adds support for triggering parameter updates through the command-response
framework using the special command id 1. The feature is controlled by the new
CONFIG_ESP_RMAKER_PARAM_CMD_RESP_ENABLE option and is enabled by default
when command-response is enabled.

The status and updated params are returned in the response data

Sample command payload: {"params":{"Light":{"Power":false}}}
Sample response payload: {"status":"success","params":{"Light":{"Power":false}}}

This will also update the values in the params DB returned via the
regular get params APIs like GET /user/nodes/params
2025-09-12 19:51:00 +05:30
Jim
e0bc3f5e99 ota: Add resumption ota feature 2025-09-12 09:18:40 +08:00
sanket.wadekar
cf49ba4219 esp_rmaker_ota: Added OTA Updates over MQTT
The regular OTA upgrades with ESP RainMaker required an additional https
connection to fetch the OTA image, which has a significant impact on
heap usage.

With MQTT OTA, the same MQTT channel used for rest of the RainMaker
communication is used to fetch the OTA image, thereby saving on RAM.
This could be slightly slower and may odd some cost. but the overall
impact would be low enough when compared against the advantages.

Signed-off-by: sanket.wadekar <sanket.wadekar@espressif.com>
Co-authored-by: Piyush Shah <piyush.shah@espressif.com>
2025-08-04 21:27:08 +05:30
Shubham Patil
af03e62381 components/esp_rainmaker: make cmd response payload publish api public
also bump the minimum required rmaker_common's version to 1.4.12 to use
the newly added payload generator APIs.
2025-07-13 11:24:26 +05:30
Piyush Shah
08c419da85 simple timeseries: Add a new helper API to directly report time series data
This allows users to avoid the double reporting that happens when using
esp_rmaker_param_update_and_report(), once for regular param update and
once for time series update. This can help reduce cost, especially when
the apps are using values only from the simple time series API.
2025-05-22 20:41:25 +05:30
Piyush Shah
d319d1d7c7 simple timeseries: Add an option to include ttl field (in days) while reporting values
This will ensure that the size of simple time series data in backend
does not keep growing and gets deleted after the configured time.

Typically, 30-60 days would be enough for most use cases.
2025-05-21 16:58:34 +05:30
Vikram Dattu
699df878b1 Extend signature generation to work on RSA signature
- Added signature generation for RSA signature in addition to ECDSA
 - Bugfix: use inlen, instead of doing strlen on input data
 - Bugfix: outlen should be `2 * slen` and not `slen` as we convert this to HEX
 - Also added a sign-data console command

 - component manager: Updated patch version for rainmaker component
2025-03-26 15:56:19 +05:30
Piyush Shah
630fe690b0 Minor typo fixes 2024-10-25 17:31:21 +05:30
WanqQixiang
189f99bb1c feature: Add Thread Border Router service and Thread BR example 2024-09-10 17:45:03 +08:00
WanqQixiang
be169c6894 esp-rainmaker: Replace wifi_provisioning with network_provisioning for ESP-IDF v5.1+ 2024-08-01 11:34:49 +08:00
Piyush Shah
8140819c03 esp_rmaker_param: Handle multiple params simultaneously in a single callback
A callback of type esp_rmaker_device_bulk_write_cb_t can be registered
using esp_rmaker_device_add_bulk_cb() to handle multiple param writes in
a single callback. This is especially useful for devices like lightbulb,
wherein a scene/schedule may have a combination of brightness, hue, saturation,
all of which should change together.

Additionally to optimise parameter reporting, internal logic has been changed such
that if the callbacks use esp_rmaker_param_update() instead of
esp_rmaker_param_update_and_report(), all updated parameters for a
device or service will get reported together instead of one parameter in
one message.
2024-06-20 14:26:06 +08:00
xiaqilin
e80f887312 esp-rainmaker: add zigbee gateway device type and get device private data API 2024-06-04 10:19:21 +08:00
Vikram Dattu
5772ee461f Fix some warnings in API docs 2024-05-10 21:16:34 +05:30
Piyush Shah
c265085b36 esp_rmaker_param: Add support for Simple Time Series Data
This is a simpler variant of time series data, which allows fetching
only raw values and not any aggregates like average, min, max, etc.
This option is cost efficient and is recommended if the application
requires only raw values.

Use PROP_FLAG_SIMPLE_TIME_SERIES instead of PROP_FLAG_TIME_SERIES in the
parameter properties flags to enable this.
2024-01-02 19:07:25 +05:30
Piyush Shah
2f7db4be6c Merge branch 'feature/local_ctrl_api' into 'master'
feature: Add APIs to enable/disable local control.

See merge request app-frameworks/esp-rainmaker!348
2023-09-12 13:50:17 +08:00
sanket.wadekar
ed52355881 feature: Add APIs to enable/disable local control.
If local control is enabled via config option (CONFIG_ESP_RMAKER_LOCAL_CTRL_AUTO_ENABLE),
the enabling/disabling will happen internally and the behaviour will be
unchanged. However, if the config option is disabled, applications can
still call esp_rmaker_local_ctrl_enable/disable at runtime as and when
required, if CONFIG_ESP_RMAKER_LOCAL_CTRL_FEATURE_ENABLE option is enabled.

Note that the older config option CONFIG_ESP_RMAKER_LOCAL_CTRL_ENABLE
has been renamed to CONFIG_ESP_RMAKER_LOCAL_CTRL_AUTO_ENABLE. However,
CONFIG_ESP_RMAKER_LOCAL_CTRL_ENABLE will also continue to work and
ensure backward compatibility
2023-09-08 23:46:21 +05:30
Piyush Shah
7070f2ea77 esp_rmaker_ota: Give applications a better control on app rollback 2023-09-08 22:45:52 +05:30
Piyush Shah
844e931187 Merge branch 'task/config_add_secure_boot_digest' into 'master'
task: add secure boot digest in node configuration

See merge request app-frameworks/esp-rainmaker!365
2023-07-28 16:47:50 +08:00
sanket.wadekar
8e6b70641f task: add secure boot digest in node configuration
Signed-off-by: Vikram <vikram.dattu@espressif.com>
2023-07-28 12:03:59 +05:30
sanket.wadekar
9f146dd36d feature: Add a node authentication mechanism using RainMaker certificate.
Can be used for user-node association or other purposes in future.
2023-06-08 15:07:02 +05:30
sanket.wadekar
629ad1090a task: create api to check whether device is connected
to MQTT server
2023-05-29 19:08:10 +05:30
Vikram
7da0ec23db Bugfix: MQTT budget exceed causing WDT trigger in ESP-Insights
Cause: A vicious cycle:
MQTT budget exceed error print getting logged into ESP-Insights.
When the RTC memory is full, this causes it to drop the message and
raise memory full event, which then taken action as reporting Insights
data immediately. This again causes MQTT budget exceed error!

The fix: Do not try to send message when budget is not available

Signed-off-by: Vikram <vikram.dattu@espressif.com>
2023-02-01 12:43:41 +05:30
Piyush Shah
d9994f3fb6 esp_rmaker_mqtt: Add MQTT budgeting to control the number of messages sent 2022-11-23 21:41:23 +05:30
sanket.wadekar
2f2c383e5e mqtt_topics: Added support for AWS basic ingest topics.
Signed-off-by: sanket.wadekar <sanket.wadekar@espressif.com>
2022-11-21 18:59:47 +05:30
sanket.wadekar
9b33df844b Added Job ID to OTA structure
Signed-off-by: sanket.wadekar <sanket.wadekar@espressif.com>
2022-10-18 15:03:44 +05:30
sanket.wadekar
80eec80015 Fixed OTA Race condition
Signed-off-by: sanket.wadekar <sanket.wadekar@espressif.com>
2022-10-12 10:01:25 +05:30
sanket.wadekar
32b2e0229f Added config to disable auto reboot after ota
Signed-off-by: sanket.wadekar <sanket.wadekar@espressif.com>
2022-10-10 19:41:55 +05:30
sanket.wadekar
7f34a7b6e6 Added firmware version to ota data structures
Signed-off-by: sanket.wadekar <sanket.wadekar@espressif.com>
2022-10-10 19:38:00 +05:30
Piyush Shah
757cbe5116 ota: Add support for OTA metadata, applicable for OTA using topics 2022-09-15 18:12:24 +05:30
Piyush Shah
bcde4e1f03 esp_rmaker_ota: Trigger events if the default OTA callback is used 2022-08-29 19:29:36 +05:30
Piyush Shah
c77d27a32f esp_rmaker_core: Add mqtt based support for command-response 2022-07-18 12:21:59 +05:30
sivar2311
07533b82a1 Merge branch 'espressif:master' into master 2022-06-09 09:10:58 +02:00
Piyush Shah
ef410e14b0 ota: Make "OTA using Topics" as default and provide a simplified API for that
- OTA using topics is now enabled in all examples
- esp_rmaker_ota_enable_default() is the simplified API that enables
  OTA using Topics with the default server certificates
2022-06-06 20:37:17 +05:30
sivar2311
f1cbb8c412 Added definitions for various parameters and UI types. 2022-05-28 06:41:32 +02:00
Piyush Shah
295b6a3839 rmaker_user_mapping: Fixes for bugs seen during re-provisioning 2022-04-28 20:04:10 +05:30
Piyush Shah
174a38b56c Merge branch 'task/ota_improvements' into 'master'
ota: Minor improvements

See merge request app-frameworks/esp-rainmaker!295
2022-04-28 17:32:32 +08:00
Piyush Shah
1cd07a0099 ota: Minor improvements
- Expose some internal APIs
    - External OTA callbacks can now call the internal function to manage OTA
    - Applications can explicitly send the OTA fetch publish message to check
    if OTA is available in case of OTA using Topics

- Handle network connectivity loss using keep-alive

- Send "rejected" as OTA status for project/version mismatch, instead of
  "failed".
2022-04-28 14:44:28 +05:30
Piyush Shah
72283a552d esp_rmaker_node_config: Added some new fields
Node info:
- project_name: The name of the project as configured in CMakeLists.txt.
  "model" was earlier being used for this and will continue to be used
  for backward compatibility, but now it would be ok to override model
  using the esp_rmaker_node_add_model() API.
- platformm: Read from CONFIG_IDF_TARGET, tells the platform being used
  (esp32, esp32s2, esp32c3,....)

Device
- model (optional)
2022-04-27 20:20:59 +05:30
Piyush Shah
f57a5ec62d Merge branch 'feature/scenes' into 'master'
esp_rmaker_scenes: Add scenes support.

See merge request app-frameworks/esp-rainmaker!245
2022-03-29 21:48:25 +08:00
Piyush Shah
c1187fed84 user_node_mapping: Better handling for user reset and mapping state
Even when an explicit user reset was triggered by the firmware,
the RMAKER_EVENT_USER_NODE_MAPPING_DONE event was getting generated,
which was misleading and causing issues while integrating other
frameworks. A new event RMAKER_EVENT_USER_NODE_MAPPING_RESET has
been added to distinguish this event.

The esp_rmaker_user_node_mapping_get_state() has also been exposed
for applications to use. Note that the CONFIG_ESP_RMAKER_USER_ID_CHECK
config option should be enabled to get correct state.
2022-03-16 13:10:33 +05:30
Chirag Atal
764db8d072 esp_rmaker_scenes: Add scenes support.
This adds a new standard service and its standard params.
The implementation is similar to the schedule structure but without triggers.
2022-03-09 16:16:23 +05:30