- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclAttribute.getId()
方法的一些代码示例,展示了ZclAttribute.getId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZclAttribute.getId()
方法的具体详情如下:
包路径:com.zsmartsystems.zigbee.zcl.ZclAttribute
类名称:ZclAttribute
方法名:getId
[英]Gets the attribute ID
[中]获取属性ID
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
/**
* Read an attribute
*
* @param attribute the {@link ZclAttribute} to read
* @return command future
*/
public Future<CommandResult> read(final ZclAttribute attribute) {
return read(attribute.getId());
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
/**
* Write an attribute
*
* @param attribute the {@link ZclAttribute} to write
* @param value the value to set (as {@link Object})
* @return command future {@link CommandResult}
*/
public Future<CommandResult> write(final ZclAttribute attribute, final Object value) {
return write(attribute.getId(), attribute.getDataType(), value);
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void attributeUpdated(ZclAttribute attribute) {
logger.debug("{}: ZigBee attribute reports {}", endpoint.getIeeeAddress(), attribute);
if (attribute.getCluster() == ZclClusterType.RELATIVE_HUMIDITY_MEASUREMENT
&& attribute.getId() == ZclRelativeHumidityMeasurementCluster.ATTR_MEASUREDVALUE) {
Integer value = (Integer) attribute.getLastValue();
if (value != null) {
updateChannelState(new DecimalType(BigDecimal.valueOf(value, 2)));
}
}
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
private void printAttributes(final ZclCluster cluster, final PrintStream out) {
Map<Integer, ZclAttribute> attributeTree = new TreeMap<Integer, ZclAttribute>();
for (ZclAttribute attribute : cluster.getAttributes()) {
attributeTree.put(attribute.getId(), attribute);
}
for (ZclAttribute attribute : attributeTree.values()) {
out.println(String.format(" %s %5d %s%s%s %s %-40s %s %s",
(cluster.getSupportedAttributes().contains(attribute.getId()) ? "S" : "U"), attribute.getId(),
(attribute.isReadable() ? "r" : "-"), (attribute.isWritable() ? "w" : "-"),
(attribute.isReportable() ? "s" : "-"), printZclDataType(attribute.getDataType()),
attribute.getName(),
(attribute.getLastValue() == null ? "" : attribute.getLastReportTime().getTime()),
(attribute.getLastValue() == null ? "" : attribute.getLastValue())));
}
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void attributeUpdated(ZclAttribute attribute) {
logger.debug("{}: ZigBee attribute reports {}", endpoint.getIeeeAddress(), attribute);
if (attribute.getCluster() == ZclClusterType.ILLUMINANCE_MEASUREMENT
&& attribute.getId() == ZclIlluminanceMeasurementCluster.ATTR_MEASUREDVALUE) {
Integer value = (Integer) attribute.getLastValue();
if (value != null) {
updateChannelState(new DecimalType(BigDecimal.valueOf(value, 2)));
}
}
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void attributeUpdated(ZclAttribute attribute) {
logger.debug("{}: ZigBee attribute reports {}", endpoint.getIeeeAddress(), attribute);
if (attribute.getCluster() == ZclClusterType.ELECTRICAL_MEASUREMENT
&& attribute.getId() == ZclElectricalMeasurementCluster.ATTR_RMSVOLTAGE) {
Integer value = (Integer) attribute.getLastValue();
if (value != null) {
BigDecimal valueInVolts = BigDecimal.valueOf(value * multiplier / divisor);
updateChannelState(new QuantityType<ElectricPotential>(valueInVolts, SmartHomeUnits.VOLT));
}
}
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void attributeUpdated(ZclAttribute attribute) {
logger.debug("{}: ZigBee attribute reports {}", endpoint.getIeeeAddress(), attribute);
if (attribute.getCluster() == ZclClusterType.ELECTRICAL_MEASUREMENT
&& attribute.getId() == ZclElectricalMeasurementCluster.ATTR_RMSCURRENT) {
Integer value = (Integer) attribute.getLastValue();
if (value != null) {
BigDecimal valueInAmpere = BigDecimal.valueOf(value * multiplier / divisor);
updateChannelState(new QuantityType<ElectricCurrent>(valueInAmpere, SmartHomeUnits.AMPERE));
}
}
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void attributeUpdated(ZclAttribute attribute) {
logger.debug("{}: ZigBee attribute reports {}", endpoint.getIeeeAddress(), attribute);
if (attribute.getCluster() == ZclClusterType.IAS_ZONE
&& attribute.getId() == ZclIasZoneCluster.ATTR_ZONESTATUS) {
updateChannelState((Integer) attribute.getLastValue());
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void attributeUpdated(ZclAttribute attribute) {
logger.debug("{}: ZigBee attribute reports {}", endpoint.getIeeeAddress(), attribute);
if (attribute.getCluster() == ZclClusterType.TEMPERATURE_MEASUREMENT
&& attribute.getId() == ZclTemperatureMeasurementCluster.ATTR_MEASUREDVALUE) {
Integer value = (Integer) attribute.getLastValue();
if (value != null) {
updateChannelState(new QuantityType<>(BigDecimal.valueOf(value, 2), SIUnits.CELSIUS));
}
}
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void attributeUpdated(ZclAttribute attribute) {
logger.debug("{}: ZigBee attribute reports {}", endpoint.getIeeeAddress(), attribute);
if (attribute.getCluster() == ZclClusterType.ELECTRICAL_MEASUREMENT
&& attribute.getId() == ZclElectricalMeasurementCluster.ATTR_ACTIVEPOWER) {
Integer value = (Integer) attribute.getLastValue();
if (value != null) {
BigDecimal valueInWatt = BigDecimal.valueOf(value * multiplier / divisor);
updateChannelState(new QuantityType<Power>(valueInWatt, SmartHomeUnits.WATT));
}
}
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public synchronized void attributeUpdated(ZclAttribute attribute) {
logger.debug("{}: ZigBee attribute reports {}", endpoint.getIeeeAddress(), attribute);
if (attribute.getCluster() == ZclClusterType.LEVEL_CONTROL
&& attribute.getId() == ZclLevelControlCluster.ATTR_CURRENTLEVEL) {
lastLevel = levelToPercent((Integer) attribute.getLastValue());
if (currentOnOffState.get()) {
// Note that state is only updated if the current On/Off state is TRUE (ie ON)
updateChannelState(lastLevel);
}
} else if (attribute.getCluster() == ZclClusterType.ON_OFF && attribute.getId() == ZclOnOffCluster.ATTR_ONOFF) {
if (attribute.getLastValue() != null) {
currentOnOffState.set((Boolean) attribute.getLastValue());
updateChannelState(currentOnOffState.get() ? lastLevel : OnOffType.OFF);
}
}
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void attributeUpdated(ZclAttribute attribute) {
logger.debug("{}: ZigBee attribute reports {}", endpoint.getIeeeAddress(), attribute);
if (attribute.getCluster() == ZclClusterType.POWER_CONFIGURATION
&& attribute.getId() == ZclPowerConfigurationCluster.ATTR_BATTERYVOLTAGE) {
Integer value = (Integer) attribute.getLastValue();
if (value == null || value == 0xFF) {
// The value 0xFF indicates an invalid or unknown reading.
return;
}
BigDecimal valueInVolt = BigDecimal.valueOf(value, 1);
updateChannelState(new QuantityType<ElectricPotential>(valueInVolt, SmartHomeUnits.VOLT));
}
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void attributeUpdated(ZclAttribute attribute) {
logger.debug("{}: ZigBee attribute reports {}", endpoint.getIeeeAddress(), attribute);
if (attribute.getCluster() == ZclClusterType.ON_OFF && attribute.getId() == ZclOnOffCluster.ATTR_ONOFF) {
Boolean value = (Boolean) attribute.getLastValue();
if (value != null && value) {
updateChannelState(OnOffType.ON);
} else {
updateChannelState(OnOffType.OFF);
}
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void attributeUpdated(ZclAttribute attribute) {
logger.debug("{}: ZigBee attribute reports {}", endpoint.getIeeeAddress(), attribute);
if (attribute.getCluster() == ZclClusterType.POWER_CONFIGURATION
&& attribute.getId() == ZclPowerConfigurationCluster.ATTR_BATTERYPERCENTAGEREMAINING) {
Integer value = (Integer) attribute.getLastValue();
if (value == null) {
return;
}
updateChannelState(new DecimalType(value / 2));
}
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void attributeUpdated(ZclAttribute attribute) {
logger.debug("{}: ZigBee attribute reports {}", endpoint.getIeeeAddress(), attribute);
if (attribute.getCluster() == ZclClusterType.OCCUPANCY_SENSING
&& attribute.getId() == ZclOccupancySensingCluster.ATTR_OCCUPANCY) {
Integer value = (Integer) attribute.getLastValue();
if (value != null && value == 1) {
updateChannelState(OnOffType.ON);
} else {
updateChannelState(OnOffType.OFF);
}
}
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void attributeUpdated(ZclAttribute attribute) {
logger.debug("{}: ZigBee attribute reports {}", endpoint.getIeeeAddress(), attribute);
if (attribute.getCluster() == ZclClusterType.DOOR_LOCK
&& attribute.getId() == ZclDoorLockCluster.ATTR_LOCKSTATE) {
Integer value = (Integer) attribute.getLastValue();
if (value != null && value == 1) {
updateChannelState(OnOffType.ON);
} else {
updateChannelState(OnOffType.OFF);
}
}
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void attributeUpdated(ZclAttribute attribute) {
logger.debug("{}: ZigBee attribute reports {} on endpoint {}", endpoint.getIeeeAddress(), attribute,
endpoint.getEndpointId());
if (attribute.getCluster() == ZclClusterType.COLOR_CONTROL
&& attribute.getId() == ZclColorControlCluster.ATTR_COLORTEMPERATURE) {
if (lastColorMode == null || lastColorMode == ColorModeEnum.COLORTEMPERATURE) {
Integer temperatureInMired = (Integer) attribute.getLastValue();
PercentType percent = miredToPercent(temperatureInMired);
if (percent != null) {
updateChannelState(percent);
}
}
} else if (attribute.getCluster() == ZclClusterType.COLOR_CONTROL
&& attribute.getId() == ZclColorControlCluster.ATTR_COLORMODE) {
Integer colorMode = (Integer) attribute.getLastValue();
lastColorMode = ColorModeEnum.getByValue(colorMode);
if (lastColorMode != ColorModeEnum.COLORTEMPERATURE) {
updateChannelState(UnDefType.UNDEF);
}
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
/**
* Gets the reporting configuration for an attribute
*
* @param attribute the {@link ZclAttribute} on which to enable reporting
* @return command future {@link CommandResult}
*/
public Future<CommandResult> getReporting(final ZclAttribute attribute) {
final ReadReportingConfigurationCommand command = new ReadReportingConfigurationCommand();
command.setClusterId(clusterId);
AttributeRecord record = new AttributeRecord();
record.setAttributeIdentifier(attribute.getId());
record.setDirection(0);
command.setRecords(Collections.singletonList(record));
command.setDestinationAddress(zigbeeEndpoint.getEndpointAddress());
return send(command);
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void attributeUpdated(ZclAttribute attribute) {
if (attribute.getCluster() == ZclClusterType.POWER_CONFIGURATION
&& attribute.getId() == ZclPowerConfigurationCluster.ATTR_BATTERYALARMSTATE) {
logger.debug("{}: ZigBee attribute reports {}", endpoint.getIeeeAddress(), attribute);
// The value is a 32-bit bitmap, represented by an Integer
Integer value = (Integer) attribute.getLastValue();
if (value == null) {
return;
}
if ((value & MIN_THRESHOLD_BITMASK) != 0) {
updateChannelState(new StringType(STATE_OPTION_BATTERY_MIN_THRESHOLD));
} else if ((value & THRESHOLD_1_BITMASK) != 0) {
updateChannelState(new StringType(STATE_OPTION_BATTERY_THRESHOLD_1));
} else if ((value & THRESHOLD_2_BITMASK) != 0) {
updateChannelState(new StringType(STATE_OPTION_BATTERY_THRESHOLD_2));
} else if ((value & THRESHOLD_3_BITMASK) != 0) {
updateChannelState(new StringType(STATE_OPTION_BATTERY_THRESHOLD_3));
} else {
updateChannelState(new StringType(STATE_OPTION_BATTERY_NO_THRESHOLD));
}
}
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void testConstructor() {
ZclAttribute attribute = new ZclAttribute(ZclClusterType.ON_OFF, 0, "Test Name",
ZclDataType.UNSIGNED_8_BIT_INTEGER, false, false, false, false);
assertEquals(ZclClusterType.ON_OFF, attribute.getCluster());
assertEquals(0, attribute.getId());
assertEquals("Test Name", attribute.getName());
assertEquals(ZclDataType.UNSIGNED_8_BIT_INTEGER, attribute.getDataType());
assertEquals(false, attribute.isMandatory());
assertEquals(false, attribute.isWritable());
assertEquals(false, attribute.isReadable());
assertEquals(false, attribute.isReportable());
System.out.println(attribute.toString());
attribute = new ZclAttribute(ZclClusterType.ON_OFF, 0, "Test Name", ZclDataType.UNSIGNED_8_BIT_INTEGER, true,
true, true, true);
assertEquals(true, attribute.isMandatory());
assertEquals(true, attribute.isWritable());
assertEquals(true, attribute.isReadable());
assertEquals(true, attribute.isReportable());
System.out.println(attribute.toString());
}
本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclAttribute.isLastValueCurrent()方法的一些代码示例,展示了ZclAttribute.is
本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclAttribute.getLastReportTime()方法的一些代码示例,展示了ZclAttribute.get
本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclAttribute.getId()方法的一些代码示例,展示了ZclAttribute.getId()的具体用法。这些
本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclAttribute.isReadable()方法的一些代码示例,展示了ZclAttribute.isReadable
本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclAttribute.getCluster()方法的一些代码示例,展示了ZclAttribute.getCluster
本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclAttribute.getDataType()方法的一些代码示例,展示了ZclAttribute.getDataTy
本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclAttribute.getLastValue()方法的一些代码示例,展示了ZclAttribute.getLastV
本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclAttribute.isWritable()方法的一些代码示例,展示了ZclAttribute.isWritable
本文整理了Java中com.zsmartsystems.zigbee.zcl.ZclAttribute.getName()方法的一些代码示例,展示了ZclAttribute.getName()的具体用
我是一名优秀的程序员,十分优秀!