Skip to content

Commit ee9e890

Browse files
authored
Merge branch 'master' into feat/zigbee-leave-signal
2 parents b000abb + 7bafc1b commit ee9e890

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3920
-105
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ set(ARDUINO_LIBRARY_Zigbee_SRCS
301301
libraries/Zigbee/src/ep/ZigbeeWindSpeedSensor.cpp
302302
libraries/Zigbee/src/ep/ZigbeeIlluminanceSensor.cpp
303303
libraries/Zigbee/src/ep/ZigbeePM25Sensor.cpp
304+
libraries/Zigbee/src/ep/ZigbeeElectricalMeasurement.cpp
305+
libraries/Zigbee/src/ep/ZigbeeBinary.cpp
306+
libraries/Zigbee/src/ep/ZigbeePowerOutlet.cpp
304307
)
305308

306309
set(ARDUINO_LIBRARY_BLE_SRCS

boards.txt

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13023,6 +13023,212 @@ dfrobot_romeo_esp32s3.menu.EraseFlash.none.upload.erase_cmd=
1302313023
dfrobot_romeo_esp32s3.menu.EraseFlash.all=Enabled
1302413024
dfrobot_romeo_esp32s3.menu.EraseFlash.all.upload.erase_cmd=-e
1302513025

13026+
##############################################################
13027+
dfrobot_lorawan_esp32s3.name=DFRobot LoRaWAN ESP32-S3
13028+
#dfrobot_lorawan_esp32s3.vid.0=0x303a
13029+
#dfrobot_lorawan_esp32s3.pid.0=0x1001
13030+
13031+
dfrobot_lorawan_esp32s3.bootloader.tool=esptool_py
13032+
dfrobot_lorawan_esp32s3.bootloader.tool.default=esptool_py
13033+
13034+
dfrobot_lorawan_esp32s3.upload.tool=esptool_py
13035+
dfrobot_lorawan_esp32s3.upload.tool.default=esptool_py
13036+
dfrobot_lorawan_esp32s3.upload.tool.network=esp_ota
13037+
13038+
dfrobot_lorawan_esp32s3.upload.speed=921600
13039+
dfrobot_lorawan_esp32s3.upload.erase_cmd=
13040+
dfrobot_lorawan_esp32s3.upload.maximum_size=1310720
13041+
dfrobot_lorawan_esp32s3.upload.maximum_data_size=327680
13042+
dfrobot_lorawan_esp32s3.upload.flags=
13043+
dfrobot_lorawan_esp32s3.upload.extra_flags=
13044+
dfrobot_lorawan_esp32s3.upload.use_1200bps_touch=false
13045+
dfrobot_lorawan_esp32s3.upload.wait_for_upload_port=false
13046+
13047+
dfrobot_lorawan_esp32s3.serial.disableDTR=false
13048+
dfrobot_lorawan_esp32s3.serial.disableRTS=false
13049+
13050+
dfrobot_lorawan_esp32s3.build.tarch=xtensa
13051+
dfrobot_lorawan_esp32s3.build.bootloader_addr=0x0
13052+
dfrobot_lorawan_esp32s3.build.target=esp32s3
13053+
dfrobot_lorawan_esp32s3.build.mcu=esp32s3
13054+
dfrobot_lorawan_esp32s3.build.core=esp32
13055+
dfrobot_lorawan_esp32s3.build.variant=dfrobot_lorawan_esp32s3
13056+
dfrobot_lorawan_esp32s3.build.board=DFROBOT_LORAWAN_ESP32S3
13057+
dfrobot_lorawan_esp32s3.build.usb_mode=1
13058+
dfrobot_lorawan_esp32s3.build.cdc_on_boot=1
13059+
dfrobot_lorawan_esp32s3.build.msc_on_boot=0
13060+
dfrobot_lorawan_esp32s3.build.dfu_on_boot=0
13061+
dfrobot_lorawan_esp32s3.build.f_cpu=240000000L
13062+
dfrobot_lorawan_esp32s3.build.flash_size=4MB
13063+
dfrobot_lorawan_esp32s3.build.flash_freq=80m
13064+
dfrobot_lorawan_esp32s3.build.flash_mode=dio
13065+
dfrobot_lorawan_esp32s3.build.boot=qio
13066+
dfrobot_lorawan_esp32s3.build.boot_freq=80m
13067+
dfrobot_lorawan_esp32s3.build.partitions=default
13068+
dfrobot_lorawan_esp32s3.build.defines=-D{build.band}
13069+
dfrobot_lorawan_esp32s3.build.loop_core=
13070+
dfrobot_lorawan_esp32s3.build.event_core=
13071+
dfrobot_lorawan_esp32s3.build.psram_type=qspi
13072+
dfrobot_lorawan_esp32s3.build.memory_type={build.flash_type}_{build.psram_type}
13073+
dfrobot_lorawan_esp32s3.build.region=
13074+
13075+
dfrobot_lorawan_esp32s3.menu.FlashMode.qio=QIO 80MHz
13076+
dfrobot_lorawan_esp32s3.menu.FlashMode.qio.build.flash_mode=dio
13077+
dfrobot_lorawan_esp32s3.menu.FlashMode.qio.build.boot=qio
13078+
dfrobot_lorawan_esp32s3.menu.FlashMode.qio.build.boot_freq=80m
13079+
dfrobot_lorawan_esp32s3.menu.FlashMode.qio.build.flash_freq=80m
13080+
dfrobot_lorawan_esp32s3.menu.FlashMode.qio.build.flash_type=qio
13081+
dfrobot_lorawan_esp32s3.menu.FlashMode.qio120=QIO 120MHz
13082+
dfrobot_lorawan_esp32s3.menu.FlashMode.qio120.build.flash_mode=dio
13083+
dfrobot_lorawan_esp32s3.menu.FlashMode.qio120.build.boot=qio
13084+
dfrobot_lorawan_esp32s3.menu.FlashMode.qio120.build.boot_freq=120m
13085+
dfrobot_lorawan_esp32s3.menu.FlashMode.qio120.build.flash_freq=80m
13086+
dfrobot_lorawan_esp32s3.menu.FlashMode.qio120.build.flash_type=qio
13087+
dfrobot_lorawan_esp32s3.menu.FlashMode.dio=DIO 80MHz
13088+
dfrobot_lorawan_esp32s3.menu.FlashMode.dio.build.flash_mode=dio
13089+
dfrobot_lorawan_esp32s3.menu.FlashMode.dio.build.boot=dio
13090+
dfrobot_lorawan_esp32s3.menu.FlashMode.dio.build.boot_freq=80m
13091+
dfrobot_lorawan_esp32s3.menu.FlashMode.dio.build.flash_freq=80m
13092+
dfrobot_lorawan_esp32s3.menu.FlashMode.dio.build.flash_type=qio
13093+
13094+
dfrobot_lorawan_esp32s3.menu.FlashSize.4M=4MB (32Mb)
13095+
dfrobot_lorawan_esp32s3.menu.FlashSize.4M.build.flash_size=4MB
13096+
13097+
dfrobot_lorawan_esp32s3.menu.LoopCore.1=Core 1
13098+
dfrobot_lorawan_esp32s3.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1
13099+
dfrobot_lorawan_esp32s3.menu.LoopCore.0=Core 0
13100+
dfrobot_lorawan_esp32s3.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0
13101+
13102+
dfrobot_lorawan_esp32s3.menu.EventsCore.1=Core 1
13103+
dfrobot_lorawan_esp32s3.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1
13104+
dfrobot_lorawan_esp32s3.menu.EventsCore.0=Core 0
13105+
dfrobot_lorawan_esp32s3.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0
13106+
dfrobot_lorawan_esp32s3.menu.USBMode.hwcdc=Hardware CDC and JTAG
13107+
dfrobot_lorawan_esp32s3.menu.USBMode.hwcdc.build.usb_mode=1
13108+
dfrobot_lorawan_esp32s3.menu.USBMode.default=USB-OTG (TinyUSB)
13109+
dfrobot_lorawan_esp32s3.menu.USBMode.default.build.usb_mode=0
13110+
13111+
dfrobot_lorawan_esp32s3.menu.CDCOnBoot.default=Disabled
13112+
dfrobot_lorawan_esp32s3.menu.CDCOnBoot.default.build.cdc_on_boot=0
13113+
dfrobot_lorawan_esp32s3.menu.CDCOnBoot.cdc=Enabled
13114+
dfrobot_lorawan_esp32s3.menu.CDCOnBoot.cdc.build.cdc_on_boot=1
13115+
13116+
dfrobot_lorawan_esp32s3.menu.MSCOnBoot.default=Disabled
13117+
dfrobot_lorawan_esp32s3.menu.MSCOnBoot.default.build.msc_on_boot=0
13118+
dfrobot_lorawan_esp32s3.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode)
13119+
dfrobot_lorawan_esp32s3.menu.MSCOnBoot.msc.build.msc_on_boot=1
13120+
13121+
dfrobot_lorawan_esp32s3.menu.DFUOnBoot.default=Disabled
13122+
dfrobot_lorawan_esp32s3.menu.DFUOnBoot.default.build.dfu_on_boot=0
13123+
dfrobot_lorawan_esp32s3.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode)
13124+
dfrobot_lorawan_esp32s3.menu.DFUOnBoot.dfu.build.dfu_on_boot=1
13125+
13126+
dfrobot_lorawan_esp32s3.menu.UploadMode.default=UART0 / Hardware CDC
13127+
dfrobot_lorawan_esp32s3.menu.UploadMode.default.upload.use_1200bps_touch=false
13128+
dfrobot_lorawan_esp32s3.menu.UploadMode.default.upload.wait_for_upload_port=false
13129+
dfrobot_lorawan_esp32s3.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB)
13130+
dfrobot_lorawan_esp32s3.menu.UploadMode.cdc.upload.use_1200bps_touch=true
13131+
dfrobot_lorawan_esp32s3.menu.UploadMode.cdc.upload.wait_for_upload_port=true
13132+
13133+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
13134+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.default.build.partitions=default
13135+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
13136+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
13137+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
13138+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.minimal.build.partitions=minimal
13139+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
13140+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.no_ota.build.partitions=no_ota
13141+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
13142+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
13143+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
13144+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
13145+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
13146+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
13147+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
13148+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
13149+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
13150+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
13151+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
13152+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.huge_app.build.partitions=huge_app
13153+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
13154+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
13155+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
13156+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
13157+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.rainmaker=RainMaker 4MB
13158+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.rainmaker.build.partitions=rainmaker
13159+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.rainmaker.upload.maximum_size=1966080
13160+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.rainmaker_4MB=RainMaker 4MB No OTA
13161+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.rainmaker_4MB.build.partitions=rainmaker_4MB_no_ota
13162+
dfrobot_lorawan_esp32s3.menu.PartitionScheme.rainmaker_4MB.upload.maximum_size=4038656
13163+
13164+
13165+
dfrobot_lorawan_esp32s3.menu.CPUFreq.240=240MHz (WiFi)
13166+
dfrobot_lorawan_esp32s3.menu.CPUFreq.240.build.f_cpu=240000000L
13167+
dfrobot_lorawan_esp32s3.menu.CPUFreq.160=160MHz (WiFi)
13168+
dfrobot_lorawan_esp32s3.menu.CPUFreq.160.build.f_cpu=160000000L
13169+
dfrobot_lorawan_esp32s3.menu.CPUFreq.80=80MHz (WiFi)
13170+
dfrobot_lorawan_esp32s3.menu.CPUFreq.80.build.f_cpu=80000000L
13171+
dfrobot_lorawan_esp32s3.menu.CPUFreq.40=40MHz
13172+
dfrobot_lorawan_esp32s3.menu.CPUFreq.40.build.f_cpu=40000000L
13173+
dfrobot_lorawan_esp32s3.menu.CPUFreq.20=20MHz
13174+
dfrobot_lorawan_esp32s3.menu.CPUFreq.20.build.f_cpu=20000000L
13175+
dfrobot_lorawan_esp32s3.menu.CPUFreq.10=10MHz
13176+
dfrobot_lorawan_esp32s3.menu.CPUFreq.10.build.f_cpu=10000000L
13177+
13178+
dfrobot_lorawan_esp32s3.menu.UploadSpeed.921600=921600
13179+
dfrobot_lorawan_esp32s3.menu.UploadSpeed.921600.upload.speed=921600
13180+
dfrobot_lorawan_esp32s3.menu.UploadSpeed.115200=115200
13181+
dfrobot_lorawan_esp32s3.menu.UploadSpeed.115200.upload.speed=115200
13182+
dfrobot_lorawan_esp32s3.menu.UploadSpeed.256000.windows=256000
13183+
dfrobot_lorawan_esp32s3.menu.UploadSpeed.256000.upload.speed=256000
13184+
dfrobot_lorawan_esp32s3.menu.UploadSpeed.230400.windows.upload.speed=256000
13185+
dfrobot_lorawan_esp32s3.menu.UploadSpeed.230400=230400
13186+
dfrobot_lorawan_esp32s3.menu.UploadSpeed.230400.upload.speed=230400
13187+
dfrobot_lorawan_esp32s3.menu.UploadSpeed.460800.linux=460800
13188+
dfrobot_lorawan_esp32s3.menu.UploadSpeed.460800.macosx=460800
13189+
dfrobot_lorawan_esp32s3.menu.UploadSpeed.460800.upload.speed=460800
13190+
dfrobot_lorawan_esp32s3.menu.UploadSpeed.512000.windows=512000
13191+
dfrobot_lorawan_esp32s3.menu.UploadSpeed.512000.upload.speed=512000
13192+
13193+
dfrobot_lorawan_esp32s3.menu.DebugLevel.none=None
13194+
dfrobot_lorawan_esp32s3.menu.DebugLevel.none.build.code_debug=0
13195+
dfrobot_lorawan_esp32s3.menu.DebugLevel.error=Error
13196+
dfrobot_lorawan_esp32s3.menu.DebugLevel.error.build.code_debug=1
13197+
dfrobot_lorawan_esp32s3.menu.DebugLevel.warn=Warn
13198+
dfrobot_lorawan_esp32s3.menu.DebugLevel.warn.build.code_debug=2
13199+
dfrobot_lorawan_esp32s3.menu.DebugLevel.info=Info
13200+
dfrobot_lorawan_esp32s3.menu.DebugLevel.info.build.code_debug=3
13201+
dfrobot_lorawan_esp32s3.menu.DebugLevel.debug=Debug
13202+
dfrobot_lorawan_esp32s3.menu.DebugLevel.debug.build.code_debug=4
13203+
dfrobot_lorawan_esp32s3.menu.DebugLevel.verbose=Verbose
13204+
dfrobot_lorawan_esp32s3.menu.DebugLevel.verbose.build.code_debug=5
13205+
13206+
dfrobot_lorawan_esp32s3.menu.EraseFlash.none=Disabled
13207+
dfrobot_lorawan_esp32s3.menu.EraseFlash.none.upload.erase_cmd=
13208+
dfrobot_lorawan_esp32s3.menu.EraseFlash.all=Enabled
13209+
dfrobot_lorawan_esp32s3.menu.EraseFlash.all.upload.erase_cmd=-e
13210+
13211+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.0=REGION_EU868
13212+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.0.build.band=REGION_EU868
13213+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.1=REGION_EU433
13214+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.1.build.band=REGION_EU433
13215+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.2=REGION_CN470
13216+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.2.build.band=REGION_CN470
13217+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.3=REGION_US915
13218+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.3.build.band=REGION_US915
13219+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.4=REGION_AU915
13220+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.4.build.band=REGION_AU915
13221+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.5=REGION_CN779
13222+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.5.build.band=REGION_CN779
13223+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.6=REGION_AS923
13224+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.6.build.band=REGION_AS923
13225+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.7=REGION_KR920
13226+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.7.build.band=REGION_KR920
13227+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.8=REGION_IN865
13228+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.8.build.band=REGION_IN865
13229+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.9=REGION_US915_HYBRID
13230+
dfrobot_lorawan_esp32s3.menu.LORAWAN_REGION.9.build.band=REGION_US915_HYBRID
13231+
1302613232
##############################################################
1302713233

