]> git.basschouten.com Git - openhab-addons.git/blob
d6b71b2237105a3f34ad2aa57ed282099c25718f
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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.tellstick.internal;
14
15 import static org.openhab.core.library.unit.MetricPrefix.*;
16
17 import java.util.Collections;
18 import java.util.Set;
19 import java.util.stream.Collectors;
20 import java.util.stream.Stream;
21
22 import javax.measure.Unit;
23 import javax.measure.quantity.Angle;
24 import javax.measure.quantity.Dimensionless;
25 import javax.measure.quantity.ElectricCurrent;
26 import javax.measure.quantity.Illuminance;
27 import javax.measure.quantity.Length;
28 import javax.measure.quantity.Power;
29 import javax.measure.quantity.Pressure;
30 import javax.measure.quantity.Speed;
31 import javax.measure.quantity.Temperature;
32
33 import org.eclipse.jdt.annotation.NonNullByDefault;
34 import org.openhab.core.library.unit.SIUnits;
35 import org.openhab.core.library.unit.Units;
36 import org.openhab.core.thing.ThingTypeUID;
37
38 /**
39  * The {@link TellstickBinding} class defines common constants, which are
40  * used across the whole binding.
41  *
42  * @author jarlebh - Initial contribution
43  */
44 @NonNullByDefault
45 public class TellstickBindingConstants {
46
47     public static final String BINDING_ID = "tellstick";
48
49     public static final Unit<Dimensionless> HUMIDITY_UNIT = Units.PERCENT;
50     public static final Unit<Temperature> TEMPERATURE_UNIT = SIUnits.CELSIUS;
51     public static final Unit<Pressure> PRESSURE_UNIT = HECTO(SIUnits.PASCAL);
52     public static final Unit<Speed> WIND_SPEED_UNIT_MS = Units.METRE_PER_SECOND;
53     public static final Unit<Angle> WIND_DIRECTION_UNIT = Units.DEGREE_ANGLE;
54     public static final Unit<Length> RAIN_UNIT = MILLI(SIUnits.METRE);
55     public static final Unit<Illuminance> LUX_UNIT = Units.LUX;
56     public static final Unit<ElectricCurrent> ELECTRIC_UNIT = Units.AMPERE;
57     public static final Unit<Power> POWER_UNIT = KILO(Units.WATT);
58
59     public static final String CONFIGPATH_ID = "location";
60     public static final String DEVICE_ID = "deviceId";
61     public static final String DEVICE_PROTOCOL = "protocol";
62     public static final String DEVICE_MODEL = "model";
63     public static final String DEVICE_NAME = "name";
64     public static final String DEVICE_RESEND_COUNT = "repeat";
65     public static final String DEVICE_ISDIMMER = "dimmer";
66     public static final String BRIDGE_TELLDUS_CORE = "telldus-core";
67     public static final String BRIDGE_TELLDUS_LIVE = "telldus-live";
68     public static final String DEVICE_SENSOR = "sensor";
69     public static final String DEVICE_WINDSENSOR = "windsensor";
70     public static final String DEVICE_RAINSENSOR = "rainsensor";
71     public static final String DEVICE_POWERSENSOR = "powersensor";
72     public static final String DEVICE_DIMMER = "dimmer";
73     public static final String DEVICE_SWITCH = "switch";
74     // List of all Thing Type UIDs
75     public static final ThingTypeUID DIMMER_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_DIMMER);
76     public static final ThingTypeUID SWITCH_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_SWITCH);
77     public static final ThingTypeUID SENSOR_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_SENSOR);
78     public static final ThingTypeUID RAINSENSOR_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_RAINSENSOR);
79     public static final ThingTypeUID POWERSENSOR_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_POWERSENSOR);
80     public static final ThingTypeUID WINDSENSOR_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_WINDSENSOR);
81
82     public static final ThingTypeUID TELLDUSBRIDGE_THING_TYPE = new ThingTypeUID(BINDING_ID, BRIDGE_TELLDUS_CORE);
83     public static final ThingTypeUID TELLDUSCOREBRIDGE_THING_TYPE = new ThingTypeUID(BINDING_ID, BRIDGE_TELLDUS_CORE);
84     public static final ThingTypeUID TELLDUSLIVEBRIDGE_THING_TYPE = new ThingTypeUID(BINDING_ID, BRIDGE_TELLDUS_LIVE);
85     // List of all Channel ids
86     public static final String CHANNEL_DIMMER = "dimmer";
87     public static final String CHANNEL_STATE = "state";
88     public static final String CHANNEL_HUMIDITY = "humidity";
89     public static final String CHANNEL_TIMESTAMP = "timestamp";
90     public static final String CHANNEL_TEMPERATURE = "temperature";
91     public static final String CHANNEL_RAINTOTAL = "raintotal";
92     public static final String CHANNEL_RAINRATE = "rainrate";
93     public static final String CHANNEL_WINDAVERAGE = "windaverage";
94     public static final String CHANNEL_WINDDIRECTION = "winddirection";
95     public static final String CHANNEL_WINDGUST = "windgust";
96     public static final String CHANNEL_WATT = "watt";
97     public static final String CHANNEL_AMPERE = "ampere";
98     public static final String CHANNEL_LUX = "lux";
99
100     public static final Set<ThingTypeUID> SUPPORTED_BRIDGE_THING_TYPES_UIDS = Collections.unmodifiableSet(
101             Stream.of(TELLDUSCOREBRIDGE_THING_TYPE, TELLDUSLIVEBRIDGE_THING_TYPE).collect(Collectors.toSet()));
102     public static final Set<ThingTypeUID> SUPPORTED_DEVICE_THING_TYPES_UIDS = Collections
103             .unmodifiableSet(Stream.of(DIMMER_THING_TYPE, SWITCH_THING_TYPE, SENSOR_THING_TYPE, RAINSENSOR_THING_TYPE,
104                     WINDSENSOR_THING_TYPE, POWERSENSOR_THING_TYPE).collect(Collectors.toSet()));
105     public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.unmodifiableSet(Stream
106             .of(DIMMER_THING_TYPE, SWITCH_THING_TYPE, SENSOR_THING_TYPE, RAINSENSOR_THING_TYPE, WINDSENSOR_THING_TYPE,
107                     POWERSENSOR_THING_TYPE, TELLDUSCOREBRIDGE_THING_TYPE, TELLDUSLIVEBRIDGE_THING_TYPE)
108             .collect(Collectors.toSet()));
109 }