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