Skip to content
Open
Show file tree
Hide file tree
Changes from 79 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 May 13, 2024
64b997d
[ONECTA] Minor refactoring initialization.
adr001db May 13, 2024
22c0340
[ONECTA] Cleanup unused code.
adr001db May 13, 2024
9db719c
[ONECTA] Add Unit test OnectaWaterTankHandlerTest
adr001db May 13, 2024
de49d3a
[ONECTA] Add Unit test OnectaIndoorUnitHandlerTest
adr001db May 13, 2024
b7a93d6
[ONECTA] Add Unit test OnectaGatewayHandlerTest
adr001db May 13, 2024
d061351
[ONECTA] Add Unit test OnectaDeviceHandlerTest
adr001db May 13, 2024
e1b7703
[ONECTA] Cleanup unused code
adr001db May 13, 2024
1df8192
[ONECTA] Cleanup unused code
adr001db May 13, 2024
694e865
[ONECTA] Logging typo
adr001db May 13, 2024
ad37574
[ONECTA] Refactoring remove statics
adr001db May 13, 2024
687c4d8
[ONECTA] Add Unit test OnectaBridgeHandlerTest
adr001db May 13, 2024
ef8b756
[ONECTA] Add Unit test
adr001db May 13, 2024
b3fe39e
[ONECTA] Add Unit test and refactoring
adr001db May 13, 2024
2bf3564
[ONECTA] Add Unit test
adr001db May 13, 2024
0f38a51
[ONECTA] Add Unit test
adr001db May 13, 2024
a6f7b03
Update bundles/org.openhab.binding.onecta/pom.xml
adr001db May 13, 2024
b6a4c6a
[ONECTA] Some Pullrequest fixes
adr001db May 13, 2024
dc64430
Merge branch 'onecta' of https://github.com/adr001db/openhab-addons i…
adr001db May 13, 2024
5a43b1b
Update bundles/org.openhab.binding.onecta/pom.xml
adr001db May 13, 2024
e4ebd4b
[ONECTA] Some Pullrequest fixes
adr001db May 13, 2024
9016bbd
[ONECTA] Add Headers and @authors
adr001db May 13, 2024
2f45947
[ONECTA] Run Spotless
adr001db May 13, 2024
9700e4d
[ONECTA] Change Copyright Year
adr001db May 13, 2024
c2f6da2
[ONECTA] Code Analysis Tool
adr001db May 13, 2024
8b38296
[ONECTA] Code Analysis Tool
adr001db May 13, 2024
4da7fae
[ONECTA] Code Analysis Tool
adr001db May 13, 2024
238b9dd
[ONECTA] Code Analysis Tool
adr001db May 13, 2024
a9be352
[ONECTA] Code Analysis Tool
adr001db May 13, 2024
69cdbf8
Update bundles/org.openhab.binding.onecta/src/main/java/org/openhab/b…
adr001db May 13, 2024
13b9512
Update bundles/org.openhab.binding.onecta/src/main/java/org/openhab/b…
adr001db May 13, 2024
5e9a908
[ONECTA] Pullrequest comment
adr001db May 13, 2024
08c87e4
Merge branch 'onecta' of https://github.com/adr001db/openhab-addons i…
adr001db May 13, 2024
57fe3fb
[ONECTA] Run Spotless
adr001db May 14, 2024
1bc0eb9
[ONECTA] Pullrequest remarks
adr001db May 19, 2024
a7773dd
[ONECTA] Pullrequest remarks
adr001db May 19, 2024
da4f9a6
[ONECTA] Pullrequest remarks
adr001db May 21, 2024
7174b3c
Merge branch 'openhab:main' into onecta
adr001db May 22, 2024
79d178e
[ONECTA] Pullrequest remarks
adr001db May 23, 2024
b7c2fcb
[ONECTA] Pullrequest remarks
adr001db May 23, 2024
8c7265d
[ONECTA] Pullrequest remarks
adr001db May 23, 2024
36001ea
[ONECTA] Pullrequest remarks
adr001db May 23, 2024
f186aad
[ONECTA] Pullrequest remarks
adr001db May 23, 2024
c4ae372
[ONECTA] Pullrequest remarks
adr001db May 24, 2024
2551796
[ONECTA] Pullrequest remarks
adr001db Jun 22, 2024
5b47e9b
Merge branch 'openhab:main' into onecta
adr001db Jul 23, 2024
ad07701
Update bundles/org.openhab.binding.onecta/pom.xml
adr001db Jul 23, 2024
248ee51
[ONECTA] Get it building again
adr001db Jul 23, 2024
9efe97d
[ONECTA] Add OAuth2 libs
adr001db Jul 26, 2024
c5e4fe0
[ONECTA] Add OAuth2 libs
adr001db Sep 25, 2024
4af4303
Update bundles/org.openhab.binding.onecta/pom.xml
lsiepel Feb 21, 2025
4bf9fe6
Merge branch 'openhab:main' into onecta
adr001db Mar 30, 2025
4ed84dd
[ONECTA] Remover / from baseURL end
adr001db Apr 23, 2025
a7ec343
[ONECTA] Fix Unit tests
adr001db Apr 23, 2025
34321b4
[ONECTA] Fix Unit tests
adr001db Apr 23, 2025
2c83071
[ONECTA] Fix Build Errors
adr001db Apr 25, 2025
17fc950
[ONECTA] Fix Build Errors
adr001db Apr 25, 2025
a56ab14
[ONECTA] Fix Build warnings
adr001db Apr 25, 2025
03fbef7
[ONECTA] Refactor oauth signin
adr001db May 7, 2025
ab9fec0
[ONECTA] Pull request findings
adr001db May 7, 2025
313de03
[ONECTA] Pull request findings
adr001db May 8, 2025
b366da4
[ONECTA] Pull request findings
adr001db May 8, 2025
0865d42
[ONECTA] Pull request findings
adr001db May 8, 2025
5477b86
[ONECTA] Pull request findings
adr001db May 8, 2025
577e935
[ONECTA] Pull request findings
adr001db May 8, 2025
aa33740
[ONECTA] Pull request findings
adr001db May 9, 2025
59f6cea
[ONECTA] Spotless run
adr001db May 9, 2025
aadc89f
[ONECTA] i18n translation inclusion
adr001db May 10, 2025
c96455b
[ONECTA] Fix UnitTests
adr001db May 10, 2025
8b9a775
[ONECTA] Fix UnitTests
adr001db May 10, 2025
5ce7cb7
[ONECTA] Refactor connectionClient
adr001db May 10, 2025
8452800
[ONECTA] replace nullpointerExceptions by Optional.ofNullable
adr001db May 18, 2025
fb7a3fe
[ONECTA] fixes on replace nullpointerExceptions by Optional.ofNullable
adr001db May 18, 2025
e174a8e
[ONECTA] fix a bug, nullpointer
adr001db May 24, 2025
c9e8033
[ONECTA] remove authentication object. Is replaced by oAuth2
adr001db May 24, 2025
8043ca9
[ONECTA] fixes pullrequest
adr001db May 25, 2025
291dd80
[ONECTA] fixes pullrequest
adr001db May 25, 2025
d3da5fb
[ONECTA] fixes pullrequest
adr001db Jun 1, 2025
83da079
[ONECTA] fixes pullrequest
adr001db Jun 1, 2025
bbedc07
[ONECTA] fixes pullrequest
adr001db Jun 8, 2025
4531d1c
[ONECTA] fixes pullrequest
adr001db Jun 9, 2025
b755598
[ONECTA] fixes pullrequest
adr001db Jun 9, 2025
1699fd4
[ONECTA] fixes pullrequest
adr001db Jun 22, 2025
ef24b93
[ONECTA] fixes pullrequest
adr001db Jun 22, 2025
015c220
[ONECTA] spotless
adr001db Jun 22, 2025
152343b
[ONECTA] solve pullrequest findings
adr001db Jun 22, 2025
089ebbd
[ONECTA] solve pullrequest findings
adr001db Jun 22, 2025
12d7f2b
[ONECTA] some improvements
adr001db Jun 29, 2025
4efa70f
[ONECTA] some improvements
adr001db Jun 30, 2025
4fa9600
[ONECTA] Pullrequest
adr001db Jul 20, 2025
f96c7a3
Merge branch 'openhab:main' into onecta
adr001db Jul 25, 2025
e395fa4
[ONECTA] Pullrequest findings
adr001db Jul 27, 2025
e22318f
[ONECTA] Pullrequest findings
adr001db Jul 27, 2025
8346fc6
[ONECTA] Pullrequest findings
adr001db Jul 27, 2025
b89c61b
[ONECTA] Pullrequest findings
adr001db Jul 27, 2025
acb5955
[ONECTA] Pullrequest findings and documentation improvement
adr001db Aug 23, 2025
67dd1d4
[ONECTA] Documentation improvement
adr001db Aug 23, 2025
0b83ced
Merge branch 'openhab:main' into onecta
adr001db Oct 7, 2025
4062aae
[ONECTA] Fix FanControl on watertank
adr001db Oct 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,11 @@
<artifactId>org.openhab.binding.onewiregpio</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.onecta</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.onkyo</artifactId>
Expand Down
25 changes: 25 additions & 0 deletions bundles/org.openhab.binding.onecta/NOTICE
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
319 changes: 319 additions & 0 deletions bundles/org.openhab.binding.onecta/README.md

Large diffs are not rendered by default.

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.
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.
Binary file added bundles/org.openhab.binding.onecta/doc/daikin.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions bundles/org.openhab.binding.onecta/pom.xml
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.0.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-hotwatertank";
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";
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The 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. setpoint-min) is a more commonly used id.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this distinctive to the settemp-min

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";
Copy link
Contributor

Choose a reason for hiding this comment

The 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_ECONOMODE = "basic#econo-mode";
public static final String CHANNEL_AC_ECONOMODE = "basic#eco-mode";

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-controlfixedvalue";
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";
Copy link
Contributor

Choose a reason for hiding this comment

The 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;
}
}
Loading