diff --git a/bundles/binding/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/HttpBinding.java b/bundles/binding/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/HttpBinding.java index 127420aee51..b49e622c461 100644 --- a/bundles/binding/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/HttpBinding.java +++ b/bundles/binding/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/HttpBinding.java @@ -25,9 +25,11 @@ import org.openhab.core.binding.AbstractActiveBinding; import org.openhab.core.items.Item; import org.openhab.core.library.items.ContactItem; +import org.openhab.core.library.items.DateTimeItem; import org.openhab.core.library.items.NumberItem; import org.openhab.core.library.items.RollershutterItem; import org.openhab.core.library.items.SwitchItem; +import org.openhab.core.library.types.DateTimeType; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.OnOffType; import org.openhab.core.library.types.OpenClosedType; @@ -245,6 +247,8 @@ private State createState(Class itemType, String transformedResp return OnOffType.valueOf(transformedResponse); } else if (itemType.isAssignableFrom(RollershutterItem.class)) { return PercentType.valueOf(transformedResponse); + } else if (itemType.isAssignableFrom(DateTimeItem.class)) { + return DateTimeType.valueOf(transformedResponse); } else { return StringType.valueOf(transformedResponse); } diff --git a/bundles/binding/org.openhab.binding.intertechno/src/main/java/org/openhab/binding/intertechno/internal/CULIntertechnoBinding.java b/bundles/binding/org.openhab.binding.intertechno/src/main/java/org/openhab/binding/intertechno/internal/CULIntertechnoBinding.java index 5fcb90388d5..6c5f32a3d1d 100644 --- a/bundles/binding/org.openhab.binding.intertechno/src/main/java/org/openhab/binding/intertechno/internal/CULIntertechnoBinding.java +++ b/bundles/binding/org.openhab.binding.intertechno/src/main/java/org/openhab/binding/intertechno/internal/CULIntertechnoBinding.java @@ -28,7 +28,7 @@ /** - * Implements the communcation with Intertechno devices via CUL devices. + * Implements the communication with Intertechno devices via CUL devices. * Currently it is only possible to send commands. * * @author Till Klocke @@ -75,7 +75,7 @@ public CULIntertechnoBinding() { } public void activate() { - bindCULHanlder(); + bindCULHandler(); } public void deactivate() { @@ -91,11 +91,11 @@ private void setNewDeviceName(String newDeviceName) { CULManager.close(cul); } deviceName = newDeviceName; - bindCULHanlder(); + bindCULHandler(); } } - private void bindCULHanlder() { + private void bindCULHandler() { if (!StringUtils.isEmpty(deviceName)) { try { cul = CULManager.getOpenCULHandler(deviceName, CULMode.SLOW_RF); diff --git a/bundles/binding/org.openhab.binding.intertechno/src/main/java/org/openhab/binding/intertechno/internal/CULIntertechnoGenericBindingProvider.java b/bundles/binding/org.openhab.binding.intertechno/src/main/java/org/openhab/binding/intertechno/internal/CULIntertechnoGenericBindingProvider.java index c1b902f46c2..3ba399b0bfe 100644 --- a/bundles/binding/org.openhab.binding.intertechno/src/main/java/org/openhab/binding/intertechno/internal/CULIntertechnoGenericBindingProvider.java +++ b/bundles/binding/org.openhab.binding.intertechno/src/main/java/org/openhab/binding/intertechno/internal/CULIntertechnoGenericBindingProvider.java @@ -54,7 +54,8 @@ public void validateItemType(Item item, String bindingConfig) /** * config of style - * {intertechno="type=;group=;address=
"} + * {{@literal intertechno="type=;group=;address=
"}}
+ * * {@inheritDoc} */ @Override diff --git a/bundles/binding/org.openhab.binding.intertechno/src/main/java/org/openhab/binding/intertechno/internal/parser/AbstractIntertechnoParser.java b/bundles/binding/org.openhab.binding.intertechno/src/main/java/org/openhab/binding/intertechno/internal/parser/AbstractIntertechnoParser.java index 4bffef6e1ac..b783ec5c968 100644 --- a/bundles/binding/org.openhab.binding.intertechno/src/main/java/org/openhab/binding/intertechno/internal/parser/AbstractIntertechnoParser.java +++ b/bundles/binding/org.openhab.binding.intertechno/src/main/java/org/openhab/binding/intertechno/internal/parser/AbstractIntertechnoParser.java @@ -19,7 +19,7 @@ public abstract class AbstractIntertechnoParser implements /** * Encode an integer as String for sending it via Intertechno. Numbers are - * repesented as "binary" Strings where each letter represents a byte. It si + * represented as "binary" Strings where each letter represents a byte. It is * configurable which letters represents 0 and which represents 1. * * @param length diff --git a/bundles/binding/org.openhab.binding.koubachi/src/main/java/org/openhab/binding/koubachi/internal/KoubachiBinding.java b/bundles/binding/org.openhab.binding.koubachi/src/main/java/org/openhab/binding/koubachi/internal/KoubachiBinding.java index 883c7981587..19b5f95546b 100644 --- a/bundles/binding/org.openhab.binding.koubachi/src/main/java/org/openhab/binding/koubachi/internal/KoubachiBinding.java +++ b/bundles/binding/org.openhab.binding.koubachi/src/main/java/org/openhab/binding/koubachi/internal/KoubachiBinding.java @@ -29,8 +29,10 @@ import org.openhab.core.binding.AbstractActiveBinding; import org.openhab.core.library.types.DateTimeType; import org.openhab.core.library.types.DecimalType; +import org.openhab.core.library.types.OnOffType; import org.openhab.core.library.types.StringType; import org.openhab.core.types.State; +import org.openhab.core.types.UnDefType; import org.openhab.io.net.http.HttpUtil; import org.osgi.service.cm.ConfigurationException; import org.osgi.service.cm.ManagedService; @@ -112,7 +114,7 @@ protected void execute() { try { Object propertyValue = PropertyUtils.getProperty(resource, propertyName); - State state = createState(propertyValue.getClass(), propertyValue); + State state = createState(propertyValue); if (state != null) { eventPublisher.postUpdate(itemName, state); } @@ -211,22 +213,38 @@ private R findResource(String id, List resources } /** - * Creates an openHAB {@link State} in accordance to the given {@code dataType}. Currently - * {@link Date} and {@link BigDecimal} are handled explicitly. All other {@code dataTypes} - * are mapped to {@link StringType}. + * Creates an openHAB {@link State} in accordance to the class of the given + * {@code propertyValue}. Currently {@link Date}, {@link BigDecimal} and + * {@link Boolean} are handled explicitly. All other {@code dataTypes} are + * mapped to {@link StringType}. + *

+ * If {@code propertyValue} is {@code null}, {@link UnDefType#NULL} will be + * returned. * - * @param dataType * @param propertyValue * - * @return the new {@link State} in accordance to {@code dataType}. Will never be {@code null}. + * @return the new {@link State} in accordance to {@code dataType}. Will + * never be {@code null}. */ - private State createState(Class dataType, Object propertyValue) { + private State createState(Object propertyValue) { + if(propertyValue == null) { + return UnDefType.NULL; + } + + Class dataType = propertyValue.getClass(); + if (Date.class.isAssignableFrom(dataType)) { Calendar calendar = Calendar.getInstance(); calendar.setTime((Date) propertyValue); return new DateTimeType(calendar); } else if (BigDecimal.class.isAssignableFrom(dataType)) { return new DecimalType((BigDecimal) propertyValue); + } else if (Boolean.class.isAssignableFrom(dataType)) { + if((Boolean) propertyValue) { + return OnOffType.ON; + } else { + return OnOffType.OFF; + } } else { return new StringType(propertyValue.toString()); } diff --git a/bundles/binding/org.openhab.binding.koubachi/src/main/java/org/openhab/binding/koubachi/internal/KoubachiGenericBindingProvider.java b/bundles/binding/org.openhab.binding.koubachi/src/main/java/org/openhab/binding/koubachi/internal/KoubachiGenericBindingProvider.java index d1a6f2b952b..0e0009fe48f 100644 --- a/bundles/binding/org.openhab.binding.koubachi/src/main/java/org/openhab/binding/koubachi/internal/KoubachiGenericBindingProvider.java +++ b/bundles/binding/org.openhab.binding.koubachi/src/main/java/org/openhab/binding/koubachi/internal/KoubachiGenericBindingProvider.java @@ -15,6 +15,7 @@ import org.openhab.core.library.items.DateTimeItem; import org.openhab.core.library.items.NumberItem; import org.openhab.core.library.items.StringItem; +import org.openhab.core.library.items.SwitchItem; import org.openhab.model.item.binding.AbstractGenericBindingProvider; import org.openhab.model.item.binding.BindingConfigParseException; @@ -49,10 +50,11 @@ public String getBindingType() { */ @Override public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException { - if (!(item instanceof NumberItem || item instanceof StringItem || item instanceof DateTimeItem)) { + if (!(item instanceof NumberItem || item instanceof StringItem || item instanceof DateTimeItem + || item instanceof SwitchItem)) { throw new BindingConfigParseException("item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName() - + "', only Number-, String- and DateTimeItems are allowed - please check your *.items configuration"); + + "', only Number-, String-, DateTime- and SwitchItems are allowed - please check your *.items configuration"); } } diff --git a/bundles/binding/org.openhab.binding.koubachi/src/main/java/org/openhab/binding/koubachi/internal/api/Plant.java b/bundles/binding/org.openhab.binding.koubachi/src/main/java/org/openhab/binding/koubachi/internal/api/Plant.java index 4312dd3580d..c2d688076f5 100644 --- a/bundles/binding/org.openhab.binding.koubachi/src/main/java/org/openhab/binding/koubachi/internal/api/Plant.java +++ b/bundles/binding/org.openhab.binding.koubachi/src/main/java/org/openhab/binding/koubachi/internal/api/Plant.java @@ -33,20 +33,30 @@ public class Plant extends KoubachiResource { Date lastWaterAt; Date nextWaterAt; + Boolean vdmWaterPending; String vdmWaterInstruction; BigDecimal vdmWaterLevel; + + Boolean vdmMistPending; String vdmMistInstruction; BigDecimal vdmMistLevel; + + Boolean vdmFertilizerPending; String vdmFertilizerInstruction; BigDecimal vdmFertilizerLevel; + + Boolean vdmTemperaturePending; + String vdmTemperatureAdvice; String vdmTemperatureHint; String vdmTemperatureInstruction; BigDecimal vdmTemperatureLevel; + + Boolean vdmLightPending; + String vdmLightAdvice; String vdmLightHint; String vdmLightInstruction; BigDecimal vdmLightLevel; - - + public String getName() { return name; } @@ -85,8 +95,12 @@ public Date getLastWaterAt() { public Date getNextWaterAt() { return nextWaterAt; } - - + + @JsonProperty("vdm_water_pending") + public Boolean getVdmWaterPending() { + return vdmWaterPending; + } + @JsonProperty("vdm_water_instruction") public String getVdmWaterInstruction() { return vdmWaterInstruction; @@ -96,7 +110,12 @@ public String getVdmWaterInstruction() { public BigDecimal getVdmWaterLevel() { return vdmWaterLevel; } - + + @JsonProperty("vdm_mist_pending") + public Boolean getVdmMistPending() { + return vdmMistPending; + } + @JsonProperty("vdm_mist_instruction") public String getVdmMistInstruction() { return vdmMistInstruction; @@ -107,6 +126,11 @@ public BigDecimal getVdmMistLevel() { return vdmMistLevel; } + @JsonProperty("vdm_fertilizer_pending") + public Boolean getVdmFertilizerPending() { + return vdmFertilizerPending; + } + @JsonProperty("vdm_fertilizer_instruction") public String getVdmFertilizerInstruction() { return vdmFertilizerInstruction; @@ -116,7 +140,17 @@ public String getVdmFertilizerInstruction() { public BigDecimal getVdmFertilizerLevel() { return vdmFertilizerLevel; } - + + @JsonProperty("vdm_temperature_pending") + public Boolean getVdmTemperaturePending() { + return vdmTemperaturePending; + } + + @JsonProperty("vdm_temperature_advice") + public String getVdmTemperatureAdvice() { + return vdmTemperatureAdvice; + } + @JsonProperty("vdm_temperature_hint") public String getVdmTemperatureHint() { return vdmTemperatureHint; @@ -131,7 +165,17 @@ public String getVdmTemperatureInstruction() { public BigDecimal getVdmTemperatureLevel() { return vdmTemperatureLevel; } - + + @JsonProperty("vdm_light_pending") + public Boolean getVdmLightPending() { + return vdmLightPending; + } + + @JsonProperty("vdm_light_advice") + public String getVdmLightAdvice() { + return vdmLightAdvice; + } + @JsonProperty("vdm_light_hint") public String getVdmLightHint() { return vdmLightHint; diff --git a/bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveMultiLevelSwitchCommandClass.java b/bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveMultiLevelSwitchCommandClass.java index 48872ccd701..7f3eca50354 100644 --- a/bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveMultiLevelSwitchCommandClass.java +++ b/bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveMultiLevelSwitchCommandClass.java @@ -161,7 +161,7 @@ public SerialMessage stopLevelChangeMessage() { logger.debug("Creating new message for application command SWITCH_MULTILEVEL_STOP_LEVEL_CHANGE for node {}", this.getNode().getNodeId()); SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.SendData, SerialMessagePriority.Set); byte[] newPayload = { (byte) this.getNode().getNodeId(), - 3, + 2, (byte) getCommandClass().getKey(), (byte) SWITCH_MULTILEVEL_STOP_LEVEL_CHANGE }; result.setMessagePayload(newPayload); diff --git a/pom.xml b/pom.xml index aeb711cf409..192612fcdf8 100644 --- a/pom.xml +++ b/pom.xml @@ -64,6 +64,13 @@ + + + org.apache.maven.wagon + wagon-webdav + 1.0-beta-2 + + ${tycho-groupid} @@ -265,6 +272,39 @@ org.apache.felix.fileinstall 3.2.6 - + + + + + deploy-p2 + + 1.0-beta-4 + + + + + org.codehaus.mojo + wagon-maven-plugin + 1.0-beta-4 + + + upload-p2-repo + install + + upload + + + ${p2.repo.serverid} + ${p2.repo.url} + ${project.basedir}/products/org.openhab.runtime.product/target/repository + ${p2.repo.dir} + + + + + + + +