Commit Graph

47 Commits

Author SHA1 Message Date
chiragatal
ffd5efca99 ws2812_led: Fix for rmt APIs getting included in case of make for IDF v4.0. 2020-10-06 18:13:28 +05:30
Piyush Shah
ddeba1670e Merge branch 'feature/device_scheduling' into 'master'
Scheduling support

See merge request app-frameworks/esp-rainmaker!125
2020-10-02 03:12:01 +08:00
Chirag Atal
a9c4e5b489 esp_rmaker_core: Added support for scheduling which allows actions to trigger automatically at the specified time.
For more information: https://rainmaker.espressif.com/docs/scheduling.html
2020-10-01 13:32:01 +05:30
Piyush Shah
52f9d01956 esp_rmaker_user_mapping: Create and register user_mapping handlers internally
Earlier, it was the application code's responsibility to call the
esp_rmaker_user_mapping_endpoint_create() and esp_rmaker_user_mapping_endpoint_register()
APIs at appropriate places in Wi-Fi provisioning code to enable user node mapping
functionality. To simplify this, the logic has been moved to RainMaker Core, so that
this happens automatically.

For some reason, if you want to retain the older logic in your application code
and do not want RainMaker_core to enable this, please set the
CONFIG_ESP_RMAKER_DISABLE_USER_MAPPING_PROV config option.
2020-10-01 00:58:37 +05:30
Piyush Shah
ccca176efc esp_rmaker_params: Added an API to indicate max number of elements allowed in an array param 2020-09-30 10:23:09 +05:30
Piyush Shah
367b48c995 esp_rmaker_standard_types: Start default names of all standard params with capital letter
Default parameter names like name, power, etc. have been changed to Name, Power, etc.
respectively, so that they look better in the phone app UIs.

Note that, with this change, any user configured device name (the name set from phone apps),
or any other persistent parameter for which a default name was used (Eg. power)
will be affected, as the values will no more be found in the NVS storage. Please edit your
application code accordingly if you want to stick with the old names.

Please check CHANGES.md for guidelines.
2020-09-29 14:07:38 +05:30
Piyush Shah
46f805c9f4 Merge branch 'feature/assisted_claiming' into 'master'
esp_claim: Add support for "Assisted Claiming"

See merge request app-frameworks/esp-rainmaker!158
2020-09-17 13:00:39 +08:00
Piyush Shah
3cdd00725b esp_rainmaker_core: Code restructuring for node config and params
Abstracted out the get node config and get/set node params functions so
that they just act upon the JSON data, irrespective of the source of the
requests.
2020-09-14 18:22:34 +05:30
Piyush Shah
b77f44aa97 esp_claim: Add support for "Assisted Claiming"
This is specifically for simplifying ESP32 claiming workflow,
wherein the phone apps will assist the node for claiming during
Wi-Fi provisioning. There would be no need of using CLI for claiming.

This will work only for BLE provisioning, as internet connectivity
will be required for claiming, and it may not be possible with
SoftAP.
2020-09-11 22:32:43 +05:30
Piyush Shah
1ddf30c7b2 Merge branch 'feature/timezone' into 'master'
esp_rmaker_time_sync: Add support for POSIX timezones

See merge request app-frameworks/esp-rainmaker!155
2020-09-04 22:51:44 +08:00
Piyush Shah
d7a1cf36e4 esp_rmaker_ota: Changes to support longer OTA URLs
This required 2 changes
1. Handle longer messages received on MQTT
2. Handle longer URLs in the http client configuration in OTA
2020-09-04 12:27:19 +05:30
Piyush Shah
90354df231 esp_rmaker_console: Added commands for time get and timezone set
Examples:

tz-set posix CST-8
I (25752) esp_rmaker_time_sync: The current time is: Tue Sep  1 21:48:13 2020 +0800[CST], DST: No.

tz-set America/Los_Angeles
I (70892) esp_rmaker_time_sync: The current time is: Tue Sep  1 06:48:58 2020 -0700[PDT], DST: Yes.

local-time
esp_rmaker_commands: Current local time: Tue Sep  1 06:49:21 2020 -0700[PDT], DST: Yes
2020-09-04 00:30:17 +05:30
Piyush Shah
bf9de50955 esp_rmaker_time_sync: Add support for POSIX timezones
Raw APIs as well as a RainMaker service have been provided to manage timezones.
Timezone information is stored in NVS so that it stays even across reboots.

