]> git.basschouten.com Git - openhab-addons.git/blob
d52f7e4b08472ffbcf7e99e1fb1361d191b0e714
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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.openwebnet;
14
15 import java.util.Arrays;
16 import java.util.Collection;
17 import java.util.HashSet;
18 import java.util.Set;
19 import java.util.stream.Collectors;
20 import java.util.stream.Stream;
21
22 import org.eclipse.jdt.annotation.NonNullByDefault;
23 import org.openhab.core.thing.ThingTypeUID;
24
25 /**
26  * The {@link OpenWebNetBindingConstants} class defines common constants, which are used across the whole binding.
27  *
28  * @author Massimo Valla - Initial contribution
29  */
30
31 @NonNullByDefault
32 public class OpenWebNetBindingConstants {
33
34     public static final String BINDING_ID = "openwebnet";
35
36     public static final int THING_STATE_REQ_TIMEOUT_SEC = 5;
37
38     // #LIST OF Thing Type UIDs
39     // generic device (used for not identified devices)
40     public static final ThingTypeUID THING_TYPE_GENERIC_DEVICE = new ThingTypeUID(BINDING_ID, "generic_device");
41     public static final String THING_LABEL_GENERIC_DEVICE = "GENERIC Device";
42     // bridges
43     public static final ThingTypeUID THING_TYPE_ZB_GATEWAY = new ThingTypeUID(BINDING_ID, "zb_gateway");
44     public static final String THING_LABEL_ZB_GATEWAY = "ZigBee USB Gateway";
45     public static final ThingTypeUID THING_TYPE_BUS_GATEWAY = new ThingTypeUID(BINDING_ID, "bus_gateway");
46     public static final String THING_LABEL_BUS_GATEWAY = "BUS Gateway";
47     // other thing types
48     // BUS
49     public static final ThingTypeUID THING_TYPE_BUS_ON_OFF_SWITCH = new ThingTypeUID(BINDING_ID, "bus_on_off_switch");
50     public static final String THING_LABEL_BUS_ON_OFF_SWITCH = "Switch";
51     public static final ThingTypeUID THING_TYPE_BUS_DIMMER = new ThingTypeUID(BINDING_ID, "bus_dimmer");
52     public static final String THING_LABEL_BUS_DIMMER = "Dimmer";
53     public static final ThingTypeUID THING_TYPE_BUS_AUTOMATION = new ThingTypeUID(BINDING_ID, "bus_automation");
54     public static final String THING_LABEL_BUS_AUTOMATION = "Automation";
55
56     // ZIGBEE
57     public static final ThingTypeUID THING_TYPE_ZB_ON_OFF_SWITCH = new ThingTypeUID(BINDING_ID, "zb_on_off_switch");
58     public static final String THING_LABEL_ZB_ON_OFF_SWITCH = "ZigBee Switch";
59     public static final ThingTypeUID THING_TYPE_ZB_ON_OFF_SWITCH_2UNITS = new ThingTypeUID(BINDING_ID,
60             "zb_on_off_switch2u");
61     public static final String THING_LABEL_ZB_ON_OFF_SWITCH_2UNITS = "ZigBee 2-units Switch";
62     public static final ThingTypeUID THING_TYPE_ZB_DIMMER = new ThingTypeUID(BINDING_ID, "zb_dimmer");
63     public static final String THING_LABEL_ZB_DIMMER = "ZigBee Dimmer";
64     public static final ThingTypeUID THING_TYPE_ZB_AUTOMATION = new ThingTypeUID(BINDING_ID, "zb_automation");
65     public static final String THING_LABEL_ZB_AUTOMATION = "ZigBee Automation";
66
67     // #SUPPORTED THINGS SETS
68     // ## Generic
69     public static final Set<ThingTypeUID> GENERIC_SUPPORTED_THING_TYPES = new HashSet<>(
70             Arrays.asList(THING_TYPE_GENERIC_DEVICE));
71     // ## Lighting
72     public static final Set<ThingTypeUID> LIGHTING_SUPPORTED_THING_TYPES = new HashSet<>(
73             Arrays.asList(THING_TYPE_ZB_ON_OFF_SWITCH, THING_TYPE_ZB_ON_OFF_SWITCH_2UNITS, THING_TYPE_ZB_DIMMER,
74                     THING_TYPE_BUS_ON_OFF_SWITCH, THING_TYPE_BUS_DIMMER));
75     // ## Automation
76     public static final Set<ThingTypeUID> AUTOMATION_SUPPORTED_THING_TYPES = new HashSet<>(
77             Arrays.asList(THING_TYPE_ZB_AUTOMATION, THING_TYPE_BUS_AUTOMATION));
78
79     // ## Groups
80     public static final Set<ThingTypeUID> DEVICE_SUPPORTED_THING_TYPES = Stream
81             .of(LIGHTING_SUPPORTED_THING_TYPES, AUTOMATION_SUPPORTED_THING_TYPES, GENERIC_SUPPORTED_THING_TYPES)
82             .flatMap(Collection::stream).collect(Collectors.toCollection(HashSet::new));
83
84     public static final Set<ThingTypeUID> BRIDGE_SUPPORTED_THING_TYPES = new HashSet<>(
85             Arrays.asList(THING_TYPE_ZB_GATEWAY, THING_TYPE_BUS_GATEWAY));
86
87     public static final Set<ThingTypeUID> ALL_SUPPORTED_THING_TYPES = Stream
88             .of(DEVICE_SUPPORTED_THING_TYPES, BRIDGE_SUPPORTED_THING_TYPES).flatMap(Collection::stream)
89             .collect(Collectors.toCollection(HashSet::new));
90
91     // LIST OF ALL CHANNEL IDs
92     // lighting
93     public static final String CHANNEL_SWITCH = "switch";
94     public static final String CHANNEL_SWITCH_01 = "switch_01";
95     public static final String CHANNEL_SWITCH_02 = "switch_02";
96     public static final String CHANNEL_BRIGHTNESS = "brightness";
97     // automation
98     public static final String CHANNEL_SHUTTER = "shutter";
99
100     // devices config properties
101     public static final String CONFIG_PROPERTY_WHERE = "where";
102     public static final String CONFIG_PROPERTY_SHUTTER_RUN = "shutterRun";
103
104     // BUS gw config properties
105     public static final String CONFIG_PROPERTY_HOST = "host";
106     // properties
107     public static final String PROPERTY_OWNID = "ownId";
108     public static final String PROPERTY_ZIGBEEID = "zigbeeid";
109     public static final String PROPERTY_FIRMWARE_VERSION = "firmwareVersion";
110     public static final String PROPERTY_MODEL = "model";
111     public static final String PROPERTY_SERIAL_NO = "serialNumber";
112 }