]> git.basschouten.com Git - openhab-addons.git/blob
33fa4def8a9e5b161c390c936d5c796d30e60bfc
[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  * @author Andrea Conte - Energy management
30  */
31
32 @NonNullByDefault
33 public class OpenWebNetBindingConstants {
34
35     public static final String BINDING_ID = "openwebnet";
36
37     public static final int THING_STATE_REQ_TIMEOUT_SEC = 5;
38
39     // #LIST OF Thing Type UIDs
40     // generic device (used for not identified devices)
41     public static final ThingTypeUID THING_TYPE_GENERIC_DEVICE = new ThingTypeUID(BINDING_ID, "generic_device");
42     public static final String THING_LABEL_GENERIC_DEVICE = "GENERIC Device";
43     // bridges
44     public static final ThingTypeUID THING_TYPE_ZB_GATEWAY = new ThingTypeUID(BINDING_ID, "zb_gateway");
45     public static final String THING_LABEL_ZB_GATEWAY = "ZigBee USB Gateway";
46     public static final ThingTypeUID THING_TYPE_BUS_GATEWAY = new ThingTypeUID(BINDING_ID, "bus_gateway");
47     public static final String THING_LABEL_BUS_GATEWAY = "BUS Gateway";
48     // other thing types
49     // BUS
50     public static final ThingTypeUID THING_TYPE_BUS_ON_OFF_SWITCH = new ThingTypeUID(BINDING_ID, "bus_on_off_switch");
51     public static final String THING_LABEL_BUS_ON_OFF_SWITCH = "Switch";
52     public static final ThingTypeUID THING_TYPE_BUS_DIMMER = new ThingTypeUID(BINDING_ID, "bus_dimmer");
53     public static final String THING_LABEL_BUS_DIMMER = "Dimmer";
54     public static final ThingTypeUID THING_TYPE_BUS_AUTOMATION = new ThingTypeUID(BINDING_ID, "bus_automation");
55     public static final String THING_LABEL_BUS_AUTOMATION = "Automation";
56     public static final ThingTypeUID THING_TYPE_BUS_ENERGY_METER = new ThingTypeUID(BINDING_ID, "bus_energy_meter");
57     public static final String THING_LABEL_BUS_ENERGY_METER = "Energy Meter";
58
59     // ZIGBEE
60     public static final ThingTypeUID THING_TYPE_ZB_ON_OFF_SWITCH = new ThingTypeUID(BINDING_ID, "zb_on_off_switch");
61     public static final String THING_LABEL_ZB_ON_OFF_SWITCH = "ZigBee Switch";
62     public static final ThingTypeUID THING_TYPE_ZB_ON_OFF_SWITCH_2UNITS = new ThingTypeUID(BINDING_ID,
63             "zb_on_off_switch2u");
64     public static final String THING_LABEL_ZB_ON_OFF_SWITCH_2UNITS = "ZigBee 2-units Switch";
65     public static final ThingTypeUID THING_TYPE_ZB_DIMMER = new ThingTypeUID(BINDING_ID, "zb_dimmer");
66     public static final String THING_LABEL_ZB_DIMMER = "ZigBee Dimmer";
67     public static final ThingTypeUID THING_TYPE_ZB_AUTOMATION = new ThingTypeUID(BINDING_ID, "zb_automation");
68     public static final String THING_LABEL_ZB_AUTOMATION = "ZigBee Automation";
69
70     // #SUPPORTED THINGS SETS
71     // ## Generic
72     public static final Set<ThingTypeUID> GENERIC_SUPPORTED_THING_TYPES = new HashSet<>(
73             Arrays.asList(THING_TYPE_GENERIC_DEVICE));
74     // ## Lighting
75     public static final Set<ThingTypeUID> LIGHTING_SUPPORTED_THING_TYPES = new HashSet<>(
76             Arrays.asList(THING_TYPE_ZB_ON_OFF_SWITCH, THING_TYPE_ZB_ON_OFF_SWITCH_2UNITS, THING_TYPE_ZB_DIMMER,
77                     THING_TYPE_BUS_ON_OFF_SWITCH, THING_TYPE_BUS_DIMMER));
78     // ## Automation
79     public static final Set<ThingTypeUID> AUTOMATION_SUPPORTED_THING_TYPES = new HashSet<>(
80             Arrays.asList(THING_TYPE_ZB_AUTOMATION, THING_TYPE_BUS_AUTOMATION));
81
82     // ## Energy Management
83     public static final Set<ThingTypeUID> ENERGY_MANAGEMENT_SUPPORTED_THING_TYPES = new HashSet<>(
84             Arrays.asList(THING_TYPE_BUS_ENERGY_METER));
85
86     // ## Groups
87     public static final Set<ThingTypeUID> DEVICE_SUPPORTED_THING_TYPES = Stream
88             .of(LIGHTING_SUPPORTED_THING_TYPES, AUTOMATION_SUPPORTED_THING_TYPES,
89                     ENERGY_MANAGEMENT_SUPPORTED_THING_TYPES, GENERIC_SUPPORTED_THING_TYPES)
90             .flatMap(Collection::stream).collect(Collectors.toCollection(HashSet::new));
91
92     public static final Set<ThingTypeUID> BRIDGE_SUPPORTED_THING_TYPES = new HashSet<>(
93             Arrays.asList(THING_TYPE_ZB_GATEWAY, THING_TYPE_BUS_GATEWAY));
94
95     public static final Set<ThingTypeUID> ALL_SUPPORTED_THING_TYPES = Stream
96             .of(DEVICE_SUPPORTED_THING_TYPES, BRIDGE_SUPPORTED_THING_TYPES).flatMap(Collection::stream)
97             .collect(Collectors.toCollection(HashSet::new));
98
99     // LIST OF ALL CHANNEL IDs
100     // lighting
101     public static final String CHANNEL_SWITCH = "switch";
102     public static final String CHANNEL_SWITCH_01 = "switch_01";
103     public static final String CHANNEL_SWITCH_02 = "switch_02";
104     public static final String CHANNEL_BRIGHTNESS = "brightness";
105
106     // automation
107     public static final String CHANNEL_SHUTTER = "shutter";
108
109     // energy management
110     public static final String CHANNEL_POWER = "power";
111
112     // devices config properties
113     public static final String CONFIG_PROPERTY_WHERE = "where";
114     public static final String CONFIG_PROPERTY_SHUTTER_RUN = "shutterRun";
115
116     // BUS gw config properties
117     public static final String CONFIG_PROPERTY_HOST = "host";
118     public static final String CONFIG_PROPERTY_SERIAL_PORT = "serialPort";
119
120     // properties
121     public static final String PROPERTY_OWNID = "ownId";
122     public static final String PROPERTY_ZIGBEEID = "zigbeeid";
123     public static final String PROPERTY_FIRMWARE_VERSION = "firmwareVersion";
124     public static final String PROPERTY_MODEL = "model";
125     public static final String PROPERTY_SERIAL_NO = "serialNumber";
126 }