You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've created a zigbee network with Aruba APs.
Using the scan networks example, it finds the network.
09:36:32.411 -> Nr | PAN ID | CH | Permit Joining | Router Capacity | End Device Capacity | Extended PAN ID
09:36:32.411 -> 1 | 0xa177 | 13 | Yes | Yes | Yes | 28:de:65...
09:36:32.411 -> 2 | 0xa177 | 11 | Yes | Yes | Yes | 28:de:65...
09:36:32.450 -> 3 | 0xa177 | 19 | Yes | Yes | Yes | 28:de:65...
09:36:32.450 -> 4 | 0xa177 | 11 | Yes | Yes | Yes | 28:de:65...
09:36:32.450 -> 5 | 0xa177 | 14 | Yes | Yes | Yes | 28:de:65...
09:36:32.450 -> 6 | 0xa177 | 20 | Yes | Yes | Yes | 28:de:65...
Sketch
// Copyright 2024 Espressif Systems (Shanghai) PTE LTD//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at//// http://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License./** * @brief This example demonstrates Zigbee temperature sensor. * * The example demonstrates how to use Zigbee library to create a end device temperature sensor. * The temperature sensor is a Zigbee end device, which is controlled by a Zigbee coordinator. * * Proper Zigbee mode must be selected in Tools->Zigbee mode * and also the correct partition scheme must be selected in Tools->Partition Scheme. * * Please check the README.md for instructions and more detailed description. * * Created by Jan Procházka (https://github.com/P-R-O-C-H-Y/)*/
#ifndef ZIGBEE_MODE_ED
#error "Zigbee end device mode is not selected in Tools->Zigbee mode"
#endif
#include"Zigbee.h"/* Zigbee temperature sensor configuration */
#defineTEMP_SENSOR_ENDPOINT_NUMBER10uint8_t button = BOOT_PIN;
// Optional Time cluster variablesstructtm timeinfo;
structtm *localTime;
int32_ttimezone;
ZigbeeTempSensor zbTempSensor = ZigbeeTempSensor(TEMP_SENSOR_ENDPOINT_NUMBER);
/********************* Arduino functions **************************/voidsetup() {
Serial.begin(115200);
// Init button switchpinMode(button, INPUT_PULLUP);
// Optional: set Zigbee device name and model
zbTempSensor.setManufacturerAndModel("Espressif", "ZigbeeTempSensor");
// Set minimum and maximum temperature measurement value (10-50°C is default range for chip temperature measurement)
zbTempSensor.setMinMaxValue(10, 50);
// Optional: Set tolerance for temperature measurement in °C (lowest possible value is 0.01°C)
zbTempSensor.setTolerance(1);
// Optional: Time cluster configuration (default params, as this device will revieve time from coordinator)
zbTempSensor.addTimeCluster();
// Add endpoint to Zigbee Core
Zigbee.addEndpoint(&zbTempSensor);
float tsens_value = temperatureRead();
Serial.printf("Updated temperature sensor value to %.2f°C\r\n", tsens_value);
// Update temperature value in Temperature sensor EP
zbTempSensor.setTemperature(tsens_value);
Serial.println("Starting Zigbee...");
// When all EPs are registered, start Zigbee in End Device modeif (!Zigbee.begin()) {
Serial.println("Zigbee failed to start!");
Serial.println("Rebooting...");
ESP.restart();
} else {
Serial.println("Zigbee started successfully!");
}
Serial.println("Connecting to network");
while (!Zigbee.connected()) {
Serial.print(".");
delay(100);
}
Serial.println("Connected");
// Optional: If time cluster is added, time can be read from the coordinator
timeinfo = zbTempSensor.getTime();
timezone = zbTempSensor.getTimezone();
Serial.println("UTC time:");
Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");
time_t local = mktime(&timeinfo) + timezone;
localTime = localtime(&local);
Serial.println("Local time with timezone:");
Serial.println(localTime, "%A, %B %d %Y %H:%M:%S");
// Set reporting interval for temperature measurement in seconds, must be called after Zigbee.begin()// min_interval and max_interval in seconds, delta (temp change in 0,1 °C)// if min = 1 and max = 0, reporting is sent only when temperature changes by delta// if min = 0 and max = 10, reporting is sent every 10 seconds or temperature changes by delta// if min = 0, max = 10 and delta = 0, reporting is sent every 10 seconds regardless of temperature change
zbTempSensor.setReporting(1, 0, 1);
}
voidloop() {
// Checking button for factory resetif (digitalRead(button) == LOW) { // Push button pressed// Key debounce handlingdelay(100);
int startTime = millis();
while (digitalRead(button) == LOW) {
delay(50);
if ((millis() - startTime) > 3000) {
// If key pressed for more than 3secs, factory reset Zigbee and reboot
Serial.println("Resetting Zigbee to factory and rebooting in 1s.");
delay(1000);
Zigbee.factoryReset();
}
}
zbTempSensor.reportTemperature();
}
delay(100);
}
@vatsake You cannot set the temp when the device is not connected. Please move:
float tsens_value = temperatureRead();
Serial.printf("Updated temperature sensor value to %.2f°C\r\n", tsens_value);
// Update temperature value in Temperature sensor EP
zbTempSensor.setTemperature(tsens_value);
After Zigbee.begin() or better after Zigbee.connected().
You can take a look to the examples to see how to do that correct way.
@P-R-O-C-H-Y Thanks for the reply, I moved them after zigbee is connected, but nothing changed.
Serial doesn't print "Connected" (which is after the while loop), so it crashes during connection.
Board
ESP32-H2-MINI-1
Device Description
Plain module
Hardware Configuration
No, just USB-C.
Version
latest stable Release (if not listed below)
IDE Name
Arduino IDE
Operating System
Win 11
Flash frequency
64Mhz
PSRAM enabled
yes
Upload speed
115200
Description
I've created a zigbee network with Aruba APs.
Using the scan networks example, it finds the network.
09:36:32.411 -> Nr | PAN ID | CH | Permit Joining | Router Capacity | End Device Capacity | Extended PAN ID
09:36:32.411 -> 1 | 0xa177 | 13 | Yes | Yes | Yes | 28:de:65...
09:36:32.411 -> 2 | 0xa177 | 11 | Yes | Yes | Yes | 28:de:65...
09:36:32.450 -> 3 | 0xa177 | 19 | Yes | Yes | Yes | 28:de:65...
09:36:32.450 -> 4 | 0xa177 | 11 | Yes | Yes | Yes | 28:de:65...
09:36:32.450 -> 5 | 0xa177 | 14 | Yes | Yes | Yes | 28:de:65...
09:36:32.450 -> 6 | 0xa177 | 20 | Yes | Yes | Yes | 28:de:65...
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: