2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.plugwiseha.internal;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.core.thing.ThingTypeUID;
19 import org.openhab.core.thing.type.ChannelTypeUID;
22 * The {@link PlugwiseHABindingConstants} class defines common constants, which
23 * are used across the whole binding.
25 * @author Bas van Wetten - Initial contribution
26 * @author Leo Siepel - finish initial contribution
29 public class PlugwiseHABindingConstants {
31 public static final String BINDING_ID = "plugwiseha";
33 // List of PlugwiseHA services, related urls, information
35 public static final String PLUGWISEHA_API_URL = "http://%s";
36 public static final String PLUGWISEHA_API_APPLIANCES_URL = PLUGWISEHA_API_URL + "/core/appliances";
37 public static final String PLUGWISEHA_API_APPLIANCE_URL = PLUGWISEHA_API_URL + "/core/appliances;id=%s";
38 public static final String PLUGWISEHA_API_LOCATIONS_URL = PLUGWISEHA_API_URL + "/core/locations";
39 public static final String PLUGWISEHA_API_LOCATION_URL = PLUGWISEHA_API_URL + "/core/locations;id=%s";
42 public static final ThingTypeUID THING_TYPE_GATEWAY = new ThingTypeUID(BINDING_ID, "gateway");
44 // List of all Thing Type UIDs
45 public static final ThingTypeUID THING_TYPE_ZONE = new ThingTypeUID(BINDING_ID, "zone");
46 public static final ThingTypeUID THING_TYPE_APPLIANCE_VALVE = new ThingTypeUID(BINDING_ID, "appliance_valve");
47 public static final ThingTypeUID THING_TYPE_APPLIANCE_PUMP = new ThingTypeUID(BINDING_ID, "appliance_pump");
48 public static final ThingTypeUID THING_TYPE_APPLIANCE_THERMOSTAT = new ThingTypeUID(BINDING_ID,
49 "appliance_thermostat");
50 public static final ThingTypeUID THING_TYPE_APPLIANCE_BOILER = new ThingTypeUID(BINDING_ID, "appliance_boiler");
52 // List of channel Type UIDs
53 public static final ChannelTypeUID CHANNEL_TYPE_BATTERYLEVEL = new ChannelTypeUID("system:battery-level");
54 public static final ChannelTypeUID CHANNEL_TYPE_BATTERYLEVELLOW = new ChannelTypeUID("system:low-battery");
57 public static final Set<ThingTypeUID> SUPPORTED_INTERFACE_TYPES_UIDS_EMPTY = Set.of();
59 // List of all Gateway configuration properties
60 public static final String GATEWAY_CONFIG_HOST = "host";
61 public static final String GATEWAY_CONFIG_USERNAME = "username";
62 public static final String GATEWAY_CONFIG_SMILEID = "smileId";
63 public static final String GATEWAY_CONFIG_REFRESH = "refresh";
65 // List of all Zone configuration properties
66 public static final String ZONE_CONFIG_ID = "id";
67 public static final String ZONE_CONFIG_NAME = "zoneName";
69 // List of all Appliance configuration properties
70 public static final String APPLIANCE_CONFIG_ID = "id";
71 public static final String APPLIANCE_CONFIG_NAME = "applianceName";
72 public static final String APPLIANCE_CONFIG_LOWBATTERY = "lowBatteryPercentage";
74 // List of all Appliance properties
75 public static final String APPLIANCE_PROPERTY_DESCRIPTION = "description";
76 public static final String APPLIANCE_PROPERTY_TYPE = "type";
77 public static final String APPLIANCE_PROPERTY_FUNCTIONALITIES = "functionalities";
78 public static final String APPLIANCE_PROPERTY_ZB_TYPE = "zigbee type";
79 public static final String APPLIANCE_PROPERTY_ZB_REACHABLE = "zigbee reachable";
80 public static final String APPLIANCE_PROPERTY_ZB_POWERSOURCE = "zigboo power source";
82 // List of all Location properties
83 public static final String LOCATION_PROPERTY_DESCRIPTION = "description";
84 public static final String LOCATION_PROPERTY_TYPE = "type";
85 public static final String LOCATION_PROPERTY_FUNCTIONALITIES = "functionalities";
87 // List of all Channel IDs
88 public static final String ZONE_COOLING_CHANNEL = "coolingAllowed";
89 public static final String ZONE_SETPOINT_CHANNEL = "setpointTemperature";
90 public static final String ZONE_TEMPERATURE_CHANNEL = "temperature";
91 public static final String ZONE_PRESETSCENE_CHANNEL = "presetScene";
92 public static final String ZONE_PREHEAT_CHANNEL = "preHeat";
93 public static final String ZONE_REGULATION_CHANNEL = "regulationControl";
95 public static final String APPLIANCE_SETPOINT_CHANNEL = "setpointTemperature";
96 public static final String APPLIANCE_TEMPERATURE_CHANNEL = "temperature";
97 public static final String APPLIANCE_BATTERYLEVEL_CHANNEL = "batteryLevel";
98 public static final String APPLIANCE_BATTERYLEVELLOW_CHANNEL = "batteryLevelLow";
99 public static final String APPLIANCE_POWER_USAGE_CHANNEL = "powerUsage";
100 public static final String APPLIANCE_POWER_CHANNEL = "power";
101 public static final String APPLIANCE_LOCK_CHANNEL = "lock";
102 public static final String APPLIANCE_WATERPRESSURE_CHANNEL = "waterPressure";
103 public static final String APPLIANCE_DHWSTATE_CHANNEL = "dhwState";
104 public static final String APPLIANCE_CHSTATE_CHANNEL = "chState";
105 public static final String APPLIANCE_OFFSET_CHANNEL = "offsetTemperature";
106 public static final String APPLIANCE_VALVEPOSITION_CHANNEL = "valvePosition";
107 public static final String APPLIANCE_COOLINGSTATE_CHANNEL = "coolingState";
108 public static final String APPLIANCE_INTENDEDBOILERTEMP_CHANNEL = "intendedBoilerTemp";
109 public static final String APPLIANCE_FLAMESTATE_CHANNEL = "flameState";
110 public static final String APPLIANCE_INTENDEDHEATINGSTATE_CHANNEL = "intendedHeatingState";
111 public static final String APPLIANCE_MODULATIONLEVEL_CHANNEL = "modulationLevel";
112 public static final String APPLIANCE_OTAPPLICATIONFAULTCODE_CHANNEL = "otAppFaultCode";
113 public static final String APPLIANCE_DHWTEMPERATURE_CHANNEL = "dhwTemperature";
114 public static final String APPLIANCE_OTOEMFAULTCODE_CHANNEL = "otOEMFaultCode";
115 public static final String APPLIANCE_BOILERTEMPERATURE_CHANNEL = "boilerTemperature";
116 public static final String APPLIANCE_DHWSETPOINT_CHANNEL = "dhwSetpoint";
117 public static final String APPLIANCE_MAXBOILERTEMPERATURE_CHANNEL = "maxBoilerTemperature";
118 public static final String APPLIANCE_DHWCOMFORTMODE_CHANNEL = "dhwComfortMode";
119 public static final String APPLIANCE_RETURNWATERTEMPERATURE_CHANNEL = "returnWaterTemperature";
121 // List of all Appliance Types
122 public static final String APPLIANCE_TYPE_THERMOSTAT = "thermostat";
123 public static final String APPLIANCE_TYPE_GATEWAY = "gateway";
124 public static final String APPLIANCE_TYPE_CENTRALHEATINGPUMP = "central_heating_pump";
125 public static final String APPLIANCE_TYPE_OPENTHERMGATEWAY = "open_therm_gateway";
126 public static final String APPLIANCE_TYPE_ZONETHERMOSTAT = "zone_thermostat";
127 public static final String APPLIANCE_TYPE_HEATERCENTRAL = "heater_central";
128 public static final String APPLIANCE_TYPE_THERMOSTATICRADIATORVALUE = "thermostatic_radiator_valve";
130 // List of Plugwise Maesure Units
131 public static final String UNIT_CELSIUS = "C";
134 public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_ZONE,
135 THING_TYPE_APPLIANCE_VALVE, THING_TYPE_APPLIANCE_PUMP, THING_TYPE_APPLIANCE_BOILER);
137 // Appliance types known to binding
138 public static final Set<String> KNOWN_APPLIANCE_TYPES = Set.of(APPLIANCE_TYPE_THERMOSTAT, APPLIANCE_TYPE_GATEWAY,
139 APPLIANCE_TYPE_CENTRALHEATINGPUMP, APPLIANCE_TYPE_OPENTHERMGATEWAY, APPLIANCE_TYPE_ZONETHERMOSTAT,
140 APPLIANCE_TYPE_HEATERCENTRAL, APPLIANCE_TYPE_THERMOSTATICRADIATORVALUE);
142 public static final Set<String> SUPPORTED_APPLIANCE_TYPES = Set.of(APPLIANCE_TYPE_CENTRALHEATINGPUMP,
143 APPLIANCE_TYPE_THERMOSTATICRADIATORVALUE, APPLIANCE_TYPE_ZONETHERMOSTAT, APPLIANCE_TYPE_HEATERCENTRAL);
146 public static final Set<ThingTypeUID> SUPPORTED_BRIDGE_TYPES_UIDS = Set.of(THING_TYPE_GATEWAY);
149 public static String getApiUrl(String host) {
150 return String.format(PLUGWISEHA_API_URL, host);
153 public static String getAppliancesUrl(String host) {
154 return String.format(PLUGWISEHA_API_APPLIANCES_URL, host);
157 public static String getApplianceUrl(String host, String applianceId) {
158 return String.format(PLUGWISEHA_API_APPLIANCE_URL, host, applianceId);
161 public static String getLocationsUrl(String host) {
162 return String.format(PLUGWISEHA_API_LOCATIONS_URL, host);
165 public static String getLocationUrl(String host, String locationId) {
166 return String.format(PLUGWISEHA_API_LOCATION_URL, host, locationId);