320 Commits

Author SHA1 Message Date
Piyush Shah
42aeaf0a69 Add option to report 'failed' status on OTA rollback due to MQTT timeout
When CONFIG_ESP_RMAKER_OTA_ROLLBACK_REPORT_FAILED is enabled, rolled-back
firmware reports 'failed' instead of 'rejected' when rollback occurs due
to MQTT connection timeout. Ensures backward compatibility by preventing
older firmware from reporting incorrect status.
2026-01-12 12:31:08 +05:30
Piyush Shah
45cbeb4844 ch_resp: Add enable/disable console command
Useful while testing on-network challenge-response based user node
mapping, either via standalone protocomm service or via local control.
Appropriate function gets called based on the Kconfig options selected.
2026-01-08 19:06:26 +05:30
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
Jim
1cba377a78 fix(chal_resp): Fix crash issue when use ECDSA to sign the data 2026-01-08 18:00:30 +08:00
Jim
a64b18e48e fix(ota): Fix OTA progress incorrect when trigger OTA resumption 2026-01-08 18:00:30 +08:00
Piyush Shah
d70a00a54e claim: Fixes for assisted claiming
If assisted claiming was already performed before calling
esp_rmaker_start(), the firmware was stalling with an incorrect print
saying that the Node connected to network without claiming.

This gets handled correctly now.
2025-12-22 20:40:19 +05:30
Piyush Shah
aa59008cbf esp_rmaker_mqtt: Change some log prints from "Info" to "Debug"
Since they aren't really required to be shown by default.
2025-12-22 18:55:54 +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
Piyush Shah
407f2e502d console: Add a command to clear claim data
This can help developers to
- Test claiming repeatedly
- Move between China and Global deployments during development and
  testing
2025-12-19 20:49:40 +05:30
Piyush Shah
ead1e9350e esp_rainmaker: Make Assisted Claiming and Challenge-Response as defaults
- Assisted claiming is now the default so that the same firmware can
  work with global as well as China RainMaker deployment.
- Challenge-Response based user-node mapping is now the default because
  it is recommended workflow as it is faster and prevents sending Wi-Fi
  credentials to invalid devices
2025-12-19 20:48:42 +05:30
Jim
309dafb7ae feat(controller): Add RainMaker controller type 2025-12-16 14:52:46 +08:00
Vikram Dattu
2da566488a CI: build camera examples for IDF version 5.5
- Build camera examples on IDF release/v5.5 for applicable targets
 - Also updated the rainmaker component version
 - Updated mdns component version to from 1.2.0 --> ^1.9.0
2025-12-10 19:50:39 +05:30
Vikram Dattu
a434a58ebc Support for camera devices for assisted and self claiming
- Updated the RainMaker component version from 1.8.1 to 1.8.2
2025-12-09 14:42:52 +05:30
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
da838cbf13 rmaker_common: Remove the submodule and its references 2025-11-13 09:42:38 +05:30
Piyush Shah
33d60a567b rmaker_console: Add set-param, update-param and get-param commands
- Add set-param command to set device parameter values, invoke respective callbacks and report to cloud
  Usage: set-param <device_name> <param_name> <value>
- Add update-param command to just report param value to cloud, without invoking callbacks
  Usage: update-param <device_name> <param_name> <value>
- Add get-param command to get device parameter values
  Usage: get-param <device_name> <param_name>
- Support all parameter types: boolean, integer, float, string

This enables easy interaction with ESP RainMaker devices through console interface.
2025-11-12 20:50:06 +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
Piyush Shah
4820d8d83f esp_rainmaker: Make version dependency for network_provisioning more flexible 2025-11-12 17:01:19 +05:30
Piyush Shah
c18a11fe6a Merge branch 'feature/aws_credential_api' into 'master'
Added AWS credential provider APIs

See merge request app-frameworks/esp-rainmaker!567
2025-11-11 18:43:11 +05:30
Junius Pun
925b69f959 esp_schedule: migration to idf-extra-components 2025-11-04 21:37:47 +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
Vikram Dattu
f9b1948fdf Disabled esp_bt code from rmaker_ota
- There is no esp_bt.h and controller available on P4/hosted.
 - Disabled this for now
2025-10-17 15:48:56 +05:30
Piyush Shah
42af2bd344 esp_daylight: Remove component as it was moved to idf-extra-components 2025-09-24 16:08:42 +05:30
Piyush Shah
b57b750fb4 cmd_resp: Code guards were missing for some config options 2025-09-23 16:49:11 +05:30
Piyush Shah
a131a00490 esp_rainmaker: Change default MQTT HOST for public RainMaker
The MQTT Host is now under a proper domain: mqtt.rainmaker.espressif.com
2025-09-22 14:34:53 +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
Piyush Shah
726a8e8d06 esp_rainmaker: Add support for sunrise/sunset based schedules
Can be enabled using CONFIG_ESP_RMAKER_SCHEDULE_ENABLE_DAYLIGHT, which
depends on CONFIG_ESP_SCHEDULE_ENABLE_DAYLIGHT=y.