A config option CONFIG_ESP_RMAKER_DEF_TIMEZONE has also been added to set the
default timezone.
2020-09-04 00:29:48 +05:30
Piyush Shah
7d5c39eb83 idf4.0_compat: Minor changes for IDF 4.0 compatibility
If IDF version being used is 4.0, following changes will happen:
- tcpip_adapter will be used, instead of esp_netif.
- MQTT port 8883 will be used, even if 443 is chosen, because
443 requires ALPN options in MQTT, which aren't supported in IDF 4.0
2020-09-01 16:08:09 +05:30
Piyush Shah
f4767018f9 ws2812_led: Simplify WS2812 RGB LED handling logic and also allow disabling it
The common code for WS2812 RGB LED has been moved to a component ws2812_led.

The WS2812 LED is available only on ESP32-S2-Saola-1 boards and hence
it will be enabled only if IDF target is set to ESP32S2. It can
be disabled by disabling the CONFIG_WS2812_LED_ENABLE config option.

led_strip component files have also been moved to ws2812_led
2020-09-01 16:07:57 +05:30
Piyush Shah
e0385e9ec3 iot_button: Minor fix in header file to prevent compilation warnings 2020-08-21 23:22:27 +05:30
Piyush Shah
7be8b6e9d4 esp_rmaker_utils: Add helper functions for Wi-Fi and factory reset
Also added events for these.
2020-08-19 23:56:16 +05:30
Piyush Shah
2a478e25f8 Fixed a minor compilation warning 2020-08-19 16:47:25 +05:30
Piyush Shah
1cca9ba4c4 esp_rmaker_core: Add a facility to add a valid set of string values
Some string parameters may want to have a set of valid values which
it wants the client (phone apps primarily) to show in a dropdown.
A new API esp_rmaker_param_add_valid_str_list() has been added for that.
2020-08-19 10:37:01 +05:30
Piyush Shah
475983131c Merge branch 'feature/json_obj_arr' into 'master'
Add facility for Objects and Arrays in Parameters

See merge request app-frameworks/esp-rainmaker!123
2020-08-06 19:35:45 +08:00
Piyush Shah
a9d1d4792a Merge branch 'feature/console_prov' into 'master'
esp_rmaker_console: Add a command for Wi-Fi provisioning

See merge request app-frameworks/esp-rainmaker!143
2020-08-06 18:41:30 +08:00
Piyush Shah
94254771fc esp_rmaker_console: Add a command for Wi-Fi provisioning
Command: wifi-prov <ssid> [<passphrase>]
2020-08-06 12:11:27 +05:30
Shubham Patil
e19abab592 wifi_provisioning: Use a random pop instead of creating it from MAC address
MAC address is a public information and can also be sniffed easily. Creating the proof of
possession pin from that is not secure enough. Instead, a random stream of bytes is now generated
and stored in the fctry partition during claiming and that is used for the PoP.
2020-08-05 23:12:08 +05:30
Piyush Shah
bbeb8f1d4d esp_rmaker_mqtt: Added support for persistent sockets and use of port 443
Using MQTT persistent session improves the reliability as the broker can then deliver any
pending QOS1 messages even after the node disconnects and then re-connects (within max 1hr).
However, it has a side-effect that messages can be received at unexpected times.
Please check the MQTT specs to understand persistent sessions.

Support for port 443 for MQTT has been enabled since it is generally open on most networks,
whereas port 8883 (default MQTT) could be blocked.
2020-08-03 19:28:32 +05:30
Piyush Shah
e24029fc90 esp_rmaker_core: Add support for Objects and Arrays in parameters
Validating the JSON arrays and objects would be the application's responsibility.
The RainMaker core will just treat them as strings (without the quotes, ofcourse).
2020-08-03 17:09:03 +05:30
Piyush Shah
b5cdfecdf7 json: Add facility to specifiy objects and arrays as strings
Eg. Add a pre-generated JSON object, say {"name":"val"} into another object, giving
a result {"pregen":{"name":"val"}}
Similarly allow to read entire object string during parsing.
2020-08-03 16:53:29 +05:30
Piyush Shah
a3a1d05531 esp_rainmaker_core: Code restructure and API changes
- APIs and data structures changed to a more object oriented approach.
- Some internal files split into multiple files to separate out functionality
  of node, device and parameter.
