Commit Graph

216 Commits

Author SHA1 Message Date
chendejin
7d4c1e36f9 fix unknown type name time_t error 2023-12-08 15:18:04 +08:00
Piyush Shah
0fde281942 esp_rmaker_schedule: Use esp_schedule's concept of validity
Allow users to specify start and end time between which the schedule
will be active. A new object "validity" has been introduced for this.
Eg.
{
    "Schedule": {
        "Schedules": [
            {
                "name": "Evening",
                "id": "8D37",
                "operation": "add",
                "validity": {
                    "start": 1698839416,
                    "end": 1698840916
                },
                "triggers": [
                    {
                        "m": 1053,
                        "d": 31
                    }
                ],
                "action": {
                    "Light": {
                        "Power": true
                    }
                }
            }
        ]
    }
}
2023-11-07 23:13:53 +05:30
Piyush Shah
d4d353c5a3 esp_schedule: Add a concept of start/end of validity of schedules
This will allow providing a range between which the schedule should be active.
Eg. Turn on the light at 6:00pm everyday, only between 1-Nov-2023 to
30-Nov-2023. The ranges are to be specified as UTC epoch time.
2023-11-07 23:13:46 +05:30
Piyush Shah
eeed71b63d schedules: Change timing logic to use trigger object instead of schedule object
This will make the code cleaner since timing related logic is linked
only to the trigger object and not the entire schedule object and
additionally, this can allow us to have multiple triggers per schedule
in future.
2023-11-07 23:13:04 +05:30
Piyush Shah
d48789a627 Merge branch 'bugfix/schedule_type' into 'master'
esp_schedule: Handle invalid schedule trigger types

See merge request app-frameworks/esp-rainmaker!402
2023-11-07 13:12:53 +08:00
Piyush Shah
daf3ea7f71 esp_schedule: Handle invalid schedule trigger types
- Do not allow schedules with invalid trigger type
- For existing schedules with invalid trigger type, add handling so that they
  expire after triggering once, similar to one time schedules.
2023-11-06 20:02:40 +05:30
Piyush Shah
b0d02253a0 Merge branch 'bugfix/rel_schedules' into 'master'
esp_schedules: Schedules with "relative seconds" were repeating continuously

See merge request app-frameworks/esp-rainmaker!399
2023-11-01 16:32:22 +08:00
Piyush Shah
37831922eb esp_schedules: Schedules with "relative seconds" were repeating continuously
After a schedule with "relative seconds" executed, the esp_rmaker_schedule
logic was disabling it. However, this was causing incorrect checks in
esp_schedule component logic, causing the schedule to get re-enabled.

Added a check similar to other schedules to prevent this.
2023-10-27 19:31:52 +05:30
Vikram Dattu
10361704b4 wifi-prov cli: Set Wi-Fi creds directly for already provisioned devices
When device is already provisioned, `wifi_prov_mgr_configure_sta` API call fails.
This happens because, provisioning manager is in uninitialized state.
We set Wi-Fi credetials directly using `esp_wifi_set_config` in that case.

Also removed error check on `wifi_prov_mgr_is_provisioned` API call, as for
IDF 4.x APIs return `ESP_ERR_INVALID_STATE`
2023-10-27 18:20:00 +05:30
Piyush Shah
cfca241575 idf_component_manager: Add components of esp rainmaker to component manager
Includes esp_rainmaker and esp_schedule
2023-09-22 09:40:00 +05:30
Piyush Shah
f6ed0c4994 components: Updated and moved some components
- qrcode, ws2812_led and gpio_button moved to examples/common
- esp-insights and rmaker_common submodules updated
- json_generator and json_parser components copied from component
  manager so that they can be used for component overrides
2023-09-22 09:39:55 +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
5f37a3ec1d cmd-resp: Add an attribute to indicate if cmd-resp is enabled
This is now mandatory for command response to work
2023-08-18 15:14:44 +05:30
sanket.wadekar
e627cc6beb Added matter_light and matter_switch example 2023-08-08 14:08:29 +05:30
Chirag Atal
d2e6629e73 esp_rmaker_secure_boot: Fix compilation 2023-07-28 18:20: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
58e936f79f examples: Include nvs keys partition to enable using nvs encryption
Also updates the rmaker_common submodule to include support for encrypted fctry nvs partition.
2023-07-14 14:37:24 +05:30
Piyush Shah
ff0dd32902 Merge branch 'task/cmd_resp_example' into 'master'
Command Response Offline Handling

See merge request app-frameworks/esp-rainmaker!285
2023-06-14 14:57:28 +08:00
Piyush Shah
d356ffa7f2 cmd_resp: Add support to query for pending commands on mqtt reconnect 2023-06-13 19:57:36 +05:30
sanket.wadekar
0aeb1d79b0 feature: add a configurable option to read node id from device certificate. 2023-06-09 19:17:40 +05:30
Piyush Shah
97af933991 esp_rmaker_client_data: Allow to use MQTT Host from config even when claiming is disabled
Now that we allow reading private key and certificate from secure cert
partition too, the node may not have MQTT host in nvs even in production
cases wherein claiming is disabled. This was causing errors in MQTT
init. This new config option forces firmware to use it from NVS.

This also helps in cases where the same node is to be connected to a
different server after an OTA.
2023-06-09 16:16:26 +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
Piyush Shah
767643f6d3 homekit_switch: Fixes for idf v5.x
Also updated the cli and rmaker_common submodules
2023-05-19 17:39:21 +05:30
yuanjianmin
cf8d240ef6 rmaker_local_ctrl: Reduce local contrl stack size from 10K to 6K and make it configurable 2023-05-10 20:01:21 +08:00
Piyush Shah
5f67499f15 bugfix: Null terminating byte was not considered in key/certificate length
Causing issues with connection.
2023-04-04 17:31:29 +05:30
Dhaval Gujar
0de30063b1 Add esp_rmaker_get_* APIs for getting length of device PKI elements 2023-04-03 14:20:42 +05:30
Dhaval Gujar
741b2c64a1 Adds support for using esp_secure_cert_mgr for TLS credentials
- Updated partitions.csv in all examples to use final
 esp_secure_cert partition format.
- This option can only be enabled if claiming is disabled.
- The Rainmaker app will fall back to using NVS if it
 fails to fetch from the `esp_secure_cert` partition.
 This has been done to allow a common firmware to be built that
 can run on both kinds of devices, i.e. ones that use NVS
 and ones that use the `esp_secure_cert` partition.
2023-03-30 22:23:17 +05:30
Piyush Shah
46ec3c41cf esp_rmaker_ota: Add support for local time based OTA
This will help ensure that OTA can be performed within specific dates
and within specific times within those dates.

Eg. Perform OTA between 1 Dec 2022 and 10 Dec 2022 that too only between
2:00am and 5:00am
2023-03-23 19:51:10 +05:30
sanket.wadekar
ab37459cc2 fix: build errors on idf 5.1 2023-03-23 15:03:30 +05:30
sanket.wadekar
849a654857 fix: Removed deprecated sntp APIs 2023-03-23 15:03:30 +05:30
Piyush Shah
a45a6bca87 Merge branch 'support/update_rmaker_common' into 'master'
Updated rmaker_common and used cli from it

See merge request app-frameworks/esp-rainmaker!354
2023-03-23 17:31:55 +08:00
Vikram
ca8c99ee48 Updated rmaker_common and used cli from it
Signed-off-by: Vikram <vikram.dattu@espressif.com>
2023-03-23 14:15:43 +05:30
Chirag Atal
96357111e1 insights: Update insights submodule to support insights package for esp32h2 2023-03-15 15:00:36 +05:30
Piyush Shah
79085a7754 Merge branch 'fix/ota_fw_reject' into 'master'
Report OTA status rejected on mismatch chip id

See merge request app-frameworks/esp-rainmaker!351
2023-02-08 21:50:40 +08:00
Piyush Shah
d8aac19409 Merge branch 'bugfix/no_mqtt_budget_insights_wdt_trigger' into 'master'
Bugfix: MQTT budget exceed causing WDT trigger in ESP-Insights

See merge request app-frameworks/esp-rainmaker!344
2023-02-02 18:38:46 +08:00
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
Vikram
60df4b9da3 Updated ESP-Insights submodule
Signed-off-by: Vikram <vikram.dattu@espressif.com>
2023-02-01 12:43:41 +05:30
sanket.wadekar
a7feb9d863 Report OTA status rejected on chip revision mismatch. 2023-01-30 09:31:06 +05:30
Pritam Shelke
82f9074555 Updated rmaker_common to allocate some buffers into external ram 2023-01-25 17:48:04 +05:30
Pritam Shelke
72ac8935aa ExtRAM usage: Allocate some buffers into external RAM, if available
Allocating buffers in external RAM (if available and enabled) helps gain about 3500 bytes of memory in the Internal RAM
2023-01-25 17:48:04 +05:30
Piyush Shah
bcc2163b92 Merge branch 'bugfix/nvs_commit_call' into 'master'
bugfix:  Added nvs_commit calls in esp_schedule_nvs.c.

See merge request app-frameworks/esp-rainmaker!341
2023-01-24 20:02:11 +08:00
sanket.wadekar
25a4cf7954 bugfix: Added nvs_commit calls in esp_schedule_nvs.c.
Closes #196
2023-01-24 17:11:25 +05:30
Vikram
61fb45ca27 Check if cmd_resp already enabled before trying to enable it
Signed-off-by: Vikram <vikram.dattu@espressif.com>
2023-01-24 16:45:37 +05:30
Chirag Atal
658bbe0501 esp_rmaker_ota: Add support to check for secure version
If the secure version of the OTA image is less than the one stored in efuse, the update will be rejected. This is useful when anti-rollback is enabled.
2022-12-06 15:13:15 +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