-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[onecta] Initial contribution #16730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
66ac399
64b997d
22c0340
9db719c
de49d3a
b7a93d6
d061351
e1b7703
1df8192
694e865
ad37574
687c4d8
ef8b756
b3fe39e
2bf3564
0f38a51
a6f7b03
b6a4c6a
dc64430
5a43b1b
e4ebd4b
9016bbd
2f45947
9700e4d
c2f6da2
8b38296
4da7fae
238b9dd
a9be352
69cdbf8
13b9512
5e9a908
08c87e4
57fe3fb
1bc0eb9
a7773dd
da4f9a6
7174b3c
79d178e
b7c2fcb
8c7265d
36001ea
f186aad
c4ae372
2551796
5b47e9b
ad07701
248ee51
9efe97d
c5e4fe0
4af4303
4bf9fe6
4ed84dd
a7ec343
34321b4
2c83071
17fc950
a56ab14
03fbef7
ab9fec0
313de03
b366da4
0865d42
5477b86
577e935
aa33740
59f6cea
aadc89f
c96455b
8b9a775
5ce7cb7
8452800
fb7a3fe
e174a8e
c9e8033
8043ca9
291dd80
d3da5fb
83da079
bbedc07
4531d1c
b755598
1699fd4
ef24b93
015c220
152343b
089ebbd
12d7f2b
4efa70f
4fa9600
f96c7a3
e395fa4
e22318f
8346fc6
b89c61b
acb5955
67dd1d4
0b83ced
4062aae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| This content is produced and maintained by the openHAB project. | ||
|
|
||
| * Project home: https://www.openhab.org | ||
|
|
||
| == Declared Project Licenses | ||
|
|
||
| This program and the accompanying materials are made available under the terms | ||
| of the Eclipse Public License 2.0 which is available at | ||
| https://www.eclipse.org/legal/epl-2.0/. | ||
|
|
||
| == Source Code | ||
|
|
||
| https://github.com/openhab/openhab-addons | ||
|
|
||
| == Third-party Content | ||
|
|
||
| jackson | ||
| * License: Apache 2.0 License | ||
| * Project: https://github.com/FasterXML/jackson | ||
| * Source: https://github.com/FasterXML/jackson | ||
|
|
||
| gson | ||
| * License: Apache 2.0 License | ||
| * Project: https://github.com/google/gson | ||
| * Source: https://github.com/google/gson | ||
Large diffs are not rendered by default.
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you able to reduce the image size and keep the quality more or less similar? The other image is about same size and 40% of size. |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This image does not seem to add value, please remove. |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if this iamge adds value, it is just an ordinairy login screen you see everywhere. |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe reduce image dimensions and file size ? |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don;t think this image adds value. |
adr001db marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
|
||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <parent> | ||
| <groupId>org.openhab.addons.bundles</groupId> | ||
| <artifactId>org.openhab.addons.reactor.bundles</artifactId> | ||
| <version>5.1.0-SNAPSHOT</version> | ||
| </parent> | ||
|
|
||
| <artifactId>org.openhab.binding.onecta</artifactId> | ||
|
|
||
| <name>openHAB Add-ons :: Bundles :: Onecta Binding</name> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-annotations</artifactId> | ||
| <version>${jackson.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.google.code.gson</groupId> | ||
| <artifactId>gson</artifactId> | ||
| <version>${gson.version}</version> | ||
| </dependency> | ||
| </dependencies> | ||
| </project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <features name="org.openhab.binding.onecta-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"> | ||
| <repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository> | ||
|
|
||
| <feature name="openhab-binding-onecta" description="Onecta Binding" version="${project.version}"> | ||
| <feature>openhab-runtime-base</feature> | ||
| <bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.onecta/${project.version}</bundle> | ||
| </feature> | ||
| </features> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /* | ||
| * Copyright (c) 2010-2025 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.onecta.internal; | ||
|
|
||
| import java.util.Set; | ||
|
|
||
| import org.eclipse.jdt.annotation.NonNullByDefault; | ||
| import org.openhab.core.thing.ThingTypeUID; | ||
|
|
||
| /** | ||
| * The {@link OnectaBridgeConstants} class defines common constants, which are | ||
| * used across the whole binding. | ||
| * | ||
| * @author Alexander Drent - Initial contribution | ||
| */ | ||
| @NonNullByDefault | ||
| public class OnectaBridgeConstants { | ||
|
|
||
| private static final String BINDING_ID = "onecta"; | ||
| public static final String BRIDGE = "account"; | ||
| // List of all Device Types | ||
| public static final String DEVICE_TYPE_GATEWAY = "gateway"; | ||
| public static final String DEVICE_TYPE_CLIMATECONTROL = "climate-control"; | ||
| public static final String DEVICE_TYPE_WATERTANK = "domestic-hot-water-tank"; | ||
| public static final String DEVICE_TYPE_INDOORUNIT = "indoor-unit"; | ||
|
|
||
| // List of config parameters | ||
| public static final String CONFIG_PAR_REFRESHINTERVAL = "refreshInterval"; | ||
| public static final String CONFIG_PAR_UNITID = "unitID"; | ||
| public static final String CHANNEL_OPENHAB_HOST = "openhabHost"; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Channel or config? |
||
|
|
||
| // List of all Bridge Thing Type UIDs | ||
| public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, BRIDGE); | ||
|
|
||
| // List of all Thing Type UIDs | ||
| public static final ThingTypeUID THING_TYPE_CLIMATECONTROL = new ThingTypeUID(BINDING_ID, | ||
| DEVICE_TYPE_CLIMATECONTROL); | ||
| public static final ThingTypeUID THING_TYPE_GATEWAY = new ThingTypeUID(BINDING_ID, DEVICE_TYPE_GATEWAY); | ||
| public static final ThingTypeUID THING_TYPE_WATERTANK = new ThingTypeUID(BINDING_ID, DEVICE_TYPE_WATERTANK); | ||
| public static final ThingTypeUID THING_TYPE_INDOORUNIT = new ThingTypeUID(BINDING_ID, DEVICE_TYPE_INDOORUNIT); | ||
|
|
||
| // The supported thing types. | ||
| public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = Set.of(THING_TYPE_BRIDGE, THING_TYPE_CLIMATECONTROL, | ||
| THING_TYPE_WATERTANK, THING_TYPE_GATEWAY, THING_TYPE_INDOORUNIT); | ||
|
|
||
| public static final String THIRD_PARTY_ENDPOINTS_BASENAME = "https://idp.onecta.daikineurope.com/v1/oidc"; | ||
| public static final String OAUTH2_SERVICE_HANDLE = BINDING_ID + ":" + BRIDGE; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| /* | ||
| * Copyright (c) 2010-2025 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.onecta.internal; | ||
|
|
||
| import static org.openhab.binding.onecta.internal.OnectaBridgeConstants.*; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
| import java.util.Set; | ||
|
|
||
| import org.eclipse.jdt.annotation.NonNullByDefault; | ||
| import org.eclipse.jdt.annotation.Nullable; | ||
| import org.openhab.binding.onecta.internal.handler.*; | ||
| import org.openhab.binding.onecta.internal.oauth2.auth.OAuthTokenRefresher; | ||
| import org.openhab.core.io.net.http.HttpClientFactory; | ||
| import org.openhab.core.thing.Bridge; | ||
| import org.openhab.core.thing.Thing; | ||
| import org.openhab.core.thing.ThingTypeUID; | ||
| import org.openhab.core.thing.ThingUID; | ||
| import org.openhab.core.thing.binding.BaseThingHandlerFactory; | ||
| import org.openhab.core.thing.binding.ThingHandler; | ||
| import org.openhab.core.thing.binding.ThingHandlerFactory; | ||
| import org.osgi.framework.ServiceRegistration; | ||
| import org.osgi.service.component.annotations.Activate; | ||
| import org.osgi.service.component.annotations.Component; | ||
| import org.osgi.service.component.annotations.Reference; | ||
|
|
||
| /** | ||
| * The {@link OnectaBridgeHandlerFactory} is responsible for creating things and thing | ||
| * handlers. | ||
| * | ||
| * @author Alexander Drent - Initial contribution | ||
| */ | ||
| @NonNullByDefault | ||
| @Component(configurationPid = "binding.onecta", service = ThingHandlerFactory.class) | ||
| public class OnectaBridgeHandlerFactory extends BaseThingHandlerFactory { | ||
|
|
||
| private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_BRIDGE, | ||
| THING_TYPE_CLIMATECONTROL, THING_TYPE_GATEWAY, THING_TYPE_WATERTANK, THING_TYPE_INDOORUNIT); | ||
|
|
||
| private Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>(); | ||
| private final OnectaTranslationProvider translation; | ||
|
|
||
| @Activate | ||
| public OnectaBridgeHandlerFactory(@Reference HttpClientFactory httpClientFactory, | ||
| @Reference OAuthTokenRefresher openHabOAuthTokenRefresher, | ||
| @Reference OnectaTranslationProvider translation) { | ||
| this.translation = translation; | ||
| OnectaConfiguration.setTranslation(translation); | ||
| OnectaConfiguration.setHttpClientFactory(httpClientFactory); | ||
| OnectaConfiguration.setOAuthTokenRefresher(openHabOAuthTokenRefresher); | ||
| OnectaConfiguration.getOnectaConnectionClient().openConnecttion(); | ||
|
Comment on lines
+59
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not a fan of having these framework references added to some global class that can be accessed from about anywhere. A more common design that properly restricts access is to pass the connection stuff (httpclientfactory, tokenrefresher) to the bridgehandler. The bridgehandler should control the lifecycle and act as a bridge between the child handlers and the remote service. The translationprovider is a little bit different, but here it can also be passed to the thinghandlers constructors perfectly fine. |
||
| } | ||
|
|
||
| @Override | ||
| public boolean supportsThingType(ThingTypeUID thingTypeUID) { | ||
| return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID); | ||
| } | ||
|
|
||
| @Override | ||
| protected @Nullable ThingHandler createHandler(Thing thing) { | ||
| ThingTypeUID thingTypeUID = thing.getThingTypeUID(); | ||
|
|
||
| if (thingTypeUID.equals((THING_TYPE_BRIDGE))) { | ||
| OnectaBridgeHandler bridgeHandler = new OnectaBridgeHandler((Bridge) thing); | ||
| OnectaConfiguration.setBridgeThing((Bridge) thing); | ||
| return bridgeHandler; | ||
| } else if (thingTypeUID.equals(THING_TYPE_CLIMATECONTROL)) { | ||
| return new OnectaDeviceHandler(thing); | ||
| } else if (thingTypeUID.equals((THING_TYPE_GATEWAY))) { | ||
| return new OnectaGatewayHandler(thing); | ||
| } else if (thingTypeUID.equals((THING_TYPE_WATERTANK))) { | ||
| return new OnectaWaterTankHandler(thing); | ||
| } else if (thingTypeUID.equals((THING_TYPE_INDOORUNIT))) { | ||
| return new OnectaIndoorUnitHandler(thing); | ||
| } | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| protected void removeHandler(ThingHandler handler) { | ||
| if (handler.getThing().getThingTypeUID().equals(THING_TYPE_BRIDGE)) { | ||
| ServiceRegistration<?> serviceReg = this.discoveryServiceRegs.get(handler.getThing().getUID()); | ||
| if (serviceReg != null) { | ||
| serviceReg.unregister(); | ||
| discoveryServiceRegs.remove(handler.getThing().getUID()); | ||
| } | ||
| } | ||
| super.removeHandler(handler); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,70 @@ | ||||||
| /* | ||||||
| * Copyright (c) 2010-2025 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.onecta.internal; | ||||||
|
|
||||||
| import org.eclipse.jdt.annotation.NonNullByDefault; | ||||||
|
|
||||||
| /** | ||||||
| * The {@link OnectaClimateControlConstants} class defines common constants, which are | ||||||
| * used across the whole binding. | ||||||
| * | ||||||
| * @author Alexander Drent - Initial contribution | ||||||
| */ | ||||||
| @NonNullByDefault | ||||||
| public class OnectaClimateControlConstants { | ||||||
|
|
||||||
| // List of all Channel ids | ||||||
| public static final String CHANNEL_AC_TEMP = "basic#settemp"; | ||||||
| public static final String CHANNEL_AC_TEMPMIN = "basic#settemp-min"; | ||||||
| public static final String CHANNEL_AC_TEMPMAX = "basic#settemp-max"; | ||||||
| public static final String CHANNEL_AC_TEMPSTEP = "basic#settemp-step"; | ||||||
|
Comment on lines
+28
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can be left as is, but i want to mention that setpoint (e.g. |
||||||
| public static final String CHANNEL_AC_TARGETTEMP = "basic#target-temp"; | ||||||
| public static final String CHANNEL_AC_TARGETTEMPMIN = "basic#target-temp-min"; | ||||||
| public static final String CHANNEL_AC_TARGETTEMPMAX = "basic#target-temp-max"; | ||||||
| public static final String CHANNEL_AC_TARGETTEMPSTEP = "basic#target-temp-step"; | ||||||
|
Comment on lines
+32
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this distinctive to the |
||||||
| public static final String CHANNEL_INDOOR_TEMP = "basic#indoor-temp"; | ||||||
| public static final String CHANNEL_LEAVINGWATER_TEMP = "basic#leaving-water-temp"; | ||||||
| public static final String CHANNEL_OUTDOOR_TEMP = "basic#outdoor-temp"; | ||||||
| public static final String CHANNEL_INDOOR_HUMIDITY = "basic#humidity"; | ||||||
| public static final String CHANNEL_AC_POWER = "basic#power"; | ||||||
| public static final String CHANNEL_AC_POWERFULMODE = "basic#powerful-mode"; | ||||||
| public static final String CHANNEL_AC_RAWDATA = "extra#rawdata"; | ||||||
| public static final String CHANNEL_AC_OPERATIONMODE = "basic#operation-mode"; | ||||||
| public static final String CHANNEL_AC_NAME = "basic#name"; | ||||||
| public static final String CHANNEL_AC_FANSPEED = "basic#fan-speed"; | ||||||
| public static final String CHANNEL_AC_FANMOVEMENT_HOR = "basic#fan-dir-hor"; | ||||||
| public static final String CHANNEL_AC_FANMOVEMENT_VER = "basic#fan-dir-ver"; | ||||||
| public static final String CHANNEL_AC_FANMOVEMENT = "basic#fan-dir"; | ||||||
| public static final String CHANNEL_AC_ECONOMODE = "basic#econo-mode"; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A mroe commonly used id:
Suggested change
|
||||||
| public static final String CHANNEL_AC_STREAMER = "basic#streamer"; | ||||||
| public static final String CHANNEL_AC_HOLIDAYMODE = "basic#holiday-mode"; | ||||||
| public static final String CHANNEL_AC_SETPOINT_LEAVINGWATER_OFFSET = "basic#set-leaving-water-offset"; | ||||||
| public static final String CHANNEL_AC_SETPOINT_LEAVINGWATER_TEMP = "basic#set-leaving-water-temp"; | ||||||
| public static final String CHANNEL_AC_TIMESTAMP = "basic#timestamp"; | ||||||
| public static final String CHANNEL_AC_DEMANDCONTROL = "demandcontrol#demand-control"; | ||||||
| public static final String CHANNEL_AC_DEMANDCONTROLFIXEDVALUE = "demandcontrol#demand-control-fixed-value"; | ||||||
| public static final String CHANNEL_AC_DEMANDCONTROLFIXEDSTEPVALUE = "demandcontrol#demand-control-fixed-step-value"; | ||||||
| public static final String CHANNEL_AC_DEMANDCONTROLFIXEDMINVALUE = "demandcontrol#demand-control-fixed-min-value"; | ||||||
| public static final String CHANNEL_AC_DEMANDCONTROLFIXEDMAXVALUE = "demandcontrol#demand-control-fixed-max-value"; | ||||||
| public static final String CHANNEL_AC_ENERGY_COOLING_DAY = "consumption-data-cooling#energy-cooling-day-%s"; | ||||||
| public static final String CHANNEL_AC_ENERGY_COOLING_WEEK = "consumption-data-cooling#energy-cooling-week-%s"; | ||||||
| public static final String CHANNEL_AC_ENERGY_COOLING_MONTH = "consumption-data-cooling#energy-cooling-month-%s"; | ||||||
| public static final String CHANNEL_AC_ENERGY_HEATING_DAY = "consumption-data-heating#energy-heating-day-%s"; | ||||||
| public static final String CHANNEL_AC_ENERGY_HEATING_WEEK = "consumption-data-heating#energy-heating-week-%s"; | ||||||
| public static final String CHANNEL_AC_ENERGY_HEATING_MONTH = "consumption-data-heating#energy-heating-month-%s"; | ||||||
| public static final String CHANNEL_AC_ENERGY_HEATING_CURRENT_DAY = "consumption-data-heating#energy-heating-current-day"; | ||||||
| public static final String CHANNEL_AC_ENERGY_HEATING_CURRENT_YEAR = "consumption-data-heating#energy-heating-current-year"; | ||||||
| public static final String CHANNEL_AC_ENERGY_COOLING_CURRENT_DAY = "consumption-data-cooling#energy-cooling-current-day"; | ||||||
| public static final String CHANNEL_AC_ENERGY_COOLING_CURRENT_YEAR = "consumption-data-cooling#energy-cooling-current-year"; | ||||||
| public static final String PROPERTY_AC_NAME = "name"; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not a channel id. better fit in the binding constants? |
||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| /* | ||
| * Copyright (c) 2010-2025 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.onecta.internal; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| import org.eclipse.jdt.annotation.NonNull; | ||
| import org.eclipse.jdt.annotation.NonNullByDefault; | ||
| import org.eclipse.jdt.annotation.Nullable; | ||
| import org.eclipse.jetty.client.HttpClient; | ||
| import org.openhab.binding.onecta.internal.api.OnectaConnectionClient; | ||
| import org.openhab.binding.onecta.internal.oauth2.auth.OAuthTokenRefresher; | ||
| import org.openhab.core.io.net.http.HttpClientFactory; | ||
| import org.openhab.core.thing.Thing; | ||
|
|
||
| /** | ||
| * The {@link OnectaConfiguration} class contains global static variables, which are used across the whole binding. | ||
| * | ||
| * @author Alexander Drent - Initial contribution | ||
| */ | ||
| @NonNullByDefault | ||
| public class OnectaConfiguration { | ||
|
|
||
| private @Nullable static Thing bridgeThing = null; | ||
| private @Nullable static HttpClientFactory httpClientFactory = null; | ||
|
|
||
| private @Nullable static HttpClient httpClient = null; | ||
| private @Nullable static OAuthTokenRefresher openHabOAuthTokenRefresher = null; | ||
|
|
||
| private @NonNull static OnectaConnectionClient onectaConnectionClient = new OnectaConnectionClient(); | ||
| private @Nullable static OnectaTranslationProvider translation; | ||
|
|
||
| public static void setTranslation(OnectaTranslationProvider translationPar) { | ||
| translation = translationPar; | ||
| } | ||
|
|
||
| public static OnectaTranslationProvider getTranslation() { | ||
| Optional<OnectaTranslationProvider> optionalTranslation = Optional.ofNullable(translation); | ||
| return optionalTranslation.orElseThrow(() -> new RuntimeException("Translation provider is not available")); | ||
| } | ||
|
|
||
| public static void setHttpClientFactory(HttpClientFactory httpClientFactory) { | ||
| OnectaConfiguration.httpClientFactory = httpClientFactory; | ||
| httpClient = httpClientFactory.getCommonHttpClient(); | ||
| } | ||
|
|
||
| public static void setBridgeThing(Thing bridgeThing) { | ||
| OnectaConfiguration.bridgeThing = bridgeThing; | ||
| } | ||
|
|
||
| public static @Nullable HttpClient getHttpClient() { | ||
| return httpClient; | ||
| } | ||
|
|
||
| public static @Nullable HttpClientFactory getHttpClientFactory() { | ||
| return httpClientFactory; | ||
| } | ||
|
|
||
| public static void setOAuthTokenRefresher(OAuthTokenRefresher openHabOAuthTokenRefresher) { | ||
| OnectaConfiguration.openHabOAuthTokenRefresher = openHabOAuthTokenRefresher; | ||
| } | ||
|
|
||
| public static OnectaConnectionClient getOnectaConnectionClient() { | ||
| return onectaConnectionClient; | ||
| } | ||
|
|
||
| public static @Nullable OAuthTokenRefresher getOAuthTokenRefresher() { | ||
| return openHabOAuthTokenRefresher; | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.