-
-
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
Open
adr001db
wants to merge
99
commits into
openhab:main
Choose a base branch
from
adr001db:onecta
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+53,244
−0
Open
Changes from 50 commits
Commits
Show all changes
99 commits
Select commit
Hold shift + click to select a range
66ac399
[ONECTA] Creation of new binding connecting to Daikin Cloud Onecta.
adr001db 64b997d
[ONECTA] Minor refactoring initialization.
adr001db 22c0340
[ONECTA] Cleanup unused code.
adr001db 9db719c
[ONECTA] Add Unit test OnectaWaterTankHandlerTest
adr001db de49d3a
[ONECTA] Add Unit test OnectaIndoorUnitHandlerTest
adr001db b7a93d6
[ONECTA] Add Unit test OnectaGatewayHandlerTest
adr001db d061351
[ONECTA] Add Unit test OnectaDeviceHandlerTest
adr001db e1b7703
[ONECTA] Cleanup unused code
adr001db 1df8192
[ONECTA] Cleanup unused code
adr001db 694e865
[ONECTA] Logging typo
adr001db ad37574
[ONECTA] Refactoring remove statics
adr001db 687c4d8
[ONECTA] Add Unit test OnectaBridgeHandlerTest
adr001db ef8b756
[ONECTA] Add Unit test
adr001db b3fe39e
[ONECTA] Add Unit test and refactoring
adr001db 2bf3564
[ONECTA] Add Unit test
adr001db 0f38a51
[ONECTA] Add Unit test
adr001db a6f7b03
Update bundles/org.openhab.binding.onecta/pom.xml
adr001db b6a4c6a
[ONECTA] Some Pullrequest fixes
adr001db dc64430
Merge branch 'onecta' of https://github.com/adr001db/openhab-addons i…
adr001db 5a43b1b
Update bundles/org.openhab.binding.onecta/pom.xml
adr001db e4ebd4b
[ONECTA] Some Pullrequest fixes
adr001db 9016bbd
[ONECTA] Add Headers and @authors
adr001db 2f45947
[ONECTA] Run Spotless
adr001db 9700e4d
[ONECTA] Change Copyright Year
adr001db c2f6da2
[ONECTA] Code Analysis Tool
adr001db 8b38296
[ONECTA] Code Analysis Tool
adr001db 4da7fae
[ONECTA] Code Analysis Tool
adr001db 238b9dd
[ONECTA] Code Analysis Tool
adr001db a9be352
[ONECTA] Code Analysis Tool
adr001db 69cdbf8
Update bundles/org.openhab.binding.onecta/src/main/java/org/openhab/b…
adr001db 13b9512
Update bundles/org.openhab.binding.onecta/src/main/java/org/openhab/b…
adr001db 5e9a908
[ONECTA] Pullrequest comment
adr001db 08c87e4
Merge branch 'onecta' of https://github.com/adr001db/openhab-addons i…
adr001db 57fe3fb
[ONECTA] Run Spotless
adr001db 1bc0eb9
[ONECTA] Pullrequest remarks
adr001db a7773dd
[ONECTA] Pullrequest remarks
adr001db da4f9a6
[ONECTA] Pullrequest remarks
adr001db 7174b3c
Merge branch 'openhab:main' into onecta
adr001db 79d178e
[ONECTA] Pullrequest remarks
adr001db b7c2fcb
[ONECTA] Pullrequest remarks
adr001db 8c7265d
[ONECTA] Pullrequest remarks
adr001db 36001ea
[ONECTA] Pullrequest remarks
adr001db f186aad
[ONECTA] Pullrequest remarks
adr001db c4ae372
[ONECTA] Pullrequest remarks
adr001db 2551796
[ONECTA] Pullrequest remarks
adr001db 5b47e9b
Merge branch 'openhab:main' into onecta
adr001db ad07701
Update bundles/org.openhab.binding.onecta/pom.xml
adr001db 248ee51
[ONECTA] Get it building again
adr001db 9efe97d
[ONECTA] Add OAuth2 libs
adr001db c5e4fe0
[ONECTA] Add OAuth2 libs
adr001db 4af4303
Update bundles/org.openhab.binding.onecta/pom.xml
lsiepel 4bf9fe6
Merge branch 'openhab:main' into onecta
adr001db 4ed84dd
[ONECTA] Remover / from baseURL end
adr001db a7ec343
[ONECTA] Fix Unit tests
adr001db 34321b4
[ONECTA] Fix Unit tests
adr001db 2c83071
[ONECTA] Fix Build Errors
adr001db 17fc950
[ONECTA] Fix Build Errors
adr001db a56ab14
[ONECTA] Fix Build warnings
adr001db 03fbef7
[ONECTA] Refactor oauth signin
adr001db ab9fec0
[ONECTA] Pull request findings
adr001db 313de03
[ONECTA] Pull request findings
adr001db b366da4
[ONECTA] Pull request findings
adr001db 0865d42
[ONECTA] Pull request findings
adr001db 5477b86
[ONECTA] Pull request findings
adr001db 577e935
[ONECTA] Pull request findings
adr001db aa33740
[ONECTA] Pull request findings
adr001db 59f6cea
[ONECTA] Spotless run
adr001db aadc89f
[ONECTA] i18n translation inclusion
adr001db c96455b
[ONECTA] Fix UnitTests
adr001db 8b9a775
[ONECTA] Fix UnitTests
adr001db 5ce7cb7
[ONECTA] Refactor connectionClient
adr001db 8452800
[ONECTA] replace nullpointerExceptions by Optional.ofNullable
adr001db fb7a3fe
[ONECTA] fixes on replace nullpointerExceptions by Optional.ofNullable
adr001db e174a8e
[ONECTA] fix a bug, nullpointer
adr001db c9e8033
[ONECTA] remove authentication object. Is replaced by oAuth2
adr001db 8043ca9
[ONECTA] fixes pullrequest
adr001db 291dd80
[ONECTA] fixes pullrequest
adr001db d3da5fb
[ONECTA] fixes pullrequest
adr001db 83da079
[ONECTA] fixes pullrequest
adr001db bbedc07
[ONECTA] fixes pullrequest
adr001db 4531d1c
[ONECTA] fixes pullrequest
adr001db b755598
[ONECTA] fixes pullrequest
adr001db 1699fd4
[ONECTA] fixes pullrequest
adr001db ef24b93
[ONECTA] fixes pullrequest
adr001db 015c220
[ONECTA] spotless
adr001db 152343b
[ONECTA] solve pullrequest findings
adr001db 089ebbd
[ONECTA] solve pullrequest findings
adr001db 12d7f2b
[ONECTA] some improvements
adr001db 4efa70f
[ONECTA] some improvements
adr001db 4fa9600
[ONECTA] Pullrequest
adr001db f96c7a3
Merge branch 'openhab:main' into onecta
adr001db e395fa4
[ONECTA] Pullrequest findings
adr001db e22318f
[ONECTA] Pullrequest findings
adr001db 8346fc6
[ONECTA] Pullrequest findings
adr001db b89c61b
[ONECTA] Pullrequest findings
adr001db acb5955
[ONECTA] Pullrequest findings and documentation improvement
adr001db 67dd1d4
[ONECTA] Documentation improvement
adr001db 0b83ced
Merge branch 'openhab:main' into onecta
adr001db 4062aae
[ONECTA] Fix FanControl on watertank
adr001db File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.
Oops, something went wrong.
lsiepel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
lsiepel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
lsiepel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
lsiepel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
adr001db marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 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>4.3.0-SNAPSHOT</version> | ||
lsiepel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| </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> | ||
9 changes: 9 additions & 0 deletions
9
bundles/org.openhab.binding.onecta/src/main/feature/feature.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
54 changes: 54 additions & 0 deletions
54
...nding.onecta/src/main/java/org/openhab/binding/onecta/internal/OnectaBridgeConstants.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /** | ||
| * Copyright (c) 2010-2024 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; | ||
| 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-hotwatertank"; | ||
| public static final String DEVICE_TYPE_INDOORUNIT = "indoor-unit"; | ||
|
|
||
| // List of config parameters | ||
| public static final String CONFIG_PAR_PASSWORD = "password"; | ||
| public static final String CONFIG_PAR_USERID = "userId"; | ||
| 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); | ||
|
|
||
| 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; | ||
| } | ||
111 changes: 111 additions & 0 deletions
111
....onecta/src/main/java/org/openhab/binding/onecta/internal/OnectaBridgeHandlerFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| /** | ||
| * Copyright (c) 2010-2024 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.Hashtable; | ||
| 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.OnectaBridgeHandler; | ||
| import org.openhab.binding.onecta.internal.handler.OnectaDeviceHandler; | ||
| import org.openhab.binding.onecta.internal.handler.OnectaGatewayHandler; | ||
| import org.openhab.binding.onecta.internal.handler.OnectaIndoorUnitHandler; | ||
| import org.openhab.binding.onecta.internal.handler.OnectaWaterTankHandler; | ||
| import org.openhab.binding.onecta.internal.oauth2.auth.OAuthTokenRefresher; | ||
| import org.openhab.binding.onecta.internal.service.DeviceDiscoveryService; | ||
| import org.openhab.core.config.discovery.DiscoveryService; | ||
| 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 OnectaConfiguration onectaConfiguration = new OnectaConfiguration(); | ||
|
|
||
| @Activate | ||
| public OnectaBridgeHandlerFactory(@Reference HttpClientFactory httpClientFactory, | ||
| @Reference OAuthTokenRefresher openHabOAuthTokenRefresher) { | ||
| onectaConfiguration.setHttpClientFactory(httpClientFactory); | ||
| OnectaConfiguration.setOAuthTokenRefresher(openHabOAuthTokenRefresher); | ||
| } | ||
|
|
||
| @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); | ||
|
|
||
| DeviceDiscoveryService deviceDiscoveryService = new DeviceDiscoveryService(bridgeHandler); | ||
| bridgeHandler.setDiscovery(deviceDiscoveryService); | ||
|
|
||
| this.discoveryServiceRegs.put(thing.getUID(), bundleContext.registerService( | ||
| DiscoveryService.class.getName(), deviceDiscoveryService, new Hashtable<String, Object>())); | ||
|
|
||
| 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); | ||
| } | ||
| } |
69 changes: 69 additions & 0 deletions
69
...binding.onecta/src/main/java/org/openhab/binding/onecta/internal/OnectaConfiguration.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| /** | ||
| * Copyright (c) 2010-2024 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 org.eclipse.jdt.annotation.NonNullByDefault; | ||
| import org.eclipse.jdt.annotation.Nullable; | ||
| import org.eclipse.jetty.client.HttpClient; | ||
| 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 fields mapping thing configuration parameters. | ||
adr001db marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * | ||
| * @author Alexander Drent - Initial contribution | ||
| */ | ||
| @NonNullByDefault | ||
| public class OnectaConfiguration { | ||
|
|
||
| /** | ||
| * Sample configuration parameters. Replace with your own. | ||
| */ | ||
| private @Nullable static Thing bridgeThing = null; | ||
| private @Nullable static HttpClientFactory httpClientFactory = null; | ||
|
|
||
| private @Nullable static HttpClient httpClient = null; | ||
| private @Nullable static OAuthTokenRefresher openHabOAuthTokenRefresher = null; | ||
|
|
||
| public static void setHttpClientFactory(HttpClientFactory httpClientFactory) { | ||
| OnectaConfiguration.httpClientFactory = httpClientFactory; | ||
| httpClient = httpClientFactory.getCommonHttpClient(); | ||
| } | ||
|
|
||
| public static void setBridgeThing(Thing bridgeThing) { | ||
| OnectaConfiguration.bridgeThing = bridgeThing; | ||
| } | ||
|
|
||
| public static String getHost() { | ||
| return OnectaConfiguration.bridgeThing.getConfiguration().get(CHANNEL_OPENHAB_HOST).toString(); | ||
| }; | ||
|
|
||
| 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 @Nullable OAuthTokenRefresher getOAuthTokenRefresher() { | ||
| return openHabOAuthTokenRefresher; | ||
| } | ||
| } | ||
70 changes: 70 additions & 0 deletions
70
...nding.onecta/src/main/java/org/openhab/binding/onecta/internal/OnectaDeviceConstants.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /** | ||
| * Copyright (c) 2010-2024 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 OnectaDeviceConstants} class defines common constants, which are | ||
| * used across the whole binding. | ||
| * | ||
| * @author Alexander Drent - Initial contribution | ||
| */ | ||
| @NonNullByDefault | ||
| public class OnectaDeviceConstants { | ||
|
|
||
| // List of all Channel ids | ||
| public static final String CHANNEL_AC_TEMP = "basic#settemp"; | ||
adr001db marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| public static final String CHANNEL_AC_TEMPMIN = "basic#settempmin"; | ||
| public static final String CHANNEL_AC_TEMPMAX = "basic#settempmax"; | ||
| public static final String CHANNEL_AC_TEMPSTEP = "basic#settempstep"; | ||
| public static final String CHANNEL_AC_TARGETTEMP = "basic#targettemp"; | ||
| public static final String CHANNEL_AC_TARGETTEMPMIN = "basic#targettempmin"; | ||
| public static final String CHANNEL_AC_TARGETTEMPMAX = "basic#targettempmax"; | ||
| public static final String CHANNEL_AC_TARGETTEMPSTEP = "basic#targettempstep"; | ||
| public static final String CHANNEL_INDOOR_TEMP = "basic#indoortemp"; | ||
| public static final String CHANNEL_LEAVINGWATER_TEMP = "basic#leavingwatertemp"; | ||
| public static final String CHANNEL_OUTDOOR_TEMP = "basic#outdoortemp"; | ||
| 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#powerfulmode"; | ||
| public static final String CHANNEL_AC_RAWDATA = "extra#rawdata"; | ||
| public static final String CHANNEL_AC_OPERATIONMODE = "basic#operationmode"; | ||
| public static final String CHANNEL_AC_NAME = "basic#name"; | ||
| public static final String CHANNEL_AC_FANSPEED = "basic#fanspeed"; | ||
| public static final String CHANNEL_AC_FANMOVEMENT_HOR = "basic#fandirhor"; | ||
| public static final String CHANNEL_AC_FANMOVEMENT_VER = "basic#fandirver"; | ||
| public static final String CHANNEL_AC_FANMOVEMENT = "basic#fandir"; | ||
| public static final String CHANNEL_AC_ECONOMODE = "basic#economode"; | ||
| public static final String CHANNEL_AC_STREAMER = "basic#streamer"; | ||
| public static final String CHANNEL_AC_HOLIDAYMODE = "basic#holidaymode"; | ||
| public static final String CHANNEL_AC_SETPOINT_LEAVINGWATER_OFFSET = "basic#setleavingwateroffset"; | ||
| public static final String CHANNEL_AC_SETPOINT_LEAVINGWATER_TEMP = "basic#setleavingwatertemp"; | ||
| public static final String CHANNEL_AC_TIMESTAMP = "basic#timestamp"; | ||
| public static final String CHANNEL_AC_DEMANDCONTROL = "demandcontrol#demandcontrol"; | ||
| public static final String CHANNEL_AC_DEMANDCONTROLFIXEDVALUE = "demandcontrol#demandcontrolfixedvalue"; | ||
| public static final String CHANNEL_AC_DEMANDCONTROLFIXEDSTEPVALUE = "demandcontrol#demandcontrolfixedstepvalue"; | ||
| public static final String CHANNEL_AC_DEMANDCONTROLFIXEDMINVALUE = "demandcontrol#demandcontrolfixedminvalue"; | ||
| public static final String CHANNEL_AC_DEMANDCONTROLFIXEDMAXVALUE = "demandcontrol#demandcontrolfixedmaxvalue"; | ||
| public static final String CHANNEL_AC_ENERGY_COOLING_DAY = "consumption-data-cooling#energycoolingday-%s"; | ||
| public static final String CHANNEL_AC_ENERGY_COOLING_WEEK = "consumption-data-cooling#energycoolingweek-%s"; | ||
| public static final String CHANNEL_AC_ENERGY_COOLING_MONTH = "consumption-data-cooling#energycoolingmonth-%s"; | ||
| public static final String CHANNEL_AC_ENERGY_HEATING_DAY = "consumption-data-heating#energyheatingday-%s"; | ||
| public static final String CHANNEL_AC_ENERGY_HEATING_WEEK = "consumption-data-heating#energyheatingweek-%s"; | ||
| public static final String CHANNEL_AC_ENERGY_HEATING_MONTH = "consumption-data-heating#energyheatingmonth-%s"; | ||
| public static final String CHANNEL_AC_ENERGY_HEATING_CURRENT_DAY = "consumption-data-heating#energyheatingcurrentday"; | ||
| public static final String CHANNEL_AC_ENERGY_HEATING_CURRENT_YEAR = "consumption-data-heating#energyheatingcurrentyear"; | ||
| public static final String CHANNEL_AC_ENERGY_COOLING_CURRENT_DAY = "consumption-data-cooling#energycoolingcurrentday"; | ||
| public static final String CHANNEL_AC_ENERGY_COOLING_CURRENT_YEAR = "consumption-data-cooling#energycoolingcurrentyear"; | ||
| public static final String PROPERTY_AC_NAME = "name"; | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.