-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tacmi] Initial contribution tacmi binding (#7768)
Migrated from the openHAB 1 version. Signed-off-by: Christian Niessner <[email protected]>
- Loading branch information
Showing
39 changed files
with
3,585 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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,49 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="test" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path="target/generated-sources/annotations"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="ignore_optional_problems" value="true"/> | ||
<attribute name="m2e-apt" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="ignore_optional_problems" value="true"/> | ||
<attribute name="m2e-apt" value="true"/> | ||
<attribute name="test" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
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,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.openhab.binding.tacmi</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
</natures> | ||
</projectDescription> |
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,20 @@ | ||
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 | ||
|
||
== Third-party Content | ||
|
||
attoparser | ||
* License: Apache 2.0 | ||
* Project: https://www.attoparser.org | ||
* Source: https://github.com/attoparser/attoparser |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file added
BIN
+53.8 KB
bundles/org.openhab.binding.tacmi/doc/images/channel-object-details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.4 KB
bundles/org.openhab.binding.tacmi/doc/images/operation-mode-values.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38.1 KB
bundles/org.openhab.binding.tacmi/doc/images/sample-with-heating-circuit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 http://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>2.5.9-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>org.openhab.binding.tacmi</artifactId> | ||
|
||
<name>openHAB Add-ons :: Bundles :: TA C.M.I. Binding</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.attoparser</groupId> | ||
<artifactId>attoparser</artifactId> | ||
<version>2.0.5.RELEASE</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
9 changes: 9 additions & 0 deletions
9
bundles/org.openhab.binding.tacmi/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.tacmi-${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-tacmi" description="TACmi Binding" version="${project.version}"> | ||
<feature>openhab-runtime-base</feature> | ||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.tacmi/${project.version}</bundle> | ||
</feature> | ||
</features> |
55 changes: 55 additions & 0 deletions
55
...binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/TACmiBindingConstants.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,55 @@ | ||
/** | ||
* Copyright (c) 2010-2020 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.tacmi.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.smarthome.core.thing.ThingTypeUID; | ||
import org.eclipse.smarthome.core.thing.type.ChannelTypeUID; | ||
|
||
/** | ||
* The {@link TACmiBindingConstants} class defines common constants, which are | ||
* used across the whole binding. | ||
* | ||
* @author Christian Niessner - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class TACmiBindingConstants { | ||
|
||
public static final String BINDING_ID = "tacmi"; | ||
|
||
// List of all Thing Type UIDs | ||
public static final ThingTypeUID THING_TYPE_CMI = new ThingTypeUID(BINDING_ID, "cmi"); | ||
public static final ThingTypeUID THING_TYPE_COE_BRIDGE = new ThingTypeUID(BINDING_ID, "coe-bridge"); | ||
public static final ThingTypeUID THING_TYPE_CMI_SCHEMA = new ThingTypeUID(BINDING_ID, "cmiSchema"); | ||
|
||
public static final ChannelTypeUID CHANNEL_TYPE_COE_DIGITAL_IN_UID = new ChannelTypeUID(BINDING_ID, | ||
"coe-digital-in"); | ||
public static final ChannelTypeUID CHANNEL_TYPE_COE_ANALOG_IN_UID = new ChannelTypeUID(BINDING_ID, "coe-analog-in"); | ||
|
||
public static final ChannelTypeUID CHANNEL_TYPE_COE_DIGITAL_OUT_UID = new ChannelTypeUID(BINDING_ID, | ||
"coe-digital-out"); | ||
public static final ChannelTypeUID CHANNEL_TYPE_COE_ANALOG_OUT_UID = new ChannelTypeUID(BINDING_ID, | ||
"coe-analog-out"); | ||
|
||
public static final ChannelTypeUID CHANNEL_TYPE_SCHEME_SWITCH_RO_UID = new ChannelTypeUID(BINDING_ID, | ||
"schema-switch-ro"); | ||
public static final ChannelTypeUID CHANNEL_TYPE_SCHEME_SWITCH_RW_UID = new ChannelTypeUID(BINDING_ID, | ||
"schema-switch-rw"); | ||
public static final ChannelTypeUID CHANNEL_TYPE_SCHEME_NUMERIC_RO_UID = new ChannelTypeUID(BINDING_ID, | ||
"schema-numeric-ro"); | ||
public static final ChannelTypeUID CHANNEL_TYPE_SCHEME_STATE_RO_UID = new ChannelTypeUID(BINDING_ID, | ||
"schema-state-ro"); | ||
|
||
// Channel specific configuration items | ||
public final static String CHANNEL_CONFIG_OUTPUT = "output"; | ||
} |
56 changes: 56 additions & 0 deletions
56
...ding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/TACmiChannelTypeProvider.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,56 @@ | ||
/** | ||
* Copyright (c) 2010-2020 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.tacmi.internal; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.Locale; | ||
import java.util.Map; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.smarthome.core.thing.type.ChannelType; | ||
import org.eclipse.smarthome.core.thing.type.ChannelTypeProvider; | ||
import org.eclipse.smarthome.core.thing.type.ChannelTypeUID; | ||
import org.osgi.service.component.annotations.Component; | ||
|
||
/** | ||
* Provides all ChannelTypes for the schema binding... | ||
* | ||
* @author Christian Niessner - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
@Component(service = { TACmiChannelTypeProvider.class, ChannelTypeProvider.class }) | ||
public class TACmiChannelTypeProvider implements ChannelTypeProvider { | ||
|
||
private final Map<ChannelTypeUID, ChannelType> channelTypesByUID = new HashMap<>(); | ||
|
||
@Override | ||
public Collection<ChannelType> getChannelTypes(@Nullable Locale locale) { | ||
return Collections.unmodifiableCollection(channelTypesByUID.values()); | ||
} | ||
|
||
@Override | ||
public @Nullable ChannelType getChannelType(ChannelTypeUID channelTypeUID, @Nullable Locale locale) { | ||
return channelTypesByUID.get(channelTypeUID); | ||
} | ||
|
||
public ChannelType getInternalChannelType(ChannelTypeUID channelTypeUID) { | ||
return channelTypesByUID.get(channelTypeUID); | ||
} | ||
|
||
public void addChannelType(ChannelType channelType) { | ||
channelTypesByUID.put(channelType.getUID(), channelType); | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
...b.binding.tacmi/src/main/java/org/openhab/binding/tacmi/internal/TACmiHandlerFactory.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,81 @@ | ||
/** | ||
* Copyright (c) 2010-2020 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.tacmi.internal; | ||
|
||
import static org.openhab.binding.tacmi.internal.TACmiBindingConstants.*; | ||
|
||
import java.util.Collections; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.jetty.client.HttpClient; | ||
import org.eclipse.smarthome.core.thing.Bridge; | ||
import org.eclipse.smarthome.core.thing.Thing; | ||
import org.eclipse.smarthome.core.thing.ThingTypeUID; | ||
import org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory; | ||
import org.eclipse.smarthome.core.thing.binding.ThingHandler; | ||
import org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory; | ||
import org.eclipse.smarthome.io.net.http.HttpClientFactory; | ||
import org.openhab.binding.tacmi.internal.coe.TACmiCoEBridgeHandler; | ||
import org.openhab.binding.tacmi.internal.coe.TACmiHandler; | ||
import org.openhab.binding.tacmi.internal.schema.TACmiSchemaHandler; | ||
import org.osgi.service.component.annotations.Activate; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Reference; | ||
|
||
/** | ||
* The {@link TACmiHandlerFactory} is responsible for creating things and thing | ||
* handlers. | ||
* | ||
* @author Christian Niessner - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
@Component(configurationPid = "binding.tacmi", service = ThingHandlerFactory.class) | ||
public class TACmiHandlerFactory extends BaseThingHandlerFactory { | ||
|
||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.unmodifiableSet( | ||
Stream.of(THING_TYPE_CMI, THING_TYPE_COE_BRIDGE, THING_TYPE_CMI_SCHEMA).collect(Collectors.toSet())); | ||
|
||
private final HttpClient httpClient; | ||
private final TACmiChannelTypeProvider channelTypeProvider; | ||
|
||
@Activate | ||
public TACmiHandlerFactory(@Reference HttpClientFactory httpClientFactory, | ||
@Reference TACmiChannelTypeProvider channelTypeProvider) { | ||
this.httpClient = httpClientFactory.getCommonHttpClient(); | ||
this.channelTypeProvider = channelTypeProvider; | ||
} | ||
|
||
@Override | ||
public boolean supportsThingType(ThingTypeUID thingTypeUID) { | ||
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID); | ||
} | ||
|
||
@Override | ||
protected @Nullable ThingHandler createHandler(Thing thing) { | ||
ThingTypeUID thingTypeUID = thing.getThingTypeUID(); | ||
|
||
if (THING_TYPE_CMI.equals(thingTypeUID)) { | ||
return new TACmiHandler(thing); | ||
} else if (THING_TYPE_COE_BRIDGE.equals(thingTypeUID)) { | ||
return new TACmiCoEBridgeHandler((Bridge) thing); | ||
} else if (THING_TYPE_CMI_SCHEMA.equals(thingTypeUID)) { | ||
return new TACmiSchemaHandler(thing, httpClient, channelTypeProvider); | ||
} | ||
|
||
return null; | ||
} | ||
} |
Oops, something went wrong.