From 0b819949cfb85d94fd5e793269afd2cff853d0e3 Mon Sep 17 00:00:00 2001 From: Piyush Shah Date: Sat, 5 Jun 2021 00:23:07 +0530 Subject: [PATCH] examples: Add timezone service in some examples Setting correct timezone is mandatory for scheduling to work correctly. Earlier, the default timezone was set to "Asia/Shanghai" and a config change was required for setting appropriate timezone. However, now that the phone apps have support for setting the timezone using the RainMaker timezone service, it has been enabled in all examples that had scheduling enabled. --- examples/fan/main/app_main.c | 9 +++++---- examples/led_light/main/app_main.c | 9 +++++---- examples/multi_device/main/app_main.c | 9 +++++---- examples/switch/main/app_main.c | 9 +++++---- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/examples/fan/main/app_main.c b/examples/fan/main/app_main.c index d4bc65f..7b28fb1 100644 --- a/examples/fan/main/app_main.c +++ b/examples/fan/main/app_main.c @@ -89,13 +89,14 @@ void app_main() esp_rmaker_device_add_param(fan_device, esp_rmaker_speed_param_create(ESP_RMAKER_DEF_SPEED_NAME, DEFAULT_SPEED)); esp_rmaker_node_add_device(node, fan_device); - /* Enable scheduling. - * Please note that you also need to set the timezone for schedules to work correctly. - * Simplest option is to use the CONFIG_ESP_RMAKER_DEF_TIMEZONE config option. - * Else, you can set the timezone using the API call `esp_rmaker_time_set_timezone("Asia/Shanghai");` + /* Enable timezone service which will be require for setting appropriate timezone + * from the phone apps for scheduling to work correctly. * For more information on the various ways of setting timezone, please check * https://rainmaker.espressif.com/docs/time-service.html. */ + esp_rmaker_timezone_service_enable(); + + /* Enable scheduling. */ esp_rmaker_schedule_enable(); /* Start the ESP RainMaker Agent */ diff --git a/examples/led_light/main/app_main.c b/examples/led_light/main/app_main.c index 78e9526..767140c 100644 --- a/examples/led_light/main/app_main.c +++ b/examples/led_light/main/app_main.c @@ -110,13 +110,14 @@ void app_main() }; esp_rmaker_ota_enable(&ota_config, OTA_USING_PARAMS); - /* Enable scheduling - * Please note that you also need to set the timezone for schedules to work correctly. - * Simplest option is to use the CONFIG_ESP_RMAKER_DEF_TIMEZONE config option. - * Else, you can set the timezone using the API call `esp_rmaker_time_set_timezone("Asia/Shanghai");` + /* Enable timezone service which will be require for setting appropriate timezone + * from the phone apps for scheduling to work correctly. * For more information on the various ways of setting timezone, please check * https://rainmaker.espressif.com/docs/time-service.html. */ + esp_rmaker_timezone_service_enable(); + + /* Enable scheduling. */ esp_rmaker_schedule_enable(); /* Start the ESP RainMaker Agent */ diff --git a/examples/multi_device/main/app_main.c b/examples/multi_device/main/app_main.c index e9e631b..8c7f346 100644 --- a/examples/multi_device/main/app_main.c +++ b/examples/multi_device/main/app_main.c @@ -118,13 +118,14 @@ void app_main() temp_sensor_device = esp_rmaker_temp_sensor_device_create("Temperature Sensor", NULL, app_get_current_temperature()); esp_rmaker_node_add_device(node, temp_sensor_device); - /* Enable scheduling. - * Please note that you also need to set the timezone for schedules to work correctly. - * Simplest option is to use the CONFIG_ESP_RMAKER_DEF_TIMEZONE config option. - * Else, you can set the timezone using the API call `esp_rmaker_time_set_timezone("Asia/Shanghai");` + /* Enable timezone service which will be require for setting appropriate timezone + * from the phone apps for scheduling to work correctly. * For more information on the various ways of setting timezone, please check * https://rainmaker.espressif.com/docs/time-service.html. */ + esp_rmaker_timezone_service_enable(); + + /* Enable scheduling. */ esp_rmaker_schedule_enable(); /* Start the ESP RainMaker Agent */ diff --git a/examples/switch/main/app_main.c b/examples/switch/main/app_main.c index 0b58418..57e1672 100644 --- a/examples/switch/main/app_main.c +++ b/examples/switch/main/app_main.c @@ -170,13 +170,14 @@ void app_main() }; esp_rmaker_ota_enable(&ota_config, OTA_USING_PARAMS); - /* Enable scheduling. - * Please note that you also need to set the timezone for schedules to work correctly. - * Simplest option is to use the CONFIG_ESP_RMAKER_DEF_TIMEZONE config option. - * Else, you can set the timezone using the API call `esp_rmaker_time_set_timezone("Asia/Shanghai");` + /* Enable timezone service which will be require for setting appropriate timezone + * from the phone apps for scheduling to work correctly. * For more information on the various ways of setting timezone, please check * https://rainmaker.espressif.com/docs/time-service.html. */ + esp_rmaker_timezone_service_enable(); + + /* Enable scheduling. */ esp_rmaker_schedule_enable(); /* Start the ESP RainMaker Agent */