Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
cb635e3
Create ZigbeeWindSpeedSensor.h
lboue Oct 13, 2024
7cf9246
Create ZigbeeWindSpeedSensor.cpp
lboue Oct 13, 2024
2f35d86
Update ZigbeeWindSpeedSensor.cpp
lboue Oct 13, 2024
f063d8d
Update ZigbeeWindSpeedSensor.cpp
lboue Oct 13, 2024
5b149f6
Create ZigbeeWindSpeedSensor.ino
lboue Oct 13, 2024
bbf625c
Update ZigbeeWindSpeedSensor.ino
lboue Oct 13, 2024
d3e7685
Update ZigbeeWindSpeedSensor.ino
lboue Oct 13, 2024
1da3fbe
Create ci.json
lboue Oct 13, 2024
56e5091
Rename ZigbeeWindSpeedSensor.ino to Zigbee_Wind_Speed_Sensor.ino
lboue Oct 13, 2024
69be635
Rename ci.json to ci.json
lboue Oct 13, 2024
cb1b062
Update CMakeLists.txt
lboue Oct 13, 2024
52ab37c
Update Zigbee_Wind_Speed_Sensor.ino
lboue Oct 13, 2024
47cf600
Update Zigbee_Wind_Speed_Sensor.ino
lboue Oct 13, 2024
94a3cbb
Update Zigbee_Wind_Speed_Sensor.ino
lboue Oct 13, 2024
efa1c46
Update ZigbeeWindSpeedSensor.cpp
lboue Oct 13, 2024
bd56b00
Update ZigbeeWindSpeedSensor.cpp
lboue Oct 15, 2024
87c438e
Merge branch 'master' into WindSpeedSensor
lboue Oct 30, 2024
2d0a597
Merge branch 'master' into WindSpeedSensor
P-R-O-C-H-Y Mar 11, 2025
5dc5f7f
feat(zigbee): Add windspeed sensor endpoint
P-R-O-C-H-Y Mar 11, 2025
23a2967
Update Zigbee.h
lboue Mar 11, 2025
a08bfd4
update example
P-R-O-C-H-Y Mar 11, 2025
9df06c5
add missing sdkconfig include
P-R-O-C-H-Y Mar 11, 2025
30482f1
add readme
P-R-O-C-H-Y Mar 11, 2025
216f1f1
ci(pre-commit): Apply automatic fixes
pre-commit-ci-lite[bot] Mar 12, 2025
da5080d
Update README.md
P-R-O-C-H-Y Mar 12, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Create ZigbeeWindSpeedSensor.ino
  • Loading branch information
lboue authored Oct 13, 2024
commit 5b149f6a25234e378bbfab7def91fd95b3d104d5
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// 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 wind speed sensor.
* The wind speed 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 coordinator mode is not selected in Tools->Zigbee mode"
#endif

#include "ZigbeeCore.h"
#include "ep/ZigbeeWindSpeedSensor.h"

#define BUTTON_PIN 9 //Boot button for C6/H2
#define TEMP_SENSOR_ENDPOINT_NUMBER 10

ZigbeeWindSpeedSensor zbWindSpeedSensor = ZigbeeWindSpeedSensor(TEMP_SENSOR_ENDPOINT_NUMBER);

/************************ Temp sensor *****************************/
static void windspeed_sensor_value_update(void *arg) {
for (;;) {
// Read temperature sensor value
float tsens_value = temperatureRead();
log_v("Temperature sensor value: %.2f°C", tsens_value);
// Update temperature value in Temperature sensor EP
zbWindSpeedSensor.setWindspeed(tsens_value);
delay(1000);
}
}

/********************* Arduino functions **************************/
void setup() {

Serial.begin(115200);
while (!Serial) {
delay(10);
}

// Init button switch
pinMode(BUTTON_PIN, INPUT);

// Optional: set Zigbee device name and model
zbWindSpeedSensor.setManufacturerAndModel("Espressif", "ZigbeeWindSpeedSensor");

// Set minimum and maximum temperature measurement value (10-50°C is default range for chip temperature measurement)
zbWindSpeedSensor.setMinMaxValue(10, 50);

// Set tolerance for temperature measurement in °C (lowest possible value is 0.01°C)
zbWindSpeedSensor.setTolerance(1);

// Add endpoint to Zigbee Core
Zigbee.addEndpoint(&zbWindSpeedSensor);

// When all EPs are registered, start Zigbee in End Device mode
Zigbee.begin();

// Start Wind speed sensor reading task
xTaskCreate(windspeed_sensor_value_update, "wind_speed_sensor_update", 2048, NULL, 10, NULL);

// 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 °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
zbWindSpeedSensor.setReporting(1, 0, 1);
}

void loop() {
// Checking button for factory reset
if (digitalRead(BUTTON_PIN) == LOW) { // Push button pressed
// Key debounce handling
delay(100);
int startTime = millis();
while (digitalRead(BUTTON_PIN) == LOW) {
delay(50);
if ((millis() - startTime) > 3000) {
// If key pressed for more than 3secs, factory reset Zigbee and reboot
Serial.printf("Resetting Zigbee to factory settings, reboot.\n");
Zigbee.factoryReset();
}
}
zbWindSpeedSensor.reportWindspeed();
}
delay(100);
}
Loading