27 lines
928 B
C
27 lines
928 B
C
#include <stdio.h>
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
#include "driver/gpio.h"
|
|
#include "esp_log.h"
|
|
#include "nvs_flash.h"
|
|
#include "ha/esp_zigbee_ha_standard.h"
|
|
|
|
static const char *TAG = "SIMPLE_LIGHT_CONTROLLER";
|
|
|
|
void app_main(void)
|
|
{
|
|
// Print startup banner to serial monitor
|
|
ESP_LOGI(TAG, "=== Simple Light controller for Zigbee & HA ===");
|
|
|
|
// === INITIALIZE STORAGE SYSTEM ===
|
|
// NVS = Non-Volatile Storage
|
|
// Saves Zigbee network info so device remembers which network it joined
|
|
ESP_ERROR_CHECK(nvs_flash_init()); // ESP_ERROR_CHECK = crash if this fails
|
|
|
|
esp_zb_platform_config_t config = {
|
|
.radio_config = ESP_ZB_DEFAULT_RADIO_CONFIG(), // Set up 2.4GHz radio settings
|
|
.host_config = ESP_ZB_DEFAULT_HOST_CONFIG(), // Set up processor settings
|
|
};
|
|
|
|
ESP_ERROR_CHECK(esp_zb_platform_config(&config)); // Apply the configuration
|
|
} |