Commit Graph

77 Commits

Author SHA1 Message Date
Piyush Shah
fce91c4fb0 esp_rmaker_core: Add a system service for reboot/reset 2021-05-28 23:21:58 +05:30
Piyush Shah
7a4146c4df submodules: Updated the RainMaker Common and CLI submodules
Common: Additional metadata for tracking RainMaker platform connections in AWS.
CLI: Modified workflow for Node Sharing.
2021-04-08 17:11:10 +05:30
Piyush Shah
31397c93eb esp_rmaker_params: Do not attempt reporting params if RainMaker hasn't yet started
The "started" in this context means that the MQTT connection was successful
and normal RainMaker operations have begun.
2021-03-23 01:25:12 +05:30
Bruno Binet
80e565aac2 Don't delete work queue task when local_ctrl fails to start
this vTaskDelete statement was probably missed when the work queue has
been restructured and extracted in a separate component.
See commit: 31d4b375e3
2021-03-17 17:45:12 +01:00
Piyush Shah
66dc818ba8 esp_events: Corrected the event handler prototypes to be in sync with esp_event_handler_t
Closes https://github.com/espressif/esp-rainmaker/issues/55
2021-03-15 11:03:32 +05:30
Piyush Shah
38a46da760 Merge branch 'bugfix/schedule_memory_leak' into 'master'
esp_rmaker_schedule: Fix memory leak when parsing the schedule JSON.

See merge request app-frameworks/esp-rainmaker!220
2021-03-02 05:56:43 +00:00
Piyush Shah
50c3023e43 esp32-c3: Minor changes for ESP32-C3 support 2021-02-08 23:27:57 +05:30
Piyush Shah
31d4b375e3 esp_rmaker: Moved out some generic modules from esp_rainmaker component
The following are now part of a separate repo (and included as git submodule):
- MQTT glue layer
- Work Queue
- Utilities (reset, reboot, time sync, timezone, etc.)
- Factory Storage

Even CLI is now a part of a seperate repo, included here as a git submodule.
2021-02-03 15:30:55 +05:30
Piyush Shah
3a0f522995 esp_rmaker_standard_types: Added UI Type "esp.ui.hue-slider" for Hue param
This will show up as a coloured hue slider in the phone apps
2021-01-26 00:26:05 +05:30
Chirag Atal
6624e8664d esp_rmaker_schedule: Fix memory leak when parsing the schedule JSON. 2021-01-15 17:58:03 +05:30
Piyush Shah
0ad17a96e8 wifi_prov: Fixed a bug which was causing name/pop to change on every reboot
The provisioning name (SSID/BLE device name) and PoP are generated from
the general purpose random bytes stored in the factory NVS partition.
If a node hasn't completed claiming, these random bytes was getting re-generated
on a reboot, thereby causing the name and pop to change, which is undesirable.

With this fix, the random bytes will be generated only if not done already.

Note that an erase_flash will erase these bytes as well and so,
the provisioning name and PoP will still change in that case.
2021-01-07 23:19:49 +05:30
Piyush Shah
3a0621dccf Merge branch 'bugfix/local_ctrl_crash' into 'master'
esp_rmaker_local_ctrl: Wait for Wi-Fi provisioning to finish before starting local control

See merge request app-frameworks/esp-rainmaker!205
2020-12-05 00:29:46 +08:00
Piyush Shah
592addd0e8 esp_rmaker_local_ctrl: Wait for Wi-Fi provisioning to finish before starting local control
Since only a single protocomm_httpd instance is allowed at a time, starting local
control before soft AP provisioning ends causes errors. So now, we wait for
provisioning to finish before starting local control.
2020-12-04 14:20:47 +05:30
Piyush Shah
65e31b7666 ota: Fixed an issue in error reporting in case of invalid OTA image 2020-12-03 22:51:58 +05:30
Piyush Shah
489a532c32 esp_rmaker_local_ctrl: Keep the feature disabled by default 2020-11-26 22:05:46 +05:30
Piyush Shah
32b7d65d9b esp_rmaker_core: Provide an API to get request source in string format
Used this API in all examples.
2020-11-18 22:16:05 +05:30
Piyush Shah
892e61b32f esp_rmaker_core: Add a facility for local control
Once the node connects to a Wi-Fi network, it would now be possible to
control it from a client in the same network. This will be useful when
the Internet connection is down. It will also reduce the cloud communication
in general and will be faster.
2020-11-18 22:16:04 +05:30
Piyush Shah
fd094fb045 Miscellaneous minor fixes 2020-11-12 17:19:46 +05:30
Piyush Shah
8a098f08ca esp_rmaker_mqtt: Add a few MQTT events 2020-11-10 19:00:53 +05:30
Piyush Shah
0ebf534965 Merge branch 'task/upstream_json' into 'master'
json: Use upstream json_generator and json_parser as submodules

See merge request app-frameworks/esp-rainmaker!184
2020-10-23 16:26:09 +08:00
Shubham Patil
4517665b28 rmaker_core: Fixes build failure when claim config is disabled. 2020-10-19 17:07:44 +05:30
Piyush Shah
7a13a9d545 json: Use upstream json_generator and json_parser as submodules
The JSON generator and JSON parser being used in ESP RainMaker were
taken from third party repos. In order to ensure that they are
better in sync with the upstream repos, they have now been included
as submodules.

Please run `git submodule update --init --recursive` once to pull in
these submodules.
2020-10-16 21:52:31 +05:30
Piyush Shah
d3f0e644b1 Merge branch 'task/random_ssid_pop' into 'master'
app_wifi: Changes in SSID and PoP generation for Provisioning

See merge request app-frameworks/esp-rainmaker!189
2020-10-17 00:10:17 +08:00
Piyush Shah
fd50262b42 app_wifi: Changes in SSID and PoP generation for Provisioning
- In claiming, change the 4 byte random number to 64 byte and store it
as binary data instead of hex representation.
- Instead of reading PoP as hex string from NVS, read it as binary data
(because of above change) and then convert to hex representation.
- Instead of using mac address, use last 3 bytes of the above random number
number as suffix for SSID.

The last change was made so as to allow generating the QR code completely outside
the device, without knowing its mac address.
2020-10-16 18:44:29 +05:30
Piyush Shah
27ea88d93c esp_mqtt_data: Internal API changes 2020-10-15 16:57:54 +05:30
Piyush Shah
d54adcd746 Merge branch 'bugfix/c_apis' into 'master'
bugfixes: Fixed some API failures

See merge request app-frameworks/esp-rainmaker!183
2020-10-09 19:27:59 +08:00
Piyush Shah
379ccd1de0 bugfixes: Fixed some API failures 2020-10-09 12:35:04 +05:30
Piyush Shah
72a7db49d1 Merge branch 'bugfix/persist_param_cb' into 'master'
bugfix: Callback for persistent parameters wasn't getting invoked

See merge request app-frameworks/esp-rainmaker!181
2020-10-08 20:17:02 +08:00
Piyush Shah
1cfd8ff2e9 button: Change license from MIT to Apache 2.0 to be in sync with rest of the repo 2020-10-07 18:22:03 +05:30
Piyush Shah
12fd24f3eb bugfix: Callback for persistent parameters wasn't getting invoked
The RainMaker core has special handling for the "name" type of parameter
and so, it does not call the application registered callback for this
parameter. However, the internal check was erroneous and the callback
was getting skipped even when the param type was NULL. The check has
now been fixed.
2020-10-07 17:45:08 +05:30
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