forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[opensprinkler] Improvements: Remove apache.commons, fix bugs and war…
…nings (openhab#9869) * Fix: current channel would not get added. Signed-off-by: Matthew Skinner <[email protected]> * Fix: online and offline now detect correctly. Signed-off-by: Matthew Skinner <[email protected]> * Improve discovery. Signed-off-by: Matthew Skinner <[email protected]> * Bug fixes. Signed-off-by: Matthew Skinner <[email protected]> * Misc Improvements and log cleanup. Signed-off-by: Matthew Skinner <[email protected]> * Make current sensor channel dynamically get removed if not supported. Signed-off-by: Matthew Skinner <[email protected]> * fix compiler warning. Signed-off-by: Matthew Skinner <[email protected]> * readme updates. Signed-off-by: Matthew Skinner <[email protected]> * Shift refresh() Signed-off-by: Matthew Skinner <[email protected]> * Add RSSI and water flow meter count channels. Signed-off-by: Matthew Skinner <[email protected]> * Change to flowSensorCount Signed-off-by: Matthew Skinner <[email protected]> * Fix bug Signed-off-by: Matthew Skinner <[email protected]> * Fix NPE on parsing jsReplies. Signed-off-by: Matthew Skinner <[email protected]> * Add new programs channel. Signed-off-by: Matthew Skinner <[email protected]> * Fix wrong api use. Signed-off-by: Matthew Skinner <[email protected]> * Change to using max time if the time is null. Signed-off-by: Matthew Skinner <[email protected]> * Add device withRepresentationProperty Signed-off-by: Matthew Skinner <[email protected]> * update readme Signed-off-by: Matthew Skinner <[email protected]> * Fix rain sensor not working in 219 firmware. Signed-off-by: Matthew Skinner <[email protected]> * Spotless fixes. Signed-off-by: Matthew Skinner <[email protected]> * fix gson double up error. Signed-off-by: Matthew Skinner <[email protected]> * Add more channels Signed-off-by: Matthew Skinner <[email protected]> * refresh completed before bridge goes online. Signed-off-by: Matthew Skinner <[email protected]> * Simplify. Signed-off-by: Matthew Skinner <[email protected]> * Allow non default password to not stop discovery. Signed-off-by: Matthew Skinner <[email protected]> * Add ignoresRain channel Signed-off-by: Matthew Skinner <[email protected]> * Simplify commands in station handler. Signed-off-by: Matthew Skinner <[email protected]> * Add new rainDelay channel. Signed-off-by: Matthew Skinner <[email protected]> * Make constants consistent. Signed-off-by: Matthew Skinner <[email protected]> * Add categories. Signed-off-by: Matthew Skinner <[email protected]> * Changes requested by FlorianSW Signed-off-by: Matthew Skinner <[email protected]> * Stop catching and throwing new exp. Signed-off-by: Matthew Skinner <[email protected]> * Create a state class. Signed-off-by: Matthew Skinner <[email protected]> * Update bundles/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/internal/discovery/OpenSprinklerDiscoveryService.java Signed-off-by: Matthew Skinner <[email protected]> Co-authored-by: Connor Petty <[email protected]> * Fix for EOF exception that stops polling with bad wifi. Signed-off-by: Matthew Skinner <[email protected]> * Change signal strength over to 0-4 range Signed-off-by: Matthew Skinner <[email protected]> * Handle toUnit null returns. Signed-off-by: Matthew Skinner <[email protected]> * Support discovery on subnets that are not /24 Signed-off-by: Matthew Skinner <[email protected]> * update readme for recent changes to signalStrength channel. Signed-off-by: Matthew Skinner <[email protected]> * Fix code anal issue and readme. Signed-off-by: Matthew Skinner <[email protected]> * Remove info logging. Signed-off-by: Matthew Skinner <[email protected]> * remove traces of old dependancy. Signed-off-by: Matthew Skinner <[email protected]> * Changes for fwolter Signed-off-by: Matthew Skinner <[email protected]> * support RSSI and rssi Signed-off-by: Matthew Skinner <[email protected]> * Update after new command sent. Signed-off-by: Matthew Skinner <[email protected]> * improve delayedRefresh Signed-off-by: Matthew Skinner <[email protected]> * Remove supressWarnings Signed-off-by: Matthew Skinner <[email protected]> Co-authored-by: Connor Petty <[email protected]>
- Loading branch information
1 parent
6036e1d
commit 3cfa77a
Showing
40 changed files
with
1,301 additions
and
755 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
bundles/org.openhab.binding.opensprinkler/src/main/feature/feature.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<features name="org.openhab.binding.opensprinkler-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"> | ||
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository> | ||
|
||
<feature name="openhab-binding-opensprinkler" description="OpenSprinkler Binding" version="${project.version}"> | ||
<feature>openhab-runtime-base</feature> | ||
<feature dependency="true">openhab.tp-commons-net</feature> | ||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.opensprinkler/${project.version}</bundle> | ||
</feature> | ||
</features> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...prinkler/src/main/java/org/openhab/binding/opensprinkler/internal/OpenSprinklerState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** | ||
* Copyright (c) 2010-2021 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.opensprinkler.internal; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.openhab.core.types.StateOption; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
/** | ||
* The {@link OpenSprinklerState} class holds the state and replies for an OpenSprinkler device. | ||
* | ||
* @author Matthew Skinner - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class OpenSprinklerState { | ||
public JcResponse jcReply = new JcResponse(); | ||
public JoResponse joReply = new JoResponse(); | ||
public JsResponse jsReply = new JsResponse(); | ||
public JpResponse jpReply = new JpResponse(); | ||
public JnResponse jnReply = new JnResponse(); | ||
public List<StateOption> programs = new ArrayList<>(); | ||
public List<StateOption> stations = new ArrayList<>(); | ||
|
||
public static class JsResponse { | ||
public int sn[] = new int[8]; | ||
public int nstations = 8; | ||
} | ||
|
||
public static class JpResponse { | ||
public int nprogs = 0; | ||
public Object[] pd = {}; | ||
} | ||
|
||
public static class JoResponse { | ||
public int wl; | ||
public int fwv = -1; | ||
} | ||
|
||
public static class JcResponse { | ||
public @Nullable List<List<Integer>> ps; | ||
@SerializedName(value = "sn1", alternate = "rs") | ||
public int rs; | ||
public long devt = 0; | ||
public long rdst = 0; | ||
public int en = 1; | ||
public int sn2 = -1; | ||
@SerializedName(value = "RSSI", alternate = "rssi") // json reply uses all uppercase | ||
public int rssi = 1; | ||
public int flcrt = -1; | ||
public int curr = -1; | ||
} | ||
|
||
public static class JnResponse { | ||
public List<String> snames = new ArrayList<>(); | ||
@SerializedName(value = "ignore_rain", alternate = "ignoreRain") | ||
public byte[] ignoreRain = { 0 }; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...ava/org/openhab/binding/opensprinkler/internal/OpenSprinklerStateDescriptionProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Copyright (c) 2010-2021 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.opensprinkler.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.openhab.core.thing.binding.BaseDynamicStateDescriptionProvider; | ||
import org.openhab.core.thing.i18n.ChannelTypeI18nLocalizationService; | ||
import org.openhab.core.thing.type.DynamicStateDescriptionProvider; | ||
import org.osgi.service.component.annotations.Activate; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Reference; | ||
|
||
/** | ||
* The {@link OpenSprinklerStateDescriptionProvider} Allows the dynamic updating of Programs that can be run from an | ||
* Opensprinkler Device | ||
* | ||
* @author Matthew Skinner - Initial contribution | ||
*/ | ||
@Component(service = { DynamicStateDescriptionProvider.class, OpenSprinklerStateDescriptionProvider.class }) | ||
@NonNullByDefault | ||
public class OpenSprinklerStateDescriptionProvider extends BaseDynamicStateDescriptionProvider { | ||
@Activate | ||
public OpenSprinklerStateDescriptionProvider( | ||
final @Reference ChannelTypeI18nLocalizationService channelTypeI18nLocalizationService) { | ||
this.channelTypeI18nLocalizationService = channelTypeI18nLocalizationService; | ||
} | ||
} |
Oops, something went wrong.