1302813234
firebeetle32.name=FireBeetle-ESP32

libraries/ESP_SR/src/esp32-hal-sr.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ static void audio_feed_task(void *arg) {
192192

193193
/* Feed samples of an audio stream to the AFE_SR */
194194
g_sr_data->afe_handle->feed(g_sr_data->afe_data, audio_buffer);
195+
vTaskDelay(2);
195196
}
196197
vTaskDelete(NULL);
197198
}

libraries/Zigbee/examples/Zigbee_Analog_Input_Output/Zigbee_Analog_Input_Output.ino

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ uint8_t analogPin = A0;
3939
uint8_t button = BOOT_PIN;
4040

4141
ZigbeeAnalog zbAnalogDevice = ZigbeeAnalog(ANALOG_DEVICE_ENDPOINT_NUMBER);
42+
ZigbeeAnalog zbAnalogTemp = ZigbeeAnalog(ANALOG_DEVICE_ENDPOINT_NUMBER + 1);
43+
ZigbeeAnalog zbAnalogFan = ZigbeeAnalog(ANALOG_DEVICE_ENDPOINT_NUMBER + 2);
44+
ZigbeeAnalog zbAnalogPercent = ZigbeeAnalog(ANALOG_DEVICE_ENDPOINT_NUMBER + 3);
4245

