]> git.basschouten.com Git - openhab-addons.git/blob
626479982a04d52ddfd69c188a9a9e27e4e68b7c
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.homematic.test.util;
14
15 import org.openhab.binding.homematic.internal.model.HmChannel;
16 import org.openhab.binding.homematic.internal.model.HmDatapoint;
17 import org.openhab.binding.homematic.internal.model.HmDevice;
18 import org.openhab.core.thing.Thing;
19 import org.openhab.core.thing.ThingTypeUID;
20 import org.openhab.core.thing.ThingUID;
21 import org.openhab.core.thing.binding.builder.ThingBuilder;
22
23 /**
24  * Class that contains static helper methods to create several kinds of objects
25  * (e.g. {@link ThingUID}, {@link HmDevice}, {@link HmDatapoint}) related to a
26  * homematic dimmer.
27  * 
28  * @author Florian Stolte - Initial Contribution
29  * 
30  */
31 public class DimmerHelper {
32
33     public static HmDevice createDimmerHmDevice() {
34         return createDimmerHmDevice("CCU2");
35     }
36
37     public static HmDevice createDimmerHmDevice(String gatewayType) {
38         HmDevice hmDevice = new HmDevice("ABC12345678", null, "HM-LC-Dim1-Pl3", gatewayType, "", "1");
39         hmDevice.setName("Homematic Dimmer");
40         return hmDevice;
41     }
42
43     public static HmChannel createDimmerHmChannel() {
44         HmChannel hmChannel = new HmChannel("HM-LC-Dim1-Pl3", 1);
45         hmChannel.setDevice(createDimmerHmDevice());
46
47         return hmChannel;
48     }
49
50     public static HmChannel createDimmerDummyChannel() {
51         HmChannel hmChannel = new HmChannel("HM-LC-Dim1-Pl3", -1);
52         hmChannel.setDevice(createDimmerHmDevice());
53
54         return hmChannel;
55     }
56
57     public static HmDatapoint createDimmerHmDatapoint() {
58         HmDatapoint hmDatapoint = new HmDatapoint();
59         hmDatapoint.setName("DIMMER");
60         hmDatapoint.setChannel(createDimmerHmChannel());
61
62         return hmDatapoint;
63     }
64
65     public static ThingTypeUID createDimmerThingTypeUID() {
66         return new ThingTypeUID("homematic:HM-LC-Dim1-Pl3");
67     }
68
69     public static ThingUID createDimmerThingUID() {
70         return new ThingUID(createDimmerThingTypeUID(), "ABC12345678");
71     }
72
73     public static Thing createDimmerThing() {
74         return ThingBuilder.create(createDimmerThingTypeUID(), createDimmerThingUID()).build();
75     }
76 }