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

[tacmi] Initial push of OpenHAB 2 ported tacmi binding #7768

Merged
merged 28 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a8d9a30
[tacmi] Initial push of OpenHAB 2 ported tacmi binding
marvkis May 24, 2020
eb8ee35
[tacmi] fixed travis errors & added some @NonNullByDefault
marvkis May 24, 2020
fe7360d
[tacmi] fixed further travis errors & warnings, especially Null handl…
marvkis May 24, 2020
f4977fc
[tacmi] fixed further travis errors & warnings, especially Null handl…
marvkis May 24, 2020
882889d
[tacmi] fixed a XML identing issue causing travis to fail..
marvkis May 24, 2020
d8dc115
[tacmi] executed `mvn spotless:apply` to fix formatting issues
marvkis May 24, 2020
1f84759
[tacmi] initial WIP-Checkin of the "Schema API Page" variant
marvkis Aug 2, 2020
60c69f2
[tacmi] added initial documentation for the new API Page thing
marvkis Aug 2, 2020
882c6fd
[tacmi] Apply suggestions from code review
marvkis Aug 4, 2020
92171cd
[tacmi] ApiPageParser - added new unit 'Hz'
marvkis Aug 4, 2020
d1c13cb
[tacmi] Applied requested changes from code review - stright forward …
marvkis Aug 9, 2020
ed8e26a
[tacmi] Applied requested changes from code review - RefreshType for …
marvkis Aug 9, 2020
079a916
[tacmi] CoE communication: added thing config parameter 'persistInter…
marvkis Aug 9, 2020
040bd74
[tacmi] Applied requested changes from code review - final changes
marvkis Aug 9, 2020
b949863
[tacmi] Made @NonNullByDefault with ApiPageParser & ChangerX2Parser
marvkis Aug 28, 2020
9e2d585
[tacmi] schema thing: improved logging in ChangerX2Parser and suppres…
marvkis Aug 30, 2020
68d8f04
[tacmi] CoE thing: removed persistence layer; channel configuration p…
marvkis Aug 30, 2020
40a6d5f
[tacmi] Schema thing: Initial support for older pre-X2 devices
marvkis Sep 5, 2020
ddb472c
[tacmi] Improved documentation
marvkis Sep 5, 2020
d9bc1bd
[tacmi] upgraded to 2.5.9 and applied latest spotless rules
marvkis Sep 5, 2020
14893ca
[tacmi] Apply suggestions from code review
marvkis Sep 6, 2020
6289423
[tacmi] Additional changes from code review: Thread name, reduced log…
marvkis Sep 6, 2020
5f5bbed
[tacmi] Additional changes from code review: Thread name, logging & e…
marvkis Sep 7, 2020
c79ed2a
[tacmi] Reduced logging output...
marvkis Sep 8, 2020
6f5f9a1
[tacmi] Apply suggestions from code review: code formatting and some …
marvkis Sep 9, 2020
222858f
[tacmi] TACmiHandler - improved thing states and transitions
marvkis Sep 9, 2020
92eb6cf
[tacmi] Additional cleanups & improvements from review
marvkis Sep 9, 2020
cd25457
[tacmi] logging: changed some more loggings from warn to debug
marvkis Sep 9, 2020
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
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
/bundles/org.openhab.binding.mpd/ @stefanroellin
/bundles/org.openhab.binding.synopanalyzer/ @clinique
/bundles/org.openhab.binding.systeminfo/ @svilenvul
/bundles/org.openhab.binding.tacmi/ @twendt @Wolfgang1966 @marvkis
/bundles/org.openhab.binding.tado/ @dfrommi
/bundles/org.openhab.binding.tankerkoenig/ @dolic @JueBag
/bundles/org.openhab.binding.telegram/ @ZzetT
Expand Down
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,11 @@
<artifactId>org.openhab.binding.systeminfo</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.tacmi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.tado</artifactId>
Expand Down
49 changes: 49 additions & 0 deletions bundles/org.openhab.binding.tacmi/.classpath
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>
23 changes: 23 additions & 0 deletions bundles/org.openhab.binding.tacmi/.project
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>
20 changes: 20 additions & 0 deletions bundles/org.openhab.binding.tacmi/NOTICE
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
Hilbrand marked this conversation as resolved.
Show resolved Hide resolved

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
264 changes: 264 additions & 0 deletions bundles/org.openhab.binding.tacmi/README.md

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions bundles/org.openhab.binding.tacmi/pom.xml
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>
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>
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";
}
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);
}
}
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;
}
}
Loading