These can be more reliable compared to the cloud driven daylight
automations as the calculations happen locally on the device and
schedules can take effect even when the device is offline.

This also supports offset so that you can schedule actions before/after
sunrise/sunset.

Together, these have a binary size impact of about 12,250 bytes.
CONFIG_ESP_SCHEDULE_ENABLE_DAYLIGHT contributes 11,500 bytes
CONFIG_ESP_RMAKER_SCHEDULE_ENABLE_DAYLIGHT contributes additional 750
bytes.
2025-09-10 18:23:40 +05:30
Piyush Shah
decb722fa4 esp_schedule: Add support for sunrise/sunset schedules
Enable using CONFIG_ESP_SCHEDULE_ENABLE_DAYLIGHT (default enabled)
Has a binary size impact of about 11,500 bytes
2025-09-10 18:23:40 +05:30
Piyush Shah
d7d67e1865 esp_daylight: Add a component to get sunrise/sunset time for a given location
Using NOAA equations as per the reference: https://gml.noaa.gov/grad/solcalc/
2025-09-10 18:23:40 +05:30
Piyush Shah
f3f7f74f4e esp_rainmaker: Remove legacy code for esp-idf versions < 5.1
Also removed CONFIG_ESP_RMAKER_USING_NETWORK_PROV

Made network prov as default since it is supported for esp-idf v5.1
onwards and esp-idf v5.0 has reached end of life.

This will make the code more readable
2025-08-29 19:54:54 +05:30
Piyush Shah
7e2dd9e5db esp_schedule: Remove legacy code for esp-idf versions < 5.1 2025-08-29 19:52:06 +05:30
Piyush Shah
efcb15b137 cleanup: Remove Makefile related files as it is not supported any more
ESP IDF has moved to CMake since long back and these files were anyways
unused
2025-08-29 19:52:06 +05:30
Piyush Shah
eb187e13c1 chall_resp: Allow challenge-response based mapping with Assisted Claiming 2025-08-29 18:54:10 +05:30
Piyush Shah
8371bc0bbf bugfix: User-Node mapping could fail if esp-insights is enabled 2025-08-26 16:13:12 +05:30
Piyush Shah
a87c825fbb chal_resp: Add support for challange response based user node association
This is a synchronous user-node mapping method that is performed during
provisioning, but even before sending Wi-Fi credentials and does not require
any communication from the node to the cloud. Check the esp_rainmaker
component CHANGELOG for details.
2025-08-08 20:02:38 +05:30
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
Piyush Shah
b2bd4c1e9a bugfix: Duplicate otafetch was causing crashes
Triggering a new otafetch while one was already in progress was causing
crashes due to incorrect setting/clearing of data.

This happened specifically on rebooting into new firmware after an OTA
when both, CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE and CONFIG_ESP_RMAKER_OTA_AUTOFETCH
are enabled.
2025-08-04 14:46:19 +05:30
jim
4a0ff0d0eb esp_rainmaker: make esp_rmaker_params_mqtt_init function execute in
queue so that it will not block event task
2025-08-01 14:00:40 +08:00
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
Shubham Patil
8076c0dd76 rmaker_common: update submodule to add tlv payload generator api 2025-07-11 18:14:09 +05:30
Piyush Shah
d0d0e27a98 Merge branch 'task/ota_reliability' into 'master'
ota: Enhance OTA fetch reliability with retry mechanism and delivery confirmation

See merge request app-frameworks/esp-rainmaker!548
2025-06-25 06:49:32 +05:30
Piyush Shah
b2dd13214c esp_rainmaker: Bump up component version and dependency for OTA reliability improvements 2025-06-24 19:58:21 +05:30
Piyush Shah
085b5da9cf esp_rmaker_ota: Retry on failure
- Try OTA multiple times (as per `CONFIG_ESP_RMAKER_OTA_MAX_RETRIES`, set to 3 by default) if it fails
- Schedule an OTA fetch as per `CONFIG_ESP_RMAKER_OTA_RETRY_DELAY_MINUTES` if all retries fail
2025-06-24 19:53:32 +05:30
esp
8bacc14517 fix(local_ctrl): Fix srp host name is too short for some node id used with uuid 2025-06-24 11:11:46 +08:00
Piyush Shah
e081eef5c2 ota: Enhance OTA fetch reliability with retry mechanism and delivery confirmation
- Monitor message publish acknowledgement for the otafetch message
- Add retry logic if otafetch fails
2025-06-20 14:13:20 +05:30
Piyush Shah
4ab40d00d8 esp_rainmaker: Bump up component version for OTA Progress reporting feature 2025-06-13 18:28:29 +05:30