Skip to content

Commit

Permalink
[guntamatic] Initial contribution
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Weger <[email protected]>
  • Loading branch information
MikeTheTux committed Jan 9, 2022
1 parent e9887c3 commit 1d01254
Show file tree
Hide file tree
Showing 15 changed files with 1,629 additions and 0 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
/bundles/org.openhab.binding.gpstracker/ @gbicskei
/bundles/org.openhab.binding.gree/ @markus7017
/bundles/org.openhab.binding.groheondus/ @FlorianSW
/bundles/org.openhab.binding.guntamatic/ @MikeTheTux
/bundles/org.openhab.binding.haassohnpelletstove/ @chingon007
/bundles/org.openhab.binding.harmonyhub/ @digitaldan
/bundles/org.openhab.binding.haywardomnilogic/ @matchews
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 @@ -541,6 +541,11 @@
<artifactId>org.openhab.binding.groheondus</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.guntamatic</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.haassohnpelletstove</artifactId>
Expand Down
13 changes: 13 additions & 0 deletions bundles/org.openhab.binding.guntamatic/NOTICE
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
362 changes: 362 additions & 0 deletions bundles/org.openhab.binding.guntamatic/README.md

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions bundles/org.openhab.binding.guntamatic/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?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>3.3.0-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.binding.guntamatic</artifactId>

<name>openHAB Add-ons :: Bundles :: Guntamatic Binding</name>

