Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@ public enum MetadataType {
@SerializedName("number")
NUMBER,
@SerializedName("boolean")
BOOLEAN
BOOLEAN,
@SerializedName("timeout")
TIMEOUT
}
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,6 @@ protected MetadataType correctedType(MetadataType type, @Nullable Object value,
switch (type) {
case ANY:
return determineTypeFromValue(value, commandClass);
case DURATION:
return MetadataType.NUMBER;
case NUMBER:
if (COMMAND_CLASS_ALARM == commandClass && optionList != null && optionList.size() == 2) {
return MetadataType.BOOLEAN;
Expand Down Expand Up @@ -526,6 +524,9 @@ protected String itemTypeFromMetadata(MetadataType type, @Nullable Object value,
type = correctedType(type, value, commandClass, optionList);

switch (type) {
case DURATION:
case TIMEOUT:
return CoreItemFactory.NUMBER + ":Time";
case NUMBER:
if (VIRTUAL_COMMAND_CLASS_ROLLERSHUTTER.equals(commandClassName)) {
return CoreItemFactory.ROLLERSHUTTER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public ConfigMetadata(int nodeId, Event data) {
private Type configTypeFromMetadata(MetadataType type, Object value, int commandClass) {
type = correctedType(type, value, commandClass, null);
switch (type) {
case TIMEOUT:
case NUMBER:
return Type.INTEGER;
// Might be future cases that require DECIMAL, might depend on scale?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void testDiscoveryForActiveNodes() throws IOException {

try {
verify(callback).statusUpdated(eq(thing), argThat(arg -> arg.getStatus().equals(ThingStatus.UNKNOWN)));
verify(discoveryService, times(28)).addNodeDiscovery(any());
verify(discoveryService, times(29)).addNodeDiscovery(any());
} finally {
handler.dispose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,25 @@ public void testGenCTNode7MultilevelSwitchType() throws IOException {
assertEquals("Dimmer", type.getItemType());
}

@Test
public void testGenCTNode12TimeOutType() throws IOException {
Channel channel = getChannel("store_4.json", 12, "protection-timeout");
ChannelType type = channelTypeProvider.getChannelType(Objects.requireNonNull(channel.getChannelTypeUID()),
null);
Configuration configuration = channel.getConfiguration();

assertNotNull(type);
assertEquals("zwavejs:test-bridge:test-thing:protection-timeout", channel.getUID().getAsString());
assertEquals("Number:Time", Objects.requireNonNull(type).getItemType());
assertEquals("RF Protection Timeout", channel.getLabel());
assertNotNull(configuration.get(BindingConstants.CONFIG_CHANNEL_WRITE_PROPERTY_STR));

StateDescription statePattern = type.getState();
assertNotNull(statePattern);
assertNull(statePattern.getStep());
assertEquals("%d %unit%", statePattern.getPattern());
}

@Test
public void testGenCTNode13MultilevelSwitchType() throws IOException {
Channel channel = getChannel("store_4.json", 13, "multilevel-switch-value");
Expand Down
Loading