4346
void onAnalogOutputChange(float analog_output) {
4447
Serial.printf("Received analog output change: %.1f\r\n", analog_output);
@@ -57,15 +60,43 @@ void setup() {
5760
// Optional: set Zigbee device name and model
5861
zbAnalogDevice.setManufacturerAndModel("Espressif", "ZigbeeAnalogDevice");
5962

60-
// Add analog clusters to Zigbee Analog according your needs
63+
// Set up analog input
6164
zbAnalogDevice.addAnalogInput();
65+
zbAnalogDevice.setAnalogInputApplication(ESP_ZB_ZCL_AI_POWER_IN_WATTS_CONSUMPTION);
66+
zbAnalogDevice.setAnalogInputDescription("Power Consumption (Watts)");
67+
zbAnalogDevice.setAnalogInputResolution(0.01);
68+
69+
// Set up analog output
6270
zbAnalogDevice.addAnalogOutput();
71+
zbAnalogDevice.setAnalogOutputApplication(ESP_ZB_ZCL_AI_RPM_OTHER);
72+
zbAnalogDevice.setAnalogOutputDescription("Fan Speed (RPM)");
6373

6474
// If analog output cluster is added, set callback function for analog output change
6575
zbAnalogDevice.onAnalogOutputChange(onAnalogOutputChange);
6676

77+
// Set up analog input
78+
zbAnalogTemp.addAnalogInput();
79+
zbAnalogTemp.setAnalogInputApplication(ESP_ZB_ZCL_AI_TEMPERATURE_OTHER);
80+
zbAnalogTemp.setAnalogInputDescription("Temperature");
81+
zbAnalogTemp.setAnalogInputResolution(0.1);
82+
83+
// Set up analog input
84+
zbAnalogFan.addAnalogInput();
85+
zbAnalogFan.setAnalogInputApplication(ESP_ZB_ZCL_AI_RPM_OTHER);
86+
zbAnalogFan.setAnalogInputDescription("RPM");
87+
zbAnalogFan.setAnalogInputResolution(1);
88+
89+
// Set up analog input
90+
zbAnalogPercent.addAnalogInput();
91+
zbAnalogPercent.setAnalogInputApplication(ESP_ZB_ZCL_AI_PERCENTAGE_OTHER);
92+
zbAnalogPercent.setAnalogInputDescription("Percentage");
93+
zbAnalogPercent.setAnalogInputResolution(0.01);
94+
6795
// Add endpoints to Zigbee Core
6896
Zigbee.addEndpoint(&zbAnalogDevice);
97+
Zigbee.addEndpoint(&zbAnalogTemp);
98+
Zigbee.addEndpoint(&zbAnalogFan);
99+
Zigbee.addEndpoint(&zbAnalogPercent);
69100

70101
Serial.println("Starting Zigbee...");
71102
// When all EPs are registered, start Zigbee in End Device mode
@@ -95,9 +126,15 @@ void loop() {
95126
float analog = (float)analogRead(analogPin);
96127
Serial.printf("Updating analog input to %.1f\r\n", analog);
97128
zbAnalogDevice.setAnalogInput(analog);
129+
zbAnalogTemp.setAnalogInput(analog / 100);
130+
zbAnalogFan.setAnalogInput(analog);
131+
zbAnalogPercent.setAnalogInput(analog / 10);
98132

99133
// Analog input supports reporting
100134
zbAnalogDevice.reportAnalogInput();
135+
zbAnalogTemp.reportAnalogInput();
136+
zbAnalogFan.reportAnalogInput();
137+
zbAnalogPercent.reportAnalogInput();
101138
}
102139

103140
// Checking button for factory reset and reporting
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Arduino-ESP32 Zigbee Binary Input Example
2+
3+
This example shows how to configure the Zigbee end device and use it as a Home Automation (HA) binary input device with two different applications: HVAC fan status and security zone armed status.
4+
5+
# Supported Targets
6+
7+
Currently, this example supports the following targets.
8+
9+
| Supported Targets | ESP32-C6 | ESP32-H2 |
10+
| ----------------- | -------- | -------- |
11+
12+
## Binary Input Functions
13+
14+
* The example implements two binary inputs:
15+
- HVAC Fan Status: Reports the current state of a fan
16+
- Security Zone Armed: Reports the armed state of a security zone
17+
* By clicking the button (BOOT) on this board, it will toggle both binary inputs and immediately send a report of their states to the network.
18+
* Holding the button for more than 3 seconds will trigger a factory reset of the Zigbee device.
19+
20+
## Hardware Required
21+
22+
* A USB cable for power supply and programming
23+
24+
### Configure the Project
25+
26+
The example uses the following default pins:
27+
* Button: `BOOT_PIN` (BOOT button on ESP32-C6 and ESP32-H2)
28+
29+
#### Using Arduino IDE
30+
31+
To get more information about the Espressif boards see [Espressif Development Kits](https://www.espressif.com/en/products/devkits).
32+
33+
* Before Compile/Verify, select the correct board: `Tools -> Board`.
34+
* Select the End device Zigbee mode: `Tools -> Zigbee mode: Zigbee ED (end device)`
35+
* Select Partition Scheme for Zigbee: `Tools -> Partition Scheme: Zigbee 4MB with spiffs`
36+
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
37+
* Optional: Set debug level to verbose to see all logs from Zigbee stack: `Tools -> Core Debug Level: Verbose`.
38+
39+
## Troubleshooting
40+
41+
If the End device flashed with this example is not connecting to the coordinator, erase the flash of the End device before flashing the example to the board. It is recommended to do this if you re-flash the coordinator.
42+
You can do the following:
43+
44+
* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`.
45+
* Add to the sketch `Zigbee.factoryReset();` to reset the device and Zigbee stack.
46+
47+
By default, the coordinator network is closed after rebooting or flashing new firmware.
48+
To open the network you have 2 options:
49+
50+
* Open network after reboot by setting `Zigbee.setRebootOpenNetwork(time);` before calling `Zigbee.begin();`.
51+
* In application you can anytime call `Zigbee.openNetwork(time);` to open the network for devices to join.
52+
53+
***Important: Make sure you are using a good quality USB cable and that you have a reliable power source***
54+
55+
* **LED not blinking:** Check the wiring connection and the IO selection.
56+
* **Programming Fail:** If the programming/flash procedure fails, try reducing the serial connection speed.
57+
* **COM port not detected:** Check the USB cable and the USB to Serial driver installation.
58+
59+
If the error persists, you can ask for help at the official [ESP32 forum](https://esp32.com) or see [Contribute](#contribute).
60+
61+
## Contribute
62+
63+
To know how to contribute to this project, see [How to contribute.](https://github.com/espressif/arduino-esp32/blob/master/CONTRIBUTING.rst)
64+
65+
If you have any **feedback** or **issue** to report on this example/library, please open an issue or fix it by creating a new PR. Contributions are more than welcome!
66+
67+
Before creating a new issue, be sure to try Troubleshooting and check if the same issue was already created by someone else.
68+
69+
## Resources
70+
71+
* Official ESP32 Forum: [Link](https://esp32.com)
72+
* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32)
73+
* ESP32-C6 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf)
74+
* ESP32-H2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-h2_datasheet_en.pdf)
75+
* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com)

0 commit comments

Comments
 (0)