</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.guntamatic-${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-guntamatic" description="Guntamatic Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.guntamatic/${project.version}</bundle>
</feature>
</features>
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* Copyright (c) 2010-2022 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.guntamatic.internal;

import java.util.Arrays;
import java.util.List;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.ThingTypeUID;

/**
* The {@link GuntamaticBindingConstants} class defines common constants, which are
* used across the whole binding.
*
* @author Weger Michael - Initial contribution
*/
@NonNullByDefault
public class GuntamaticBindingConstants {

public static final String BINDING_ID = "guntamatic";

// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_BIOSTAR = new ThingTypeUID(BINDING_ID, "biostar");
public static final ThingTypeUID THING_TYPE_POWERCHIP = new ThingTypeUID(BINDING_ID, "powerchip");
public static final ThingTypeUID THING_TYPE_POWERCORN = new ThingTypeUID(BINDING_ID, "powercorn");
public static final ThingTypeUID THING_TYPE_BIOCOM = new ThingTypeUID(BINDING_ID, "biocom");
public static final ThingTypeUID THING_TYPE_PRO = new ThingTypeUID(BINDING_ID, "pro");
public static final ThingTypeUID THING_TYPE_THERM = new ThingTypeUID(BINDING_ID, "therm");

// List of all Channel ids
public static final String CHANNEL_CONTROLBOILERAPPROVAL = "controlBoilerApproval";
public static final String CHANNEL_CONTROLPROGRAM = "controlProgram";
public static final String CHANNEL_CONTROLHEATCIRCPROGRAM0 = "controlHeatCircProgram0";
public static final String CHANNEL_CONTROLHEATCIRCPROGRAM1 = "controlHeatCircProgram1";
public static final String CHANNEL_CONTROLHEATCIRCPROGRAM2 = "controlHeatCircProgram2";
public static final String CHANNEL_CONTROLHEATCIRCPROGRAM3 = "controlHeatCircProgram3";
public static final String CHANNEL_CONTROLHEATCIRCPROGRAM4 = "controlHeatCircProgram4";
public static final String CHANNEL_CONTROLHEATCIRCPROGRAM5 = "controlHeatCircProgram5";
public static final String CHANNEL_CONTROLHEATCIRCPROGRAM6 = "controlHeatCircProgram6";
public static final String CHANNEL_CONTROLHEATCIRCPROGRAM7 = "controlHeatCircProgram7";
public static final String CHANNEL_CONTROLHEATCIRCPROGRAM8 = "controlHeatCircProgram8";
public static final String CHANNEL_CONTROLWWHEAT0 = "controlWwHeat0";
public static final String CHANNEL_CONTROLWWHEAT1 = "controlWwHeat1";
public static final String CHANNEL_CONTROLWWHEAT2 = "controlWwHeat2";
public static final String CHANNEL_CONTROLEXTRAWWHEAT0 = "controlExtraWwHeat0";
public static final String CHANNEL_CONTROLEXTRAWWHEAT1 = "controlExtraWwHeat1";
public static final String CHANNEL_CONTROLEXTRAWWHEAT2 = "controlExtraWwHeat2";

public static final List<String> CHANNELIDS = Arrays.asList(CHANNEL_CONTROLBOILERAPPROVAL, CHANNEL_CONTROLPROGRAM,
CHANNEL_CONTROLHEATCIRCPROGRAM0, CHANNEL_CONTROLHEATCIRCPROGRAM1, CHANNEL_CONTROLHEATCIRCPROGRAM2,
CHANNEL_CONTROLHEATCIRCPROGRAM3, CHANNEL_CONTROLHEATCIRCPROGRAM4, CHANNEL_CONTROLHEATCIRCPROGRAM5,
CHANNEL_CONTROLHEATCIRCPROGRAM6, CHANNEL_CONTROLHEATCIRCPROGRAM7, CHANNEL_CONTROLHEATCIRCPROGRAM8,
CHANNEL_CONTROLWWHEAT0, CHANNEL_CONTROLWWHEAT1, CHANNEL_CONTROLWWHEAT2, CHANNEL_CONTROLEXTRAWWHEAT0,
CHANNEL_CONTROLEXTRAWWHEAT1, CHANNEL_CONTROLEXTRAWWHEAT2);

public static final String PARAMETER_BOILERAPPROVAL = "boilerApproval";
public static final String PARAMETER_PROGRAM = "program";
public static final String PARAMETER_HEATCIRCPROGRAM = "heatCircProgram";
public static final String PARAMETER_WWHEAT = "wwHeat";
public static final String PARAMETER_EXTRAWWHEAT = "extraWwHeat";

public static final String DAQDATA_URL = "/daqdata.cgi";
public static final String DAQDESC_URL = "/daqdesc.cgi";
public static final String DAQEXTDESC_URL = "/ext/daqdesc.cgi";
public static final String PARSET_URL = "/ext/parset.cgi";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* Copyright (c) 2010-2022 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.guntamatic.internal;

import java.util.Collection;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.thing.type.ChannelType;
import org.openhab.core.thing.type.ChannelTypeBuilder;
import org.openhab.core.thing.type.ChannelTypeProvider;
import org.openhab.core.thing.type.ChannelTypeUID;
import org.openhab.core.thing.type.StateChannelTypeBuilder;
import org.openhab.core.types.StateDescriptionFragmentBuilder;
import org.osgi.service.component.annotations.Component;

/**
* Provide channelTypes for Guntamatic Heating Systems
*
* @author Weger Michael - Initial contribution
*/
@Component(service = { ChannelTypeProvider.class, GuntamaticChannelTypeProvider.class })
@NonNullByDefault
public class GuntamaticChannelTypeProvider implements ChannelTypeProvider {
private final Map<String, ChannelType> channelTypes = new ConcurrentHashMap<>();

@Override
public Collection<ChannelType> getChannelTypes(@Nullable Locale locale) {
return channelTypes.values();
}

@Override
public @Nullable ChannelType getChannelType(ChannelTypeUID channelTypeUID, @Nullable Locale locale) {
return channelTypes.get(channelTypeUID.getAsString()); // returns null if not found
}

public void addChannelType(ChannelTypeUID channelTypeUID, String label, String itemType, String description,
boolean advanced, String pattern) {
StateDescriptionFragmentBuilder stateDescriptionFragmentBuilder = StateDescriptionFragmentBuilder.create()
.withReadOnly(true);
if (!pattern.isEmpty()) {
stateDescriptionFragmentBuilder.withPattern(pattern);
}
StateChannelTypeBuilder stateChannelTypeBuilder = ChannelTypeBuilder.state(channelTypeUID, label, itemType)
.withDescription(description).isAdvanced(advanced)
.withStateDescriptionFragment(stateDescriptionFragmentBuilder.build());
channelTypes.put(channelTypeUID.getAsString(), stateChannelTypeBuilder.build());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright (c) 2010-2022 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.guntamatic.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;

/**
* The {@link GuntamaticConfiguration} class contains fields mapping thing configuration parameters.
*
* @author Weger Michael - Initial contribution
*/
@NonNullByDefault
public class GuntamaticConfiguration {

/**
* Configuration parameters
*/
public String hostname = "";
public String key = "";
public int refreshInterval = 60;
public String encoding = "windows-1252";
}
Loading

0 comments on commit 1d01254

Please sign in to comment.