-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[intellicenter2] Initial contribution #13334
Open
valdisrigdon
wants to merge
3
commits into
openhab:main
Choose a base branch
from
valdisrigdon:intellicenter2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
512043d
[intellicenter2] feat: adds IntelliCenter2 binding for Pentair
valdisrigdon 419b476
fixup! [intellicenter2] feat: adds IntelliCenter2 binding for Pentair
valdisrigdon c66de7c
fixup! fixup! [intellicenter2] feat: adds IntelliCenter2 binding for …
valdisrigdon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,13 @@ | ||
This content is produced and maintained by the openHAB project. | ||
|
||
* Project home: https://www.openhab.org | ||
|
||
== Declared Project Licenses | ||
|
||
This program and the accompanying materials are made available under the terms | ||
of the Eclipse Public License 2.0 which is available at | ||
https://www.eclipse.org/legal/epl-2.0/. | ||
|
||
== Source Code | ||
|
||
https://github.com/openhab/openhab-addons |
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,76 @@ | ||
# IntelliCenter2 Binding | ||
|
||
_Give some details about what this binding is meant for - a protocol, system, specific device._ | ||
|
||
_If possible, provide some resources like pictures (only PNG is supported currently), a video, etc. to give an impression of what can be done with this binding._ | ||
_You can place such resources into a `doc` folder next to this README.md._ | ||
|
||
_Put each sentence in a separate line to improve readability of diffs._ | ||
|
||
## Supported Things | ||
|
||
_Please describe the different supported things / devices including their ThingTypeUID within this section._ | ||
_Which different types are supported, which models were tested etc.?_ | ||
_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/OH-INF/thing``` of your binding._ | ||
|
||
- `bridge`: Short description of the Bridge, if any | ||
- `sample`: Short description of the Thing with the ThingTypeUID `sample` | ||
|
||
## Discovery | ||
|
||
_Describe the available auto-discovery features here._ | ||
_Mention for what it works and what needs to be kept in mind when using it._ | ||
|
||
## Binding Configuration | ||
|
||
_If your binding requires or supports general configuration settings, please create a folder ```cfg``` and place the configuration file ```<bindingId>.cfg``` inside it._ | ||
_In this section, you should link to this file and provide some information about the options._ | ||
_The file could e.g. look like:_ | ||
|
||
``` | ||
# Configuration for the IntelliCenter2 Binding | ||
# | ||
# Default secret key for the pairing of the IntelliCenter2 Thing. | ||
# It has to be between 10-40 (alphanumeric) characters. | ||
# This may be changed by the user for security reasons. | ||
secret=openHABSecret | ||
``` | ||
|
||
_Note that it is planned to generate some part of this based on the information that is available within ```src/main/resources/OH-INF/binding``` of your binding._ | ||
|
||
_If your binding does not offer any generic configurations, you can remove this section completely._ | ||
|
||
## Thing Configuration | ||
|
||
_Describe what is needed to manually configure a thing, either through the UI or via a thing-file._ | ||
_This should be mainly about its mandatory and optional configuration parameters._ | ||
|
||
_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/OH-INF/thing``` of your binding._ | ||
|
||
### `sample` Thing Configuration | ||
|
||
| Name | Type | Description | Default | Required | Advanced | | ||
|-----------------|---------|---------------------------------------|---------|----------|----------| | ||
| hostname | text | Hostname or IP address of the device | N/A | yes | no | | ||
| password | text | Password to access the device | N/A | yes | no | | ||
| refreshInterval | integer | Interval the device is polled in sec. | 600 | no | yes | | ||
|
||
## Channels | ||
|
||
_Here you should provide information about available channel types, what their meaning is and how they can be used._ | ||
|
||
_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/OH-INF/thing``` of your binding._ | ||
|
||
| Channel | Type | Read/Write | Description | | ||
|---------|--------|------------|-----------------------------| | ||
| control | Switch | RW | This is the control channel | | ||
|
||
## Full Example | ||
|
||
_Provide a full usage example based on textual configuration files._ | ||
_*.things, *.items examples are mandatory as textual configuration is well used by many users._ | ||
_*.sitemap examples are optional._ | ||
|
||
## Any custom content here! | ||
|
||
_Feel free to add additional sections for whatever you think should also be mentioned about your binding!_ | ||
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,25 @@ | ||||||
<?xml version="1.0" encoding="UTF-8"?> | ||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||||
|
||||||
<modelVersion>4.0.0</modelVersion> | ||||||
<parent> | ||||||
<groupId>org.openhab.addons.bundles</groupId> | ||||||
<artifactId>org.openhab.addons.reactor.bundles</artifactId> | ||||||
<version>4.3.0-SNAPSHOT</version> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
</parent> | ||||||
|
||||||
<artifactId>org.openhab.binding.intellicenter2</artifactId> | ||||||
|
||||||
<name>openHAB Add-ons :: Bundles :: IntelliCenter2 Binding</name> | ||||||
|
||||||
<dependencies> | ||||||
<dependency> | ||||||
<groupId>com.google.guava</groupId> | ||||||
<artifactId>guava</artifactId> | ||||||
<version>14.0.1</version> | ||||||
<scope>provided</scope> | ||||||
</dependency> | ||||||
</dependencies> | ||||||
|
||||||
</project> |
9 changes: 9 additions & 0 deletions
9
bundles/org.openhab.binding.intellicenter2/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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<features name="org.openhab.binding.intellicenter2-${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-intellicenter2" description="IntelliCenter2 Binding" version="${project.version}"> | ||
<feature>openhab-runtime-base</feature> | ||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.intellicenter2/${project.version}</bundle> | ||
</feature> | ||
</features> |
50 changes: 50 additions & 0 deletions
50
...main/java/org/openhab/binding/intellicenter2/internal/IntelliCenter2BindingConstants.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,50 @@ | ||
/** | ||
* Copyright (c) 2010-2024 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.intellicenter2.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.openhab.core.thing.ThingTypeUID; | ||
|
||
/** | ||
* The {@link IntelliCenter2BindingConstants} class defines common constants, which are | ||
* used across the whole binding. | ||
* | ||
* @author Valdis Rigdon - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class IntelliCenter2BindingConstants { | ||
|
||
private static final String BINDING_ID = "intellicenter2"; | ||
|
||
// List of all Thing Type UIDs | ||
public static final ThingTypeUID THING_TYPE_POOL = new ThingTypeUID(BINDING_ID, "pool"); | ||
public static final ThingTypeUID THING_TYPE_FEATURE = new ThingTypeUID(BINDING_ID, "feature"); | ||
public static final ThingTypeUID THING_TYPE_LIGHT = new ThingTypeUID(BINDING_ID, "light"); | ||
public static final ThingTypeUID THING_TYPE_PUMP = new ThingTypeUID(BINDING_ID, "pump"); | ||
public static final ThingTypeUID THING_TYPE_SENSOR = new ThingTypeUID(BINDING_ID, "sensor"); | ||
public static final ThingTypeUID BRIDGE_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "bridge"); | ||
|
||
// List of all Channel ids | ||
public static final String CHANNEL_CURRENT_TEMPERATURE = "current-temperature"; | ||
public static final String CHANNEL_TARGET_TEMPERATURE = "target-temperature"; | ||
public static final String CHANNEL_HEATER_STATUS = "heater-status"; | ||
public static final String CHANNEL_FEATURE_ON_OFF = "feature-on-off"; | ||
public static final String CHANNEL_LIGHT_COLOR = "light-color"; | ||
public static final String CHANNEL_LIGHT_POWER = "light-power"; | ||
public static final String CHANNEL_PUMP_GPM = "pump-gpm"; | ||
public static final String CHANNEL_PUMP_RPM = "pump-rpm"; | ||
public static final String CHANNEL_PUMP_POWER = "pump-power"; | ||
public static final String CHANNEL_SENSOR_PROBE = "sensor-probe"; | ||
public static final String CHANNEL_SENSOR_SOURCE = "sensor-source"; | ||
public static final String CHANNEL_SENSOR_CALIB = "sensor-calib"; | ||
} |
45 changes: 45 additions & 0 deletions
45
...rc/main/java/org/openhab/binding/intellicenter2/internal/IntelliCenter2Configuration.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,45 @@ | ||
/** | ||
* Copyright (c) 2010-2024 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 | ||
*/ | ||
/** | ||
|
||
* Copyright (c) 2010-2024 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.intellicenter2.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* The {@link IntelliCenter2Configuration} class contains fields mapping thing configuration parameters. | ||
* | ||
* @author Valdis Rigdon - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class IntelliCenter2Configuration { | ||
|
||
public String hostname = ""; | ||
public int port = 6681; | ||
|
||
@Override | ||
public String toString() { | ||
return getClass().getSimpleName() + "{hostname=" + hostname + ", port=" + port + "}"; | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
...c/main/java/org/openhab/binding/intellicenter2/internal/IntelliCenter2HandlerFactory.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,86 @@ | ||
/** | ||
* Copyright (c) 2010-2024 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.intellicenter2.internal; | ||
|
||
import static org.openhab.binding.intellicenter2.internal.IntelliCenter2BindingConstants.BRIDGE_TYPE_BRIDGE; | ||
import static org.openhab.binding.intellicenter2.internal.IntelliCenter2BindingConstants.THING_TYPE_FEATURE; | ||
import static org.openhab.binding.intellicenter2.internal.IntelliCenter2BindingConstants.THING_TYPE_LIGHT; | ||
import static org.openhab.binding.intellicenter2.internal.IntelliCenter2BindingConstants.THING_TYPE_POOL; | ||
import static org.openhab.binding.intellicenter2.internal.IntelliCenter2BindingConstants.THING_TYPE_PUMP; | ||
import static org.openhab.binding.intellicenter2.internal.IntelliCenter2BindingConstants.THING_TYPE_SENSOR; | ||
|
||
import java.util.Set; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.openhab.binding.intellicenter2.internal.handler.IntelliCenter2BridgeHandler; | ||
import org.openhab.binding.intellicenter2.internal.handler.IntelliCenter2FeatureHandler; | ||
import org.openhab.binding.intellicenter2.internal.handler.IntelliCenter2LightHandler; | ||
import org.openhab.binding.intellicenter2.internal.handler.IntelliCenter2PoolHandler; | ||
import org.openhab.binding.intellicenter2.internal.handler.IntelliCenter2PumpHandler; | ||
import org.openhab.binding.intellicenter2.internal.handler.IntelliCenter2SensorHandler; | ||
import org.openhab.core.thing.Bridge; | ||
import org.openhab.core.thing.Thing; | ||
import org.openhab.core.thing.ThingTypeUID; | ||
import org.openhab.core.thing.binding.BaseThingHandlerFactory; | ||
import org.openhab.core.thing.binding.ThingHandler; | ||
import org.openhab.core.thing.binding.ThingHandlerFactory; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* The {@link IntelliCenter2HandlerFactory} is responsible for creating things and thing | ||
* handlers. | ||
* | ||
* @author Valdis Rigdon - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
@Component(configurationPid = "binding.intellicenter2", service = ThingHandlerFactory.class) | ||
public class IntelliCenter2HandlerFactory extends BaseThingHandlerFactory { | ||
|
||
private final Logger logger = LoggerFactory.getLogger(IntelliCenter2HandlerFactory.class); | ||
|
||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(BRIDGE_TYPE_BRIDGE, THING_TYPE_POOL, | ||
THING_TYPE_FEATURE, THING_TYPE_LIGHT, THING_TYPE_PUMP, THING_TYPE_SENSOR); | ||
|
||
public IntelliCenter2HandlerFactory() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public boolean supportsThingType(ThingTypeUID thingTypeUID) { | ||
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID); | ||
} | ||
|
||
@Override | ||
protected @Nullable ThingHandler createHandler(Thing thing) { | ||
final ThingTypeUID thingTypeUID = thing.getThingTypeUID(); | ||
logger.debug("Creating handler for {}", thingTypeUID); | ||
if (thingTypeUID.equals(BRIDGE_TYPE_BRIDGE)) { | ||
return new IntelliCenter2BridgeHandler((Bridge) thing); | ||
} else if (thingTypeUID.equals(THING_TYPE_POOL)) { | ||
return new IntelliCenter2PoolHandler(thing); | ||
} else if (thingTypeUID.equals(THING_TYPE_FEATURE)) { | ||
return new IntelliCenter2FeatureHandler(thing); | ||
} else if (thingTypeUID.equals(THING_TYPE_LIGHT)) { | ||
return new IntelliCenter2LightHandler(thing); | ||
} else if (thingTypeUID.equals(THING_TYPE_PUMP)) { | ||
return new IntelliCenter2PumpHandler(thing); | ||
} else if (thingTypeUID.equals(THING_TYPE_SENSOR)) { | ||
return new IntelliCenter2SensorHandler(thing); | ||
} | ||
logger.error("Unable to create handler for {}", thingTypeUID); | ||
return null; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document the binding in this file.