Skip to content

Commit 53e672e

Browse files
committed
feat(zigbee): Update temp examples
1 parent e41c6a9 commit 53e672e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

libraries/Zigbee/examples/Zigbee_Temp_Hum_Sensor_Sleepy/Zigbee_Temp_Hum_Sensor_Sleepy.ino

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,18 @@ void setup() {
135135
// Set minimum and maximum temperature measurement value (10-50°C is default range for chip temperature measurement)
136136
zbTempSensor.setMinMaxValue(10, 50);
137137

138+
// Set default (initial) value for the temperature sensor to 10.0°C to match the minimum temperature measurement value (default value is 0.0°C)
139+
zbTempSensor.setDefaultValue(10.0);
140+
138141
// Set tolerance for temperature measurement in °C (lowest possible value is 0.01°C)
139142
zbTempSensor.setTolerance(1);
140143

141144
// Set power source to battery, battery percentage and battery voltage (now 100% and 3.5V for demonstration)
142145
// The value can be also updated by calling zbTempSensor.setBatteryPercentage(percentage) or zbTempSensor.setBatteryVoltage(voltage) anytime after Zigbee.begin()
143146
zbTempSensor.setPowerSource(ZB_POWER_SOURCE_BATTERY, 100, 35);
144147

145-
// Add humidity cluster to the temperature sensor device with min, max and tolerance values
146-
zbTempSensor.addHumiditySensor(0, 100, 1);
148+
// Add humidity cluster to the temperature sensor device with min, max, tolerance and default values
149+
zbTempSensor.addHumiditySensor(0, 100, 1, 0.0);
147150

148151
// Set callback for default response to handle status of reported data, there are 2 options.
149152

libraries/Zigbee/examples/Zigbee_Temperature_Sensor/Zigbee_Temperature_Sensor.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ void setup() {
6868
// Set minimum and maximum temperature measurement value (10-50°C is default range for chip temperature measurement)
6969
zbTempSensor.setMinMaxValue(10, 50);
7070

71+
// Optional: Set default (initial) value for the temperature sensor to 10.0°C to match the minimum temperature measurement value
72+
zbTempSensor.setDefaultValue(10.0);
73+
7174
// Optional: Set tolerance for temperature measurement in °C (lowest possible value is 0.01°C)
7275
zbTempSensor.setTolerance(1);
7376

0 commit comments

Comments
 (0)