Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZWave change polling to use BigDecimal rather than Integer #1166

Merged
merged 2 commits into from
Jul 30, 2016
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 @@ -668,13 +668,11 @@ public void handleConfigurationUpdate(Map<String, Object> configurationParameter
}

Integer value;
if (configurationParameter.getValue() instanceof BigDecimal) {
try {
value = ((BigDecimal) configurationParameter.getValue()).intValue();
} else if (configurationParameter.getValue() instanceof String) {
value = Integer.parseInt((String) configurationParameter.getValue());
} else {
} catch (NumberFormatException e) {
logger.error("NODE {}: Error converting wakeup value from {}", nodeId,
configurationParameter.getValue().getClass());
configurationParameter.getValue());
continue;
}

Expand Down Expand Up @@ -755,7 +753,7 @@ public void handleConfigurationUpdate(Map<String, Object> configurationParameter
boolean timeoutEnabled;

try {
int value = Integer.parseInt((String) valueObject);
int value = ((BigDecimal) valueObject).intValue();
if (value == 0) {
timeoutEnabled = false;
} else {
Expand Down Expand Up @@ -792,7 +790,7 @@ public void handleConfigurationUpdate(Map<String, Object> configurationParameter
if ("pollperiod".equals(cfg[1])) {
pollingPeriod = POLLING_PERIOD_DEFAULT;
try {
pollingPeriod = Integer.parseInt(configurationParameter.getValue().toString());
pollingPeriod = ((BigDecimal) configurationParameter.getValue()).intValue();
} catch (final NumberFormatException ex) {
logger.warn("NODE {}: pollingPeriod ({}) cannot be set - using default", nodeId,
configurationParameter.getValue().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public ConfigDescription getConfigDescription(URI uri, Locale locale) {
// If we support DOOR_LOCK - add options
if (node.getCommandClass(ZWaveCommandClass.CommandClass.DOOR_LOCK) != null) {
parameters.add(ConfigDescriptionParameterBuilder
.create(ZWaveBindingConstants.CONFIGURATION_DOORLOCKTIMEOUT, Type.TEXT).withLabel("Lock Timeout")
.create(ZWaveBindingConstants.CONFIGURATION_DOORLOCKTIMEOUT, Type.INTEGER).withLabel("Lock Timeout")
.withDescription("Set the timeout on the lock.").withDefault("30").withGroupName("thingcfg")
.build());
}
Expand Down