.
Some checks are pending
Deploy Jekyll with GitHub Pages dependencies preinstalled / build (push) Waiting to run
Deploy Jekyll with GitHub Pages dependencies preinstalled / deploy (push) Blocked by required conditions

This commit is contained in:
Alexander 2024-08-11 18:39:35 -04:00
parent 9fd6fb2a1e
commit 1124212945

View File

@ -39,8 +39,11 @@
// Define the name of app for logs. // Define the name of app for logs.
static const char *TAG = "ESP32-Nodes Rainmaker Switch"; static const char *TAG = "ESP32-Nodes Rainmaker Switch";
// Define RainMaker device (switch) // Define RainMaker device: switch
esp_rmaker_device_t *switch_device; esp_rmaker_device_t *switch_device;
// Define RainMaker device: temperature gauge
esp_rmaker_device_t *light_gauge_device;
esp_rmaker_device_t *temp_sensor_device;
/* Callback to handle commands received from the RainMaker cloud */ /* Callback to handle commands received from the RainMaker cloud */
static esp_err_t write_cb(const esp_rmaker_device_t *device, const esp_rmaker_param_t *param, static esp_err_t write_cb(const esp_rmaker_device_t *device, const esp_rmaker_param_t *param,
@ -200,10 +203,11 @@ void app_main()
abort(); abort();
} }
/* Create a Switch device. /* CREATE SWITCH DEVICE.
* You can optionally use the helper API esp_rmaker_switch_device_create() to * You can optionally use the helper API esp_rmaker_switch_device_create() to
* avoid writing code for adding the name and power parameters. * avoid writing code for adding the name and power parameters.
*/ */
// Define device name and description as they should appear in RainMaker UI app // Define device name and description as they should appear in RainMaker UI app
switch_device = esp_rmaker_device_create("Switch ESP32C3 LuatOS", ESP_RMAKER_DEVICE_SWITCH, NULL); switch_device = esp_rmaker_device_create("Switch ESP32C3 LuatOS", ESP_RMAKER_DEVICE_SWITCH, NULL);
@ -232,6 +236,12 @@ void app_main()
/* Add this switch device to the node */ /* Add this switch device to the node */
esp_rmaker_node_add_device(node, switch_device); esp_rmaker_node_add_device(node, switch_device);
/* CREATE TEMPERATURE SENSOR DEVICE*/
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);
/* CREATE AMBIENT LIGHT SENSOR DEVICE*/
/* Enable OTA */ /* Enable OTA */
esp_rmaker_ota_enable_default(); esp_rmaker_ota_enable_default();