From 0afec00eb34ea03874fa4e30bdb3f01ec99ebfc8 Mon Sep 17 00:00:00 2001 From: Chris Jackson Date: Fri, 19 Jul 2024 07:53:09 +1200 Subject: [PATCH] Add PM2.5, CO, CO2 and Formaldehyde measurement clusters (#1432) * Add PM2.5, CO and CO2 measurement clusters Signed-off-by: Chris Jackson * Add Formaldehyde measurement Signed-off-by: Chris Jackson --------- Signed-off-by: Chris Jackson --- .../zigbee/autocode/ZigBeeCodeGenerator.java | 6 + .../main/resources/040C_CarbonMonoxide.xml | 30 ++ .../src/main/resources/040D_CarbonDioxide.xml | 30 ++ .../main/resources/042A_PM25Measurement.xml | 30 ++ .../042B_FormaldehydeMeasurement.xml | 30 ++ .../ZclCarbonDioxideMeasurementCluster.java | 389 ++++++++++++++++++ .../ZclCarbonMonoxideMeasurementCluster.java | 389 ++++++++++++++++++ .../ZclFormaldehydeMeasurementCluster.java | 389 ++++++++++++++++++ .../clusters/ZclPm25MeasurementCluster.java | 389 ++++++++++++++++++ .../zigbee/zcl/protocol/ZclClusterType.java | 10 +- 10 files changed, 1691 insertions(+), 1 deletion(-) create mode 100644 com.zsmartsystems.zigbee.autocode/src/main/resources/040C_CarbonMonoxide.xml create mode 100644 com.zsmartsystems.zigbee.autocode/src/main/resources/040D_CarbonDioxide.xml create mode 100644 com.zsmartsystems.zigbee.autocode/src/main/resources/042A_PM25Measurement.xml create mode 100644 com.zsmartsystems.zigbee.autocode/src/main/resources/042B_FormaldehydeMeasurement.xml create mode 100644 com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclCarbonDioxideMeasurementCluster.java create mode 100644 com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclCarbonMonoxideMeasurementCluster.java create mode 100644 com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclFormaldehydeMeasurementCluster.java create mode 100644 com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclPm25MeasurementCluster.java diff --git a/com.zsmartsystems.zigbee.autocode/src/main/java/com/zsmartsystems/zigbee/autocode/ZigBeeCodeGenerator.java b/com.zsmartsystems.zigbee.autocode/src/main/java/com/zsmartsystems/zigbee/autocode/ZigBeeCodeGenerator.java index ca6c225d8..72cd76077 100644 --- a/com.zsmartsystems.zigbee.autocode/src/main/java/com/zsmartsystems/zigbee/autocode/ZigBeeCodeGenerator.java +++ b/com.zsmartsystems.zigbee.autocode/src/main/java/com/zsmartsystems/zigbee/autocode/ZigBeeCodeGenerator.java @@ -88,6 +88,12 @@ public static void main(final String[] args) { zclParser.addFile("src/main/resources/0407_LeafWetness.xml"); zclParser.addFile("src/main/resources/0408_SoilMoisture.xml"); + zclParser.addFile("src/main/resources/040C_CarbonMonoxide.xml"); + zclParser.addFile("src/main/resources/040D_CarbonDioxide.xml"); + + zclParser.addFile("src/main/resources/042A_PM25Measurement.xml"); + zclParser.addFile("src/main/resources/042B_FormaldehydeMeasurement.xml"); + zclParser.addFile("src/main/resources/0500_IasZone.xml"); zclParser.addFile("src/main/resources/0501_IasAce.xml"); zclParser.addFile("src/main/resources/0502_IasWd.xml"); diff --git a/com.zsmartsystems.zigbee.autocode/src/main/resources/040C_CarbonMonoxide.xml b/com.zsmartsystems.zigbee.autocode/src/main/resources/040C_CarbonMonoxide.xml new file mode 100644 index 000000000..5c926ad19 --- /dev/null +++ b/com.zsmartsystems.zigbee.autocode/src/main/resources/040C_CarbonMonoxide.xml @@ -0,0 +1,30 @@ + + Carbon Monoxide Measurement + The cluster provides an interface for measurement of Carbon Monoxide + + Measured Value + MeasuredValue represents the concentration as a fraction of 1 (one). + A value of NaN indicates that the concentration measurement is unknown or outside the valid range. + MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + MeasuredValue is updated continuously as new measurements are made. + + + Min Measured Value + The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can be measured. A value of NaN means this attribute is not defined. + + + Max Measured Value + The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can be measured. A value of NaN means this attribute is not defined. + MaxMeasuredValue shall be greater than MinMeasuredValue. + MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + + + Tolerance + The Tolerance attribute indicates the magnitude of the possible error that is associated with MeasuredValue . The true value is located in the range (MeasuredValue – Tolerance) to (MeasuredValue + Tolerance). + + diff --git a/com.zsmartsystems.zigbee.autocode/src/main/resources/040D_CarbonDioxide.xml b/com.zsmartsystems.zigbee.autocode/src/main/resources/040D_CarbonDioxide.xml new file mode 100644 index 000000000..84c6fd801 --- /dev/null +++ b/com.zsmartsystems.zigbee.autocode/src/main/resources/040D_CarbonDioxide.xml @@ -0,0 +1,30 @@ + + Carbon Dioxide Measurement + The cluster provides an interface for measurement of Carbon Dioxide + + Measured Value + MeasuredValue represents the concentration as a fraction of 1 (one). + A value of NaN indicates that the concentration measurement is unknown or outside the valid range. + MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + MeasuredValue is updated continuously as new measurements are made. + + + Min Measured Value + The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can be measured. A value of NaN means this attribute is not defined. + + + Max Measured Value + The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can be measured. A value of NaN means this attribute is not defined. + MaxMeasuredValue shall be greater than MinMeasuredValue. + MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + + + Tolerance + The Tolerance attribute indicates the magnitude of the possible error that is associated with MeasuredValue . The true value is located in the range (MeasuredValue – Tolerance) to (MeasuredValue + Tolerance). + + diff --git a/com.zsmartsystems.zigbee.autocode/src/main/resources/042A_PM25Measurement.xml b/com.zsmartsystems.zigbee.autocode/src/main/resources/042A_PM25Measurement.xml new file mode 100644 index 000000000..603fa1775 --- /dev/null +++ b/com.zsmartsystems.zigbee.autocode/src/main/resources/042A_PM25Measurement.xml @@ -0,0 +1,30 @@ + + PM2.5 Measurement + The cluster provides an interface for measurement of Particulate Matter 2.5 microns or less + + Measured Value + MeasuredValue represents the concentration as a fraction of 1 (one). + A value of NaN indicates that the concentration measurement is unknown or outside the valid range. + MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + MeasuredValue is updated continuously as new measurements are made. + + + Min Measured Value + The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can be measured. A value of NaN means this attribute is not defined. + + + Max Measured Value + The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can be measured. A value of NaN means this attribute is not defined. + MaxMeasuredValue shall be greater than MinMeasuredValue. + MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + + + Tolerance + The Tolerance attribute indicates the magnitude of the possible error that is associated with MeasuredValue . The true value is located in the range (MeasuredValue – Tolerance) to (MeasuredValue + Tolerance). + + diff --git a/com.zsmartsystems.zigbee.autocode/src/main/resources/042B_FormaldehydeMeasurement.xml b/com.zsmartsystems.zigbee.autocode/src/main/resources/042B_FormaldehydeMeasurement.xml new file mode 100644 index 000000000..1aa571580 --- /dev/null +++ b/com.zsmartsystems.zigbee.autocode/src/main/resources/042B_FormaldehydeMeasurement.xml @@ -0,0 +1,30 @@ + + Formaldehyde Measurement + The cluster provides an interface for measurement of Formaldehyde + + Measured Value + MeasuredValue represents the concentration as a fraction of 1 (one). + A value of NaN indicates that the concentration measurement is unknown or outside the valid range. + MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + MeasuredValue is updated continuously as new measurements are made. + + + Min Measured Value + The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can be measured. A value of NaN means this attribute is not defined. + + + Max Measured Value + The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can be measured. A value of NaN means this attribute is not defined. + MaxMeasuredValue shall be greater than MinMeasuredValue. + MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + + + Tolerance + The Tolerance attribute indicates the magnitude of the possible error that is associated with MeasuredValue . The true value is located in the range (MeasuredValue – Tolerance) to (MeasuredValue + Tolerance). + + diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclCarbonDioxideMeasurementCluster.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclCarbonDioxideMeasurementCluster.java new file mode 100644 index 000000000..4708ebc83 --- /dev/null +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclCarbonDioxideMeasurementCluster.java @@ -0,0 +1,389 @@ +/** + * Copyright (c) 2016-2024 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.zcl.clusters; + +import java.util.Map; +import java.util.concurrent.ConcurrentSkipListMap; +import java.util.concurrent.Future; + +import javax.annotation.Generated; + +import com.zsmartsystems.zigbee.CommandResult; +import com.zsmartsystems.zigbee.ZigBeeEndpoint; +import com.zsmartsystems.zigbee.zcl.ZclAttribute; +import com.zsmartsystems.zigbee.zcl.ZclCluster; +import com.zsmartsystems.zigbee.zcl.protocol.ZclDataType; + +/** + * Carbon Dioxide Measurement cluster implementation (Cluster ID 0x040D). + *

+ * The cluster provides an interface for measurement of Carbon Dioxide + *

+ * Code is auto-generated. Modifications may be overwritten! + */ +@Generated(value = "com.zsmartsystems.zigbee.autocode.ZigBeeCodeGenerator", date = "2024-07-16T20:26:44Z") +public class ZclCarbonDioxideMeasurementCluster extends ZclCluster { + /** + * The ZigBee Cluster Library Cluster ID + */ + public static final int CLUSTER_ID = 0x040D; + + /** + * The ZigBee Cluster Library Cluster Name + */ + public static final String CLUSTER_NAME = "Carbon Dioxide Measurement"; + + // Attribute constants + /** + * MeasuredValue represents the concentration as a fraction of 1 (one). + *

+ * A value of NaN indicates that the concentration measurement is unknown or outside the + * valid range. + *

+ * MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + *

+ * MeasuredValue is updated continuously as new measurements are made. + */ + public static final int ATTR_MEASUREDVALUE = 0x0000; + /** + * The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + */ + public static final int ATTR_MINMEASUREDVALUE = 0x0001; + /** + * The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * MaxMeasuredValue shall be greater than MinMeasuredValue. + *

+ * MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + */ + public static final int ATTR_MAXMEASUREDVALUE = 0x0002; + /** + * The Tolerance attribute indicates the magnitude of the possible error that is + * associated with MeasuredValue . The true value is located in the range (MeasuredValue – + * Tolerance) to (MeasuredValue + Tolerance). + */ + public static final int ATTR_TOLERANCE = 0x0003; + + @Override + protected Map initializeClientAttributes() { + Map attributeMap = super.initializeClientAttributes(); + + return attributeMap; + } + + @Override + protected Map initializeServerAttributes() { + Map attributeMap = super.initializeServerAttributes(); + + attributeMap.put(ATTR_MEASUREDVALUE, new ZclAttribute(this, ATTR_MEASUREDVALUE, "Measured Value", ZclDataType.FLOAT_32_BIT, true, true, false, true)); + attributeMap.put(ATTR_MINMEASUREDVALUE, new ZclAttribute(this, ATTR_MINMEASUREDVALUE, "Min Measured Value", ZclDataType.FLOAT_32_BIT, true, true, false, false)); + attributeMap.put(ATTR_MAXMEASUREDVALUE, new ZclAttribute(this, ATTR_MAXMEASUREDVALUE, "Max Measured Value", ZclDataType.FLOAT_32_BIT, true, true, false, true)); + attributeMap.put(ATTR_TOLERANCE, new ZclAttribute(this, ATTR_TOLERANCE, "Tolerance", ZclDataType.FLOAT_32_BIT, false, true, false, false)); + + return attributeMap; + } + + + /** + * Default constructor to create a Carbon Dioxide Measurement cluster. + * + * @param zigbeeEndpoint the {@link ZigBeeEndpoint} this cluster is contained within + */ + public ZclCarbonDioxideMeasurementCluster(final ZigBeeEndpoint zigbeeEndpoint) { + super(zigbeeEndpoint, CLUSTER_ID, CLUSTER_NAME); + } + + /** + * Get the Measured Value attribute [attribute ID 0x0000]. + *

+ * MeasuredValue represents the concentration as a fraction of 1 (one). + *

+ * A value of NaN indicates that the concentration measurement is unknown or outside the + * valid range. + *

+ * MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + *

+ * MeasuredValue is updated continuously as new measurements are made. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #readAttribute(int attributeId)} + */ + @Deprecated + public Future getMeasuredValueAsync() { + return read(serverAttributes.get(ATTR_MEASUREDVALUE)); + } + + /** + * Synchronously get the Measured Value attribute [attribute ID 0x0000]. + *

+ * MeasuredValue represents the concentration as a fraction of 1 (one). + *

+ * A value of NaN indicates that the concentration measurement is unknown or outside the + * valid range. + *

+ * MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + *

+ * MeasuredValue is updated continuously as new measurements are made. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + * @deprecated As of release 1.2.0, replaced by {@link #ZclAttribute#readValue(long refreshPeriod)} + */ + @Deprecated + public Double getMeasuredValue(final long refreshPeriod) { + if (serverAttributes.get(ATTR_MEASUREDVALUE).isLastValueCurrent(refreshPeriod)) { + return (Double) serverAttributes.get(ATTR_MEASUREDVALUE).getLastValue(); + } + + return (Double) readSync(serverAttributes.get(ATTR_MEASUREDVALUE)); + } + + /** + * Set reporting for the Measured Value attribute [attribute ID 0x0000]. + *

+ * MeasuredValue represents the concentration as a fraction of 1 (one). + *

+ * A value of NaN indicates that the concentration measurement is unknown or outside the + * valid range. + *

+ * MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + *

+ * MeasuredValue is updated continuously as new measurements are made. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param minInterval minimum reporting period + * @param maxInterval maximum reporting period + * @param reportableChange {@link Object} delta required to trigger report + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #setReporting(int attributeId, int minInterval, int maxInterval, Object reportableChange)} + */ + @Deprecated + public Future setMeasuredValueReporting(final int minInterval, final int maxInterval, final Object reportableChange) { + return setReporting(serverAttributes.get(ATTR_MEASUREDVALUE), minInterval, maxInterval, reportableChange); + } + + /** + * Get the Min Measured Value attribute [attribute ID 0x0001]. + *

+ * The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #readAttribute(int attributeId)} + */ + @Deprecated + public Future getMinMeasuredValueAsync() { + return read(serverAttributes.get(ATTR_MINMEASUREDVALUE)); + } + + /** + * Synchronously get the Min Measured Value attribute [attribute ID 0x0001]. + *

+ * The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + * @deprecated As of release 1.2.0, replaced by {@link #ZclAttribute#readValue(long refreshPeriod)} + */ + @Deprecated + public Double getMinMeasuredValue(final long refreshPeriod) { + if (serverAttributes.get(ATTR_MINMEASUREDVALUE).isLastValueCurrent(refreshPeriod)) { + return (Double) serverAttributes.get(ATTR_MINMEASUREDVALUE).getLastValue(); + } + + return (Double) readSync(serverAttributes.get(ATTR_MINMEASUREDVALUE)); + } + + /** + * Set reporting for the Min Measured Value attribute [attribute ID 0x0001]. + *

+ * The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param minInterval minimum reporting period + * @param maxInterval maximum reporting period + * @param reportableChange {@link Object} delta required to trigger report + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #setReporting(int attributeId, int minInterval, int maxInterval, Object reportableChange)} + */ + @Deprecated + public Future setMinMeasuredValueReporting(final int minInterval, final int maxInterval, final Object reportableChange) { + return setReporting(serverAttributes.get(ATTR_MINMEASUREDVALUE), minInterval, maxInterval, reportableChange); + } + + /** + * Get the Max Measured Value attribute [attribute ID 0x0002]. + *

+ * The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * MaxMeasuredValue shall be greater than MinMeasuredValue. + *

+ * MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #readAttribute(int attributeId)} + */ + @Deprecated + public Future getMaxMeasuredValueAsync() { + return read(serverAttributes.get(ATTR_MAXMEASUREDVALUE)); + } + + /** + * Synchronously get the Max Measured Value attribute [attribute ID 0x0002]. + *

+ * The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * MaxMeasuredValue shall be greater than MinMeasuredValue. + *

+ * MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + * @deprecated As of release 1.2.0, replaced by {@link #ZclAttribute#readValue(long refreshPeriod)} + */ + @Deprecated + public Double getMaxMeasuredValue(final long refreshPeriod) { + if (serverAttributes.get(ATTR_MAXMEASUREDVALUE).isLastValueCurrent(refreshPeriod)) { + return (Double) serverAttributes.get(ATTR_MAXMEASUREDVALUE).getLastValue(); + } + + return (Double) readSync(serverAttributes.get(ATTR_MAXMEASUREDVALUE)); + } + + /** + * Set reporting for the Max Measured Value attribute [attribute ID 0x0002]. + *

+ * The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * MaxMeasuredValue shall be greater than MinMeasuredValue. + *

+ * MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param minInterval minimum reporting period + * @param maxInterval maximum reporting period + * @param reportableChange {@link Object} delta required to trigger report + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #setReporting(int attributeId, int minInterval, int maxInterval, Object reportableChange)} + */ + @Deprecated + public Future setMaxMeasuredValueReporting(final int minInterval, final int maxInterval, final Object reportableChange) { + return setReporting(serverAttributes.get(ATTR_MAXMEASUREDVALUE), minInterval, maxInterval, reportableChange); + } + + /** + * Get the Tolerance attribute [attribute ID 0x0003]. + *

+ * The Tolerance attribute indicates the magnitude of the possible error that is + * associated with MeasuredValue . The true value is located in the range (MeasuredValue – + * Tolerance) to (MeasuredValue + Tolerance). + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #readAttribute(int attributeId)} + */ + @Deprecated + public Future getToleranceAsync() { + return read(serverAttributes.get(ATTR_TOLERANCE)); + } + + /** + * Synchronously get the Tolerance attribute [attribute ID 0x0003]. + *

+ * The Tolerance attribute indicates the magnitude of the possible error that is + * associated with MeasuredValue . The true value is located in the range (MeasuredValue – + * Tolerance) to (MeasuredValue + Tolerance). + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + * @deprecated As of release 1.2.0, replaced by {@link #ZclAttribute#readValue(long refreshPeriod)} + */ + @Deprecated + public Double getTolerance(final long refreshPeriod) { + if (serverAttributes.get(ATTR_TOLERANCE).isLastValueCurrent(refreshPeriod)) { + return (Double) serverAttributes.get(ATTR_TOLERANCE).getLastValue(); + } + + return (Double) readSync(serverAttributes.get(ATTR_TOLERANCE)); + } +} diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclCarbonMonoxideMeasurementCluster.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclCarbonMonoxideMeasurementCluster.java new file mode 100644 index 000000000..06143f07b --- /dev/null +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclCarbonMonoxideMeasurementCluster.java @@ -0,0 +1,389 @@ +/** + * Copyright (c) 2016-2024 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.zcl.clusters; + +import java.util.Map; +import java.util.concurrent.ConcurrentSkipListMap; +import java.util.concurrent.Future; + +import javax.annotation.Generated; + +import com.zsmartsystems.zigbee.CommandResult; +import com.zsmartsystems.zigbee.ZigBeeEndpoint; +import com.zsmartsystems.zigbee.zcl.ZclAttribute; +import com.zsmartsystems.zigbee.zcl.ZclCluster; +import com.zsmartsystems.zigbee.zcl.protocol.ZclDataType; + +/** + * Carbon Monoxide Measurement cluster implementation (Cluster ID 0x040C). + *

+ * The cluster provides an interface for measurement of Carbon Monoxide + *

+ * Code is auto-generated. Modifications may be overwritten! + */ +@Generated(value = "com.zsmartsystems.zigbee.autocode.ZigBeeCodeGenerator", date = "2024-07-16T20:26:44Z") +public class ZclCarbonMonoxideMeasurementCluster extends ZclCluster { + /** + * The ZigBee Cluster Library Cluster ID + */ + public static final int CLUSTER_ID = 0x040C; + + /** + * The ZigBee Cluster Library Cluster Name + */ + public static final String CLUSTER_NAME = "Carbon Monoxide Measurement"; + + // Attribute constants + /** + * MeasuredValue represents the concentration as a fraction of 1 (one). + *

+ * A value of NaN indicates that the concentration measurement is unknown or outside the + * valid range. + *

+ * MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + *

+ * MeasuredValue is updated continuously as new measurements are made. + */ + public static final int ATTR_MEASUREDVALUE = 0x0000; + /** + * The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + */ + public static final int ATTR_MINMEASUREDVALUE = 0x0001; + /** + * The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * MaxMeasuredValue shall be greater than MinMeasuredValue. + *

+ * MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + */ + public static final int ATTR_MAXMEASUREDVALUE = 0x0002; + /** + * The Tolerance attribute indicates the magnitude of the possible error that is + * associated with MeasuredValue . The true value is located in the range (MeasuredValue – + * Tolerance) to (MeasuredValue + Tolerance). + */ + public static final int ATTR_TOLERANCE = 0x0003; + + @Override + protected Map initializeClientAttributes() { + Map attributeMap = super.initializeClientAttributes(); + + return attributeMap; + } + + @Override + protected Map initializeServerAttributes() { + Map attributeMap = super.initializeServerAttributes(); + + attributeMap.put(ATTR_MEASUREDVALUE, new ZclAttribute(this, ATTR_MEASUREDVALUE, "Measured Value", ZclDataType.FLOAT_32_BIT, true, true, false, true)); + attributeMap.put(ATTR_MINMEASUREDVALUE, new ZclAttribute(this, ATTR_MINMEASUREDVALUE, "Min Measured Value", ZclDataType.FLOAT_32_BIT, true, true, false, false)); + attributeMap.put(ATTR_MAXMEASUREDVALUE, new ZclAttribute(this, ATTR_MAXMEASUREDVALUE, "Max Measured Value", ZclDataType.FLOAT_32_BIT, true, true, false, true)); + attributeMap.put(ATTR_TOLERANCE, new ZclAttribute(this, ATTR_TOLERANCE, "Tolerance", ZclDataType.FLOAT_32_BIT, false, true, false, false)); + + return attributeMap; + } + + + /** + * Default constructor to create a Carbon Monoxide Measurement cluster. + * + * @param zigbeeEndpoint the {@link ZigBeeEndpoint} this cluster is contained within + */ + public ZclCarbonMonoxideMeasurementCluster(final ZigBeeEndpoint zigbeeEndpoint) { + super(zigbeeEndpoint, CLUSTER_ID, CLUSTER_NAME); + } + + /** + * Get the Measured Value attribute [attribute ID 0x0000]. + *

+ * MeasuredValue represents the concentration as a fraction of 1 (one). + *

+ * A value of NaN indicates that the concentration measurement is unknown or outside the + * valid range. + *

+ * MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + *

+ * MeasuredValue is updated continuously as new measurements are made. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #readAttribute(int attributeId)} + */ + @Deprecated + public Future getMeasuredValueAsync() { + return read(serverAttributes.get(ATTR_MEASUREDVALUE)); + } + + /** + * Synchronously get the Measured Value attribute [attribute ID 0x0000]. + *

+ * MeasuredValue represents the concentration as a fraction of 1 (one). + *

+ * A value of NaN indicates that the concentration measurement is unknown or outside the + * valid range. + *

+ * MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + *

+ * MeasuredValue is updated continuously as new measurements are made. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + * @deprecated As of release 1.2.0, replaced by {@link #ZclAttribute#readValue(long refreshPeriod)} + */ + @Deprecated + public Double getMeasuredValue(final long refreshPeriod) { + if (serverAttributes.get(ATTR_MEASUREDVALUE).isLastValueCurrent(refreshPeriod)) { + return (Double) serverAttributes.get(ATTR_MEASUREDVALUE).getLastValue(); + } + + return (Double) readSync(serverAttributes.get(ATTR_MEASUREDVALUE)); + } + + /** + * Set reporting for the Measured Value attribute [attribute ID 0x0000]. + *

+ * MeasuredValue represents the concentration as a fraction of 1 (one). + *

+ * A value of NaN indicates that the concentration measurement is unknown or outside the + * valid range. + *

+ * MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + *

+ * MeasuredValue is updated continuously as new measurements are made. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param minInterval minimum reporting period + * @param maxInterval maximum reporting period + * @param reportableChange {@link Object} delta required to trigger report + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #setReporting(int attributeId, int minInterval, int maxInterval, Object reportableChange)} + */ + @Deprecated + public Future setMeasuredValueReporting(final int minInterval, final int maxInterval, final Object reportableChange) { + return setReporting(serverAttributes.get(ATTR_MEASUREDVALUE), minInterval, maxInterval, reportableChange); + } + + /** + * Get the Min Measured Value attribute [attribute ID 0x0001]. + *

+ * The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #readAttribute(int attributeId)} + */ + @Deprecated + public Future getMinMeasuredValueAsync() { + return read(serverAttributes.get(ATTR_MINMEASUREDVALUE)); + } + + /** + * Synchronously get the Min Measured Value attribute [attribute ID 0x0001]. + *

+ * The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + * @deprecated As of release 1.2.0, replaced by {@link #ZclAttribute#readValue(long refreshPeriod)} + */ + @Deprecated + public Double getMinMeasuredValue(final long refreshPeriod) { + if (serverAttributes.get(ATTR_MINMEASUREDVALUE).isLastValueCurrent(refreshPeriod)) { + return (Double) serverAttributes.get(ATTR_MINMEASUREDVALUE).getLastValue(); + } + + return (Double) readSync(serverAttributes.get(ATTR_MINMEASUREDVALUE)); + } + + /** + * Set reporting for the Min Measured Value attribute [attribute ID 0x0001]. + *

+ * The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param minInterval minimum reporting period + * @param maxInterval maximum reporting period + * @param reportableChange {@link Object} delta required to trigger report + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #setReporting(int attributeId, int minInterval, int maxInterval, Object reportableChange)} + */ + @Deprecated + public Future setMinMeasuredValueReporting(final int minInterval, final int maxInterval, final Object reportableChange) { + return setReporting(serverAttributes.get(ATTR_MINMEASUREDVALUE), minInterval, maxInterval, reportableChange); + } + + /** + * Get the Max Measured Value attribute [attribute ID 0x0002]. + *

+ * The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * MaxMeasuredValue shall be greater than MinMeasuredValue. + *

+ * MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #readAttribute(int attributeId)} + */ + @Deprecated + public Future getMaxMeasuredValueAsync() { + return read(serverAttributes.get(ATTR_MAXMEASUREDVALUE)); + } + + /** + * Synchronously get the Max Measured Value attribute [attribute ID 0x0002]. + *

+ * The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * MaxMeasuredValue shall be greater than MinMeasuredValue. + *

+ * MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + * @deprecated As of release 1.2.0, replaced by {@link #ZclAttribute#readValue(long refreshPeriod)} + */ + @Deprecated + public Double getMaxMeasuredValue(final long refreshPeriod) { + if (serverAttributes.get(ATTR_MAXMEASUREDVALUE).isLastValueCurrent(refreshPeriod)) { + return (Double) serverAttributes.get(ATTR_MAXMEASUREDVALUE).getLastValue(); + } + + return (Double) readSync(serverAttributes.get(ATTR_MAXMEASUREDVALUE)); + } + + /** + * Set reporting for the Max Measured Value attribute [attribute ID 0x0002]. + *

+ * The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * MaxMeasuredValue shall be greater than MinMeasuredValue. + *

+ * MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param minInterval minimum reporting period + * @param maxInterval maximum reporting period + * @param reportableChange {@link Object} delta required to trigger report + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #setReporting(int attributeId, int minInterval, int maxInterval, Object reportableChange)} + */ + @Deprecated + public Future setMaxMeasuredValueReporting(final int minInterval, final int maxInterval, final Object reportableChange) { + return setReporting(serverAttributes.get(ATTR_MAXMEASUREDVALUE), minInterval, maxInterval, reportableChange); + } + + /** + * Get the Tolerance attribute [attribute ID 0x0003]. + *

+ * The Tolerance attribute indicates the magnitude of the possible error that is + * associated with MeasuredValue . The true value is located in the range (MeasuredValue – + * Tolerance) to (MeasuredValue + Tolerance). + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #readAttribute(int attributeId)} + */ + @Deprecated + public Future getToleranceAsync() { + return read(serverAttributes.get(ATTR_TOLERANCE)); + } + + /** + * Synchronously get the Tolerance attribute [attribute ID 0x0003]. + *

+ * The Tolerance attribute indicates the magnitude of the possible error that is + * associated with MeasuredValue . The true value is located in the range (MeasuredValue – + * Tolerance) to (MeasuredValue + Tolerance). + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + * @deprecated As of release 1.2.0, replaced by {@link #ZclAttribute#readValue(long refreshPeriod)} + */ + @Deprecated + public Double getTolerance(final long refreshPeriod) { + if (serverAttributes.get(ATTR_TOLERANCE).isLastValueCurrent(refreshPeriod)) { + return (Double) serverAttributes.get(ATTR_TOLERANCE).getLastValue(); + } + + return (Double) readSync(serverAttributes.get(ATTR_TOLERANCE)); + } +} diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclFormaldehydeMeasurementCluster.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclFormaldehydeMeasurementCluster.java new file mode 100644 index 000000000..cc6170a32 --- /dev/null +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclFormaldehydeMeasurementCluster.java @@ -0,0 +1,389 @@ +/** + * Copyright (c) 2016-2024 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.zcl.clusters; + +import java.util.Map; +import java.util.concurrent.ConcurrentSkipListMap; +import java.util.concurrent.Future; + +import javax.annotation.Generated; + +import com.zsmartsystems.zigbee.CommandResult; +import com.zsmartsystems.zigbee.ZigBeeEndpoint; +import com.zsmartsystems.zigbee.zcl.ZclAttribute; +import com.zsmartsystems.zigbee.zcl.ZclCluster; +import com.zsmartsystems.zigbee.zcl.protocol.ZclDataType; + +/** + * Formaldehyde Measurement cluster implementation (Cluster ID 0x042B). + *

+ * The cluster provides an interface for measurement of Formaldehyde + *

+ * Code is auto-generated. Modifications may be overwritten! + */ +@Generated(value = "com.zsmartsystems.zigbee.autocode.ZigBeeCodeGenerator", date = "2024-07-16T22:58:38Z") +public class ZclFormaldehydeMeasurementCluster extends ZclCluster { + /** + * The ZigBee Cluster Library Cluster ID + */ + public static final int CLUSTER_ID = 0x042B; + + /** + * The ZigBee Cluster Library Cluster Name + */ + public static final String CLUSTER_NAME = "Formaldehyde Measurement"; + + // Attribute constants + /** + * MeasuredValue represents the concentration as a fraction of 1 (one). + *

+ * A value of NaN indicates that the concentration measurement is unknown or outside the + * valid range. + *

+ * MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + *

+ * MeasuredValue is updated continuously as new measurements are made. + */ + public static final int ATTR_MEASUREDVALUE = 0x0000; + /** + * The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + */ + public static final int ATTR_MINMEASUREDVALUE = 0x0001; + /** + * The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * MaxMeasuredValue shall be greater than MinMeasuredValue. + *

+ * MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + */ + public static final int ATTR_MAXMEASUREDVALUE = 0x0002; + /** + * The Tolerance attribute indicates the magnitude of the possible error that is + * associated with MeasuredValue . The true value is located in the range (MeasuredValue – + * Tolerance) to (MeasuredValue + Tolerance). + */ + public static final int ATTR_TOLERANCE = 0x0003; + + @Override + protected Map initializeClientAttributes() { + Map attributeMap = super.initializeClientAttributes(); + + return attributeMap; + } + + @Override + protected Map initializeServerAttributes() { + Map attributeMap = super.initializeServerAttributes(); + + attributeMap.put(ATTR_MEASUREDVALUE, new ZclAttribute(this, ATTR_MEASUREDVALUE, "Measured Value", ZclDataType.FLOAT_32_BIT, true, true, false, true)); + attributeMap.put(ATTR_MINMEASUREDVALUE, new ZclAttribute(this, ATTR_MINMEASUREDVALUE, "Min Measured Value", ZclDataType.FLOAT_32_BIT, true, true, false, false)); + attributeMap.put(ATTR_MAXMEASUREDVALUE, new ZclAttribute(this, ATTR_MAXMEASUREDVALUE, "Max Measured Value", ZclDataType.FLOAT_32_BIT, true, true, false, true)); + attributeMap.put(ATTR_TOLERANCE, new ZclAttribute(this, ATTR_TOLERANCE, "Tolerance", ZclDataType.FLOAT_32_BIT, false, true, false, false)); + + return attributeMap; + } + + + /** + * Default constructor to create a Formaldehyde Measurement cluster. + * + * @param zigbeeEndpoint the {@link ZigBeeEndpoint} this cluster is contained within + */ + public ZclFormaldehydeMeasurementCluster(final ZigBeeEndpoint zigbeeEndpoint) { + super(zigbeeEndpoint, CLUSTER_ID, CLUSTER_NAME); + } + + /** + * Get the Measured Value attribute [attribute ID 0x0000]. + *

+ * MeasuredValue represents the concentration as a fraction of 1 (one). + *

+ * A value of NaN indicates that the concentration measurement is unknown or outside the + * valid range. + *

+ * MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + *

+ * MeasuredValue is updated continuously as new measurements are made. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #readAttribute(int attributeId)} + */ + @Deprecated + public Future getMeasuredValueAsync() { + return read(serverAttributes.get(ATTR_MEASUREDVALUE)); + } + + /** + * Synchronously get the Measured Value attribute [attribute ID 0x0000]. + *

+ * MeasuredValue represents the concentration as a fraction of 1 (one). + *

+ * A value of NaN indicates that the concentration measurement is unknown or outside the + * valid range. + *

+ * MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + *

+ * MeasuredValue is updated continuously as new measurements are made. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + * @deprecated As of release 1.2.0, replaced by {@link #ZclAttribute#readValue(long refreshPeriod)} + */ + @Deprecated + public Double getMeasuredValue(final long refreshPeriod) { + if (serverAttributes.get(ATTR_MEASUREDVALUE).isLastValueCurrent(refreshPeriod)) { + return (Double) serverAttributes.get(ATTR_MEASUREDVALUE).getLastValue(); + } + + return (Double) readSync(serverAttributes.get(ATTR_MEASUREDVALUE)); + } + + /** + * Set reporting for the Measured Value attribute [attribute ID 0x0000]. + *

+ * MeasuredValue represents the concentration as a fraction of 1 (one). + *

+ * A value of NaN indicates that the concentration measurement is unknown or outside the + * valid range. + *

+ * MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + *

+ * MeasuredValue is updated continuously as new measurements are made. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param minInterval minimum reporting period + * @param maxInterval maximum reporting period + * @param reportableChange {@link Object} delta required to trigger report + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #setReporting(int attributeId, int minInterval, int maxInterval, Object reportableChange)} + */ + @Deprecated + public Future setMeasuredValueReporting(final int minInterval, final int maxInterval, final Object reportableChange) { + return setReporting(serverAttributes.get(ATTR_MEASUREDVALUE), minInterval, maxInterval, reportableChange); + } + + /** + * Get the Min Measured Value attribute [attribute ID 0x0001]. + *

+ * The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #readAttribute(int attributeId)} + */ + @Deprecated + public Future getMinMeasuredValueAsync() { + return read(serverAttributes.get(ATTR_MINMEASUREDVALUE)); + } + + /** + * Synchronously get the Min Measured Value attribute [attribute ID 0x0001]. + *

+ * The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + * @deprecated As of release 1.2.0, replaced by {@link #ZclAttribute#readValue(long refreshPeriod)} + */ + @Deprecated + public Double getMinMeasuredValue(final long refreshPeriod) { + if (serverAttributes.get(ATTR_MINMEASUREDVALUE).isLastValueCurrent(refreshPeriod)) { + return (Double) serverAttributes.get(ATTR_MINMEASUREDVALUE).getLastValue(); + } + + return (Double) readSync(serverAttributes.get(ATTR_MINMEASUREDVALUE)); + } + + /** + * Set reporting for the Min Measured Value attribute [attribute ID 0x0001]. + *

+ * The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param minInterval minimum reporting period + * @param maxInterval maximum reporting period + * @param reportableChange {@link Object} delta required to trigger report + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #setReporting(int attributeId, int minInterval, int maxInterval, Object reportableChange)} + */ + @Deprecated + public Future setMinMeasuredValueReporting(final int minInterval, final int maxInterval, final Object reportableChange) { + return setReporting(serverAttributes.get(ATTR_MINMEASUREDVALUE), minInterval, maxInterval, reportableChange); + } + + /** + * Get the Max Measured Value attribute [attribute ID 0x0002]. + *

+ * The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * MaxMeasuredValue shall be greater than MinMeasuredValue. + *

+ * MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #readAttribute(int attributeId)} + */ + @Deprecated + public Future getMaxMeasuredValueAsync() { + return read(serverAttributes.get(ATTR_MAXMEASUREDVALUE)); + } + + /** + * Synchronously get the Max Measured Value attribute [attribute ID 0x0002]. + *

+ * The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * MaxMeasuredValue shall be greater than MinMeasuredValue. + *

+ * MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + * @deprecated As of release 1.2.0, replaced by {@link #ZclAttribute#readValue(long refreshPeriod)} + */ + @Deprecated + public Double getMaxMeasuredValue(final long refreshPeriod) { + if (serverAttributes.get(ATTR_MAXMEASUREDVALUE).isLastValueCurrent(refreshPeriod)) { + return (Double) serverAttributes.get(ATTR_MAXMEASUREDVALUE).getLastValue(); + } + + return (Double) readSync(serverAttributes.get(ATTR_MAXMEASUREDVALUE)); + } + + /** + * Set reporting for the Max Measured Value attribute [attribute ID 0x0002]. + *

+ * The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * MaxMeasuredValue shall be greater than MinMeasuredValue. + *

+ * MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param minInterval minimum reporting period + * @param maxInterval maximum reporting period + * @param reportableChange {@link Object} delta required to trigger report + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #setReporting(int attributeId, int minInterval, int maxInterval, Object reportableChange)} + */ + @Deprecated + public Future setMaxMeasuredValueReporting(final int minInterval, final int maxInterval, final Object reportableChange) { + return setReporting(serverAttributes.get(ATTR_MAXMEASUREDVALUE), minInterval, maxInterval, reportableChange); + } + + /** + * Get the Tolerance attribute [attribute ID 0x0003]. + *

+ * The Tolerance attribute indicates the magnitude of the possible error that is + * associated with MeasuredValue . The true value is located in the range (MeasuredValue – + * Tolerance) to (MeasuredValue + Tolerance). + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #readAttribute(int attributeId)} + */ + @Deprecated + public Future getToleranceAsync() { + return read(serverAttributes.get(ATTR_TOLERANCE)); + } + + /** + * Synchronously get the Tolerance attribute [attribute ID 0x0003]. + *

+ * The Tolerance attribute indicates the magnitude of the possible error that is + * associated with MeasuredValue . The true value is located in the range (MeasuredValue – + * Tolerance) to (MeasuredValue + Tolerance). + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + * @deprecated As of release 1.2.0, replaced by {@link #ZclAttribute#readValue(long refreshPeriod)} + */ + @Deprecated + public Double getTolerance(final long refreshPeriod) { + if (serverAttributes.get(ATTR_TOLERANCE).isLastValueCurrent(refreshPeriod)) { + return (Double) serverAttributes.get(ATTR_TOLERANCE).getLastValue(); + } + + return (Double) readSync(serverAttributes.get(ATTR_TOLERANCE)); + } +} diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclPm25MeasurementCluster.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclPm25MeasurementCluster.java new file mode 100644 index 000000000..d9b190565 --- /dev/null +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclPm25MeasurementCluster.java @@ -0,0 +1,389 @@ +/** + * Copyright (c) 2016-2024 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.zcl.clusters; + +import java.util.Map; +import java.util.concurrent.ConcurrentSkipListMap; +import java.util.concurrent.Future; + +import javax.annotation.Generated; + +import com.zsmartsystems.zigbee.CommandResult; +import com.zsmartsystems.zigbee.ZigBeeEndpoint; +import com.zsmartsystems.zigbee.zcl.ZclAttribute; +import com.zsmartsystems.zigbee.zcl.ZclCluster; +import com.zsmartsystems.zigbee.zcl.protocol.ZclDataType; + +/** + * PM2.5 Measurement cluster implementation (Cluster ID 0x042A). + *

+ * The cluster provides an interface for measurement of Particulate Matter 2.5 microns or less + *

+ * Code is auto-generated. Modifications may be overwritten! + */ +@Generated(value = "com.zsmartsystems.zigbee.autocode.ZigBeeCodeGenerator", date = "2024-07-16T20:26:44Z") +public class ZclPm25MeasurementCluster extends ZclCluster { + /** + * The ZigBee Cluster Library Cluster ID + */ + public static final int CLUSTER_ID = 0x042A; + + /** + * The ZigBee Cluster Library Cluster Name + */ + public static final String CLUSTER_NAME = "PM2.5 Measurement"; + + // Attribute constants + /** + * MeasuredValue represents the concentration as a fraction of 1 (one). + *

+ * A value of NaN indicates that the concentration measurement is unknown or outside the + * valid range. + *

+ * MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + *

+ * MeasuredValue is updated continuously as new measurements are made. + */ + public static final int ATTR_MEASUREDVALUE = 0x0000; + /** + * The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + */ + public static final int ATTR_MINMEASUREDVALUE = 0x0001; + /** + * The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * MaxMeasuredValue shall be greater than MinMeasuredValue. + *

+ * MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + */ + public static final int ATTR_MAXMEASUREDVALUE = 0x0002; + /** + * The Tolerance attribute indicates the magnitude of the possible error that is + * associated with MeasuredValue . The true value is located in the range (MeasuredValue – + * Tolerance) to (MeasuredValue + Tolerance). + */ + public static final int ATTR_TOLERANCE = 0x0003; + + @Override + protected Map initializeClientAttributes() { + Map attributeMap = super.initializeClientAttributes(); + + return attributeMap; + } + + @Override + protected Map initializeServerAttributes() { + Map attributeMap = super.initializeServerAttributes(); + + attributeMap.put(ATTR_MEASUREDVALUE, new ZclAttribute(this, ATTR_MEASUREDVALUE, "Measured Value", ZclDataType.FLOAT_32_BIT, true, true, false, true)); + attributeMap.put(ATTR_MINMEASUREDVALUE, new ZclAttribute(this, ATTR_MINMEASUREDVALUE, "Min Measured Value", ZclDataType.FLOAT_32_BIT, true, true, false, false)); + attributeMap.put(ATTR_MAXMEASUREDVALUE, new ZclAttribute(this, ATTR_MAXMEASUREDVALUE, "Max Measured Value", ZclDataType.FLOAT_32_BIT, true, true, false, true)); + attributeMap.put(ATTR_TOLERANCE, new ZclAttribute(this, ATTR_TOLERANCE, "Tolerance", ZclDataType.FLOAT_32_BIT, false, true, false, false)); + + return attributeMap; + } + + + /** + * Default constructor to create a PM2.5 Measurement cluster. + * + * @param zigbeeEndpoint the {@link ZigBeeEndpoint} this cluster is contained within + */ + public ZclPm25MeasurementCluster(final ZigBeeEndpoint zigbeeEndpoint) { + super(zigbeeEndpoint, CLUSTER_ID, CLUSTER_NAME); + } + + /** + * Get the Measured Value attribute [attribute ID 0x0000]. + *

+ * MeasuredValue represents the concentration as a fraction of 1 (one). + *

+ * A value of NaN indicates that the concentration measurement is unknown or outside the + * valid range. + *

+ * MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + *

+ * MeasuredValue is updated continuously as new measurements are made. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #readAttribute(int attributeId)} + */ + @Deprecated + public Future getMeasuredValueAsync() { + return read(serverAttributes.get(ATTR_MEASUREDVALUE)); + } + + /** + * Synchronously get the Measured Value attribute [attribute ID 0x0000]. + *

+ * MeasuredValue represents the concentration as a fraction of 1 (one). + *

+ * A value of NaN indicates that the concentration measurement is unknown or outside the + * valid range. + *

+ * MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + *

+ * MeasuredValue is updated continuously as new measurements are made. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + * @deprecated As of release 1.2.0, replaced by {@link #ZclAttribute#readValue(long refreshPeriod)} + */ + @Deprecated + public Double getMeasuredValue(final long refreshPeriod) { + if (serverAttributes.get(ATTR_MEASUREDVALUE).isLastValueCurrent(refreshPeriod)) { + return (Double) serverAttributes.get(ATTR_MEASUREDVALUE).getLastValue(); + } + + return (Double) readSync(serverAttributes.get(ATTR_MEASUREDVALUE)); + } + + /** + * Set reporting for the Measured Value attribute [attribute ID 0x0000]. + *

+ * MeasuredValue represents the concentration as a fraction of 1 (one). + *

+ * A value of NaN indicates that the concentration measurement is unknown or outside the + * valid range. + *

+ * MinMeasuredValue and MaxMeasuredValue define the valid range for MeasuredValue. + *

+ * MeasuredValue is updated continuously as new measurements are made. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param minInterval minimum reporting period + * @param maxInterval maximum reporting period + * @param reportableChange {@link Object} delta required to trigger report + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #setReporting(int attributeId, int minInterval, int maxInterval, Object reportableChange)} + */ + @Deprecated + public Future setMeasuredValueReporting(final int minInterval, final int maxInterval, final Object reportableChange) { + return setReporting(serverAttributes.get(ATTR_MEASUREDVALUE), minInterval, maxInterval, reportableChange); + } + + /** + * Get the Min Measured Value attribute [attribute ID 0x0001]. + *

+ * The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #readAttribute(int attributeId)} + */ + @Deprecated + public Future getMinMeasuredValueAsync() { + return read(serverAttributes.get(ATTR_MINMEASUREDVALUE)); + } + + /** + * Synchronously get the Min Measured Value attribute [attribute ID 0x0001]. + *

+ * The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + * @deprecated As of release 1.2.0, replaced by {@link #ZclAttribute#readValue(long refreshPeriod)} + */ + @Deprecated + public Double getMinMeasuredValue(final long refreshPeriod) { + if (serverAttributes.get(ATTR_MINMEASUREDVALUE).isLastValueCurrent(refreshPeriod)) { + return (Double) serverAttributes.get(ATTR_MINMEASUREDVALUE).getLastValue(); + } + + return (Double) readSync(serverAttributes.get(ATTR_MINMEASUREDVALUE)); + } + + /** + * Set reporting for the Min Measured Value attribute [attribute ID 0x0001]. + *

+ * The MinMeasuredValue attribute indicates the minimum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param minInterval minimum reporting period + * @param maxInterval maximum reporting period + * @param reportableChange {@link Object} delta required to trigger report + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #setReporting(int attributeId, int minInterval, int maxInterval, Object reportableChange)} + */ + @Deprecated + public Future setMinMeasuredValueReporting(final int minInterval, final int maxInterval, final Object reportableChange) { + return setReporting(serverAttributes.get(ATTR_MINMEASUREDVALUE), minInterval, maxInterval, reportableChange); + } + + /** + * Get the Max Measured Value attribute [attribute ID 0x0002]. + *

+ * The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * MaxMeasuredValue shall be greater than MinMeasuredValue. + *

+ * MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #readAttribute(int attributeId)} + */ + @Deprecated + public Future getMaxMeasuredValueAsync() { + return read(serverAttributes.get(ATTR_MAXMEASUREDVALUE)); + } + + /** + * Synchronously get the Max Measured Value attribute [attribute ID 0x0002]. + *

+ * The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * MaxMeasuredValue shall be greater than MinMeasuredValue. + *

+ * MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + * @deprecated As of release 1.2.0, replaced by {@link #ZclAttribute#readValue(long refreshPeriod)} + */ + @Deprecated + public Double getMaxMeasuredValue(final long refreshPeriod) { + if (serverAttributes.get(ATTR_MAXMEASUREDVALUE).isLastValueCurrent(refreshPeriod)) { + return (Double) serverAttributes.get(ATTR_MAXMEASUREDVALUE).getLastValue(); + } + + return (Double) readSync(serverAttributes.get(ATTR_MAXMEASUREDVALUE)); + } + + /** + * Set reporting for the Max Measured Value attribute [attribute ID 0x0002]. + *

+ * The MaxMeasuredValue attribute indicates the maximum value of MeasuredValue that can + * be measured. A value of NaN means this attribute is not defined. + *

+ * MaxMeasuredValue shall be greater than MinMeasuredValue. + *

+ * MinMeasuredValue and MaxMeasuredValue define the range of the sensor. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is MANDATORY + * + * @param minInterval minimum reporting period + * @param maxInterval maximum reporting period + * @param reportableChange {@link Object} delta required to trigger report + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #setReporting(int attributeId, int minInterval, int maxInterval, Object reportableChange)} + */ + @Deprecated + public Future setMaxMeasuredValueReporting(final int minInterval, final int maxInterval, final Object reportableChange) { + return setReporting(serverAttributes.get(ATTR_MAXMEASUREDVALUE), minInterval, maxInterval, reportableChange); + } + + /** + * Get the Tolerance attribute [attribute ID 0x0003]. + *

+ * The Tolerance attribute indicates the magnitude of the possible error that is + * associated with MeasuredValue . The true value is located in the range (MeasuredValue – + * Tolerance) to (MeasuredValue + Tolerance). + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @return the {@link Future} command result future + * @deprecated As of release 1.2.0, replaced by {@link #readAttribute(int attributeId)} + */ + @Deprecated + public Future getToleranceAsync() { + return read(serverAttributes.get(ATTR_TOLERANCE)); + } + + /** + * Synchronously get the Tolerance attribute [attribute ID 0x0003]. + *

+ * The Tolerance attribute indicates the magnitude of the possible error that is + * associated with MeasuredValue . The true value is located in the range (MeasuredValue – + * Tolerance) to (MeasuredValue + Tolerance). + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + * @deprecated As of release 1.2.0, replaced by {@link #ZclAttribute#readValue(long refreshPeriod)} + */ + @Deprecated + public Double getTolerance(final long refreshPeriod) { + if (serverAttributes.get(ATTR_TOLERANCE).isLastValueCurrent(refreshPeriod)) { + return (Double) serverAttributes.get(ATTR_TOLERANCE).getLastValue(); + } + + return (Double) readSync(serverAttributes.get(ATTR_TOLERANCE)); + } +} diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/protocol/ZclClusterType.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/protocol/ZclClusterType.java index 8e4d9f5bc..95024d664 100644 --- a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/protocol/ZclClusterType.java +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/protocol/ZclClusterType.java @@ -18,6 +18,8 @@ import com.zsmartsystems.zigbee.zcl.clusters.ZclBallastConfigurationCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclBasicCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclBinaryInputBasicCluster; +import com.zsmartsystems.zigbee.zcl.clusters.ZclCarbonDioxideMeasurementCluster; +import com.zsmartsystems.zigbee.zcl.clusters.ZclCarbonMonoxideMeasurementCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclColorControlCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclCommissioningCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclDehumidificationControlCluster; @@ -27,6 +29,7 @@ import com.zsmartsystems.zigbee.zcl.clusters.ZclElectricalMeasurementCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclFanControlCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclFlowMeasurementCluster; +import com.zsmartsystems.zigbee.zcl.clusters.ZclFormaldehydeMeasurementCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclGreenPowerCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclGroupsCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclIasAceCluster; @@ -48,6 +51,7 @@ import com.zsmartsystems.zigbee.zcl.clusters.ZclOnOffCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclOnOffSwitchConfigurationCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclOtaUpgradeCluster; +import com.zsmartsystems.zigbee.zcl.clusters.ZclPm25MeasurementCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclPollControlCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclPowerConfigurationCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclPrepaymentCluster; @@ -71,7 +75,7 @@ * * @author Chris Jackson */ -@Generated(value = "com.zsmartsystems.zigbee.autocode.ZigBeeCodeGenerator", date = "2022-05-08T20:56:36Z") +@Generated(value = "com.zsmartsystems.zigbee.autocode.ZigBeeCodeGenerator", date = "2024-07-16T22:58:38Z") public enum ZclClusterType { BASIC(0x0000, ZclBasicCluster.class, "Basic"), POWER_CONFIGURATION(0x0001, ZclPowerConfigurationCluster.class, "Power Configuration"), @@ -110,6 +114,10 @@ public enum ZclClusterType { OCCUPANCY_SENSING(0x0406, ZclOccupancySensingCluster.class, "Occupancy Sensing"), LEAF_WETNESS_MEASUREMENT(0x0407, ZclLeafWetnessMeasurementCluster.class, "Leaf Wetness Measurement"), SOIL_MOISTURE_MEASUREMENT(0x0408, ZclSoilMoistureMeasurementCluster.class, "Soil Moisture Measurement"), + CARBON_MONOXIDE_MEASUREMENT(0x040C, ZclCarbonMonoxideMeasurementCluster.class, "Carbon Monoxide Measurement"), + CARBON_DIOXIDE_MEASUREMENT(0x040D, ZclCarbonDioxideMeasurementCluster.class, "Carbon Dioxide Measurement"), + PM2_5_MEASUREMENT(0x042A, ZclPm25MeasurementCluster.class, "PM2.5 Measurement"), + FORMALDEHYDE_MEASUREMENT(0x042B, ZclFormaldehydeMeasurementCluster.class, "Formaldehyde Measurement"), IAS_ZONE(0x0500, ZclIasZoneCluster.class, "IAS Zone"), IAS_ACE(0x0501, ZclIasAceCluster.class, "IAS ACE"), IAS_WD(0x0502, ZclIasWdCluster.class, "IAS WD"),