Skip to content

Commit

Permalink
[guntamatic] Add channel groups (#17901)
Browse files Browse the repository at this point in the history
* guntamatic indexed channels

Signed-off-by: Michael Weger <[email protected]>
  • Loading branch information
MikeTheTux authored Dec 20, 2024
1 parent fc9e564 commit 84021f0
Show file tree
Hide file tree
Showing 9 changed files with 1,296 additions and 936 deletions.
532 changes: 260 additions & 272 deletions bundles/org.openhab.binding.guntamatic/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -39,38 +39,42 @@ public class GuntamaticBindingConstants {
public static final ThingTypeUID THING_TYPE_THERM = new ThingTypeUID(BINDING_ID, "therm");
public static final ThingTypeUID THING_TYPE_GENERIC = new ThingTypeUID(BINDING_ID, "generic");

public static final String GROUP_CONTROL = "control#";

// 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 String CHANNEL_CONTROL_BOILERAPPROVAL = GROUP_CONTROL + "boiler-approval";
public static final String CHANNEL_CONTROL_PROGRAM = GROUP_CONTROL + "program";
public static final String CHANNEL_CONTROL_HEATCIRCPROGRAM0 = GROUP_CONTROL + "heat-circ-program-0";
public static final String CHANNEL_CONTROL_HEATCIRCPROGRAM1 = GROUP_CONTROL + "heat-circ-program-1";
public static final String CHANNEL_CONTROL_HEATCIRCPROGRAM2 = GROUP_CONTROL + "heat-circ-program-2";
public static final String CHANNEL_CONTROL_HEATCIRCPROGRAM3 = GROUP_CONTROL + "heat-circ-program-3";
public static final String CHANNEL_CONTROL_HEATCIRCPROGRAM4 = GROUP_CONTROL + "heat-circ-program-4";
public static final String CHANNEL_CONTROL_HEATCIRCPROGRAM5 = GROUP_CONTROL + "heat-circ-program-5";
public static final String CHANNEL_CONTROL_HEATCIRCPROGRAM6 = GROUP_CONTROL + "heat-circ-program-6";
public static final String CHANNEL_CONTROL_HEATCIRCPROGRAM7 = GROUP_CONTROL + "heat-circ-program-7";
public static final String CHANNEL_CONTROL_HEATCIRCPROGRAM8 = GROUP_CONTROL + "heat-circ-program-8";
public static final String CHANNEL_CONTROL_WWHEAT0 = GROUP_CONTROL + "ww-heat-0";
public static final String CHANNEL_CONTROL_WWHEAT1 = GROUP_CONTROL + "ww-heat-1";
public static final String CHANNEL_CONTROL_WWHEAT2 = GROUP_CONTROL + "ww-heat-2";
public static final String CHANNEL_CONTROL_EXTRAWWHEAT0 = GROUP_CONTROL + "extra-ww-heat-0";
public static final String CHANNEL_CONTROL_EXTRAWWHEAT1 = GROUP_CONTROL + "extra-ww-heat-1";
public static final String CHANNEL_CONTROL_EXTRAWWHEAT2 = GROUP_CONTROL + "extra-ww-heat-2";

public static final List<String> STATIC_CHANNEL_IDS = Arrays.asList(CHANNEL_CONTROL_BOILERAPPROVAL,
CHANNEL_CONTROL_PROGRAM, CHANNEL_CONTROL_HEATCIRCPROGRAM0, CHANNEL_CONTROL_HEATCIRCPROGRAM1,
CHANNEL_CONTROL_HEATCIRCPROGRAM2, CHANNEL_CONTROL_HEATCIRCPROGRAM3, CHANNEL_CONTROL_HEATCIRCPROGRAM4,
CHANNEL_CONTROL_HEATCIRCPROGRAM5, CHANNEL_CONTROL_HEATCIRCPROGRAM6, CHANNEL_CONTROL_HEATCIRCPROGRAM7,
CHANNEL_CONTROL_HEATCIRCPROGRAM8, CHANNEL_CONTROL_WWHEAT0, CHANNEL_CONTROL_WWHEAT1, CHANNEL_CONTROL_WWHEAT2,
CHANNEL_CONTROL_EXTRAWWHEAT0, CHANNEL_CONTROL_EXTRAWWHEAT1, CHANNEL_CONTROL_EXTRAWWHEAT2);

public static final List<String> STATIC_CHANNEL_IDS = 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 List<String> STATIC_CHANNEL_IDS_WOBOILERAPP = Arrays.asList(CHANNEL_CONTROL_PROGRAM,
CHANNEL_CONTROL_HEATCIRCPROGRAM0, CHANNEL_CONTROL_HEATCIRCPROGRAM1, CHANNEL_CONTROL_HEATCIRCPROGRAM2,
CHANNEL_CONTROL_HEATCIRCPROGRAM3, CHANNEL_CONTROL_HEATCIRCPROGRAM4, CHANNEL_CONTROL_HEATCIRCPROGRAM5,
CHANNEL_CONTROL_HEATCIRCPROGRAM6, CHANNEL_CONTROL_HEATCIRCPROGRAM7, CHANNEL_CONTROL_HEATCIRCPROGRAM8,
CHANNEL_CONTROL_WWHEAT0, CHANNEL_CONTROL_WWHEAT1, CHANNEL_CONTROL_WWHEAT2, CHANNEL_CONTROL_EXTRAWWHEAT0,
CHANNEL_CONTROL_EXTRAWWHEAT1, CHANNEL_CONTROL_EXTRAWWHEAT2);

public static final List<String> STATIC_CHANNEL_IDS_WOBOILERAPP = Arrays.asList(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 GROUP_STATUS = "status#";

public static final String PARAMETER_BOILERAPPROVAL = "boilerApproval";
public static final String PARAMETER_PROGRAM = "program";
Expand Down

This file was deleted.

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
*/
package org.openhab.binding.guntamatic.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.storage.StorageService;
import org.openhab.core.thing.ThingUID;
import org.openhab.core.thing.binding.AbstractStorageBasedTypeProvider;
import org.openhab.core.thing.type.ChannelType;
import org.openhab.core.thing.type.ChannelTypeProvider;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

/**
* The {@link GuntamaticDynamicTypeProvider} is an instance of a {@link AbstractStorageBasedTypeProvider} for the
* Guntamatic Binding
*
* @author Weger Michael - Initial contribution
*/
@Component(service = { GuntamaticDynamicTypeProvider.class, ChannelTypeProvider.class })
@NonNullByDefault
public class GuntamaticDynamicTypeProvider extends AbstractStorageBasedTypeProvider {

@Activate
public GuntamaticDynamicTypeProvider(@Reference StorageService storageService) {
super(storageService);
}

public void removeChannelTypesForThing(ThingUID uid) {
String thingUid = uid.getAsString() + ":";
getChannelTypes(null).stream().map(ChannelType::getUID).filter(c -> c.getAsString().startsWith(thingUid))
.forEach(this::removeChannelType);
}
}
Loading

0 comments on commit 84021f0

Please sign in to comment.