- A new doc file CHANGES.md added to help understand the changes.
- Modified all the examples as per these changes in the RainMaker APIs.
2020-07-31 16:16:21 +05:30
Piyush Shah
2bc2c7396f esp_rainmaker: Combine the various components into a single esp_rainmaker component
- Better exchange of data between different rainmaker components
- Single Kconfig file
- Easier to manage events and other common functionality
2020-07-22 19:16:04 +05:30
Switi Mhaiske
b939945995 cpp support: Make header files compatible with CPP 2020-07-20 19:56:03 +05:30
Piyush Shah
7d460768b7 esp_claim: Fixed a compilation error introduced due to a previous commit 2020-07-14 00:26:27 +05:30
Hrishikesh Dhayagude
c1831248ea esp_rmaker_core: Fix usage of strncpy 2020-07-10 21:47:34 +05:30
Shubham Patil
475984cd4f esp_rmaker_core: Fix typos in c api docs
Added
- Pointers to github repos of phone apps
2020-07-08 14:11:09 +05:30
Chirag Atal
4796f987b7 esp_rmaker_time_sync: Expose time_sync APIs. 2020-07-03 17:48:51 +05:30
Piyush Shah
15ccf7a7e9 esp_rmaker_core: Added support for some basic rainmaker events
Some RainMaker events could be useful for applications, either
to take some action, or trigger indicators. These are now
exposed using the ESP Events framework of ESP IDF.
2020-07-02 19:31:42 +05:30
Chirag Atal
dc3b34ccdf esp_rmaker_console: Add support for serial console. 2020-06-25 17:40:34 +05:30
Piyush Shah
6ecf3d9fad esp_rmaker_core: Add logic to automatically trigger re-runs of CMake
This is useful to avoid build failures when a new component or
config option is added in ESP RainMaker
2020-06-24 19:13:46 +05:30
Hrishikesh Dhayagude
9b8392594b esp_rmaker_mqtt: Modify esp_rmaker_mqtt_publish to accept binary input as well 2020-06-22 11:34:28 +05:30
Piyush Shah
7ffb174127 esp_claim: Change the name of efuse block as per changes in esp-idf 2020-06-16 19:02:41 +05:30
Piyush Shah
eed57b2797 esp_rmaker_ota: Add the default server certificate and make it easy to use 2020-06-05 11:13:45 +05:30
Piyush Shah
84389ec967 esp_rmaker_ota: Change the esp_rmaker_ota_enable() API
Instead of using config options, use argument to choose the OTA workflow.
Also added some more status updates in the OTA workflow.
2020-05-22 19:08:39 +05:30
Chirag Atal
378184d4c6 esp_rmaker_core: Changes to self claiming workflow to reduce RainMaker core task's stack requirement. It is now reduced to 4KB. 2020-05-20 18:27:55 +05:30
Piyush Shah
18af9e5709 Merge branch 'feature/create_device_dynamic' into 'master'
esp_rmaker_core: Added an API to report the changes to devices and their...

See merge request app-frameworks/esp-rainmaker!98
2020-05-16 01:39:24 +08:00
Chirag Atal
89889d11fa esp_rmaker_core: Expose an API to report node details
This will enable adding devices even after rainmaker has started, particularly for use cases like bridges/hubs.
2020-05-15 19:55:21 +05:30
Chirag Atal
bbbe4b90d8 esp_rmaker_core: Fixed a memory leak in node config mqtt publish. 2020-05-15 19:08:32 +05:30
Piyush Shah
937e13f59e esp_rmaker_claim: Changes as per the changes in the ESP Claim Service
- Claiming REST API paths and payloads changed.
- Claiming Service server certificate name changed for consistency.
- NVS value for MQTT Host given priority over the Config option.
- Minor change to print message during an MQTT disconnect, mostly
  seen during the first connection post a claiming.
- Some error prints improved to indicate the need of claiming.
2020-04-27 11:57:53 +05:30
Piyush Shah
756cc2051b user_node_mapping: Fixed a memory leak 2020-04-16 18:34:49 +05:30
Piyush Shah
72242952a2 esp_rainmaker: Add various required components, examples and CLI 2020-04-16 04:13:35 +05:30