@Override public State[] getParameters() { return new State[] { new StringType(pattern.pattern()) }; } }
public static StringType valueOf(@Nullable String value) { return new StringType(value); }
case "COUNT": if (function.params != null && function.params.length == 1) { State countParam = new StringType(function.params[0]); return new ArithmeticGroupFunction.Count(countParam); } else {
@Override protected StringType convert(String value) { return value != null ? new StringType(value) : null; }
@Override public State[] getParameters() { return new State[] { new StringType(pattern.pattern()) }; } }
public static StringType valueOf(@Nullable String value) { return new StringType(value); }
@Override public String interpret(Locale locale, String text) throws InterpretationException { Event event = ItemEventFactory.createCommandEvent(itemName, new StringType(text)); eventPublisher.post(event); return null; }
@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)); } } } }
@Override public void run() { for (ChannelUID channelUID : numberChannelUIDs) { double randomValue = Math.random() * 100; int intValue = (int) randomValue; State cmd; if (intValue % 2 == 0) { cmd = new QuantityType<Temperature>(randomValue + "°C"); } else { cmd = new DecimalType(randomValue); } updateState(channelUID, cmd); } for (ChannelUID channelUID : textChannelUIDs) { int pos = (int) (Math.random() * (randomTexts.size() - 1)); String randomValue = randomTexts.get(pos); StringType cmd = new StringType(randomValue); updateState(channelUID, cmd); } } };
result = UpDownType.DOWN; } else if (typeClass.equals(org.openhab.core.library.types.StringType.class)) { result = new StringType(type.toString()); } else if (typeClass.equals(org.openhab.core.library.types.DecimalType.class)) { result = new DecimalType(type.toString());
case "COUNT": if (function.params != null && function.params.length == 1) { State countParam = new StringType(function.params[0]); return new ArithmeticGroupFunction.Count(countParam); } else {
private void updateBinaryState(byte[] data) { Channel channel = getBinaryChannel(); if (channel != null) { handler.updateState(channel.getUID().getIdWithoutGroup(), new StringType(handler.getBluetoothContext().getParser().parse(data, 16))); } else { logger.error("Could not find binary channel: {}", url); } }
object.put("type", eventAlarm.getV1AlarmCode()); object.put("value", eventAlarm.getValue()); return new StringType(propertiesToJson(object));
for (StateOption option : stateDescription.getOptions()) { if (option.getValue().equals(state.toString()) && option.getLabel() != null) { State stateOption = new StringType(option.getLabel()); try { String formatPatternOption = stateOption.format(formatPattern);
for (StateOption option : stateDescription.getOptions()) { if (option.getValue().equals(state.toString()) && option.getLabel() != null) { State stateOption = new StringType(option.getLabel()); try { String formatPatternOption = stateOption.format(formatPattern);
return new DecimalType(new BigDecimal(enumeration.getKey())); } else { return new StringType(enumeration.getKey().toString()); state = new DecimalType(holder.getBigDecimal()); } else if (holder.getField().getFormat().isStruct()) { state = new StringType(parser.parse(holder.getBytes(), 16)); } else { state = new StringType(holder.getString());
@Override public InterpretationResult interpretAST(ResourceBundle language, ASTNode node) { String[] name = node.findValueAsStringArray(NAME); ASTNode cmdNode = node.findNode(CMD); Object tag = cmdNode.getTag(); Object value = cmdNode.getValue(); Command command; if (tag instanceof Command) { command = (Command) tag; } else if (value instanceof Number) { command = new DecimalType(((Number) value).longValue()); } else { command = new StringType(cmdNode.getValueAsString()); } if (name != null && command != null) { try { return new InterpretationResult(true, executeSingle(language, name, command)); } catch (InterpretationException ex) { return new InterpretationResult(ex); } } return InterpretationResult.SEMANTIC_ERROR; } };
return new StringType(propertiesToJson(object)); case "alarm_number": case "notification_access_control":