From e7acb14d027f4a6371cc871304be1edb9e22cc72 Mon Sep 17 00:00:00 2001 From: Alexander Friese Date: Wed, 22 Jan 2025 21:00:02 +0100 Subject: [PATCH] [easee] speedup command processing (#18027) * speedup command processing Signed-off-by: Alexander Friese --- bundles/org.openhab.binding.easee/README.md | 4 +- .../easee/internal/EaseeBindingConstants.java | 2 - .../internal/config/EaseeConfiguration.java | 23 +++++++- .../internal/connector/WebInterface.java | 4 +- .../main/resources/OH-INF/config/config.xml | 12 +++++ .../resources/OH-INF/i18n/easee.properties | 52 ++++++++++++++++++- 6 files changed, 89 insertions(+), 8 deletions(-) diff --git a/bundles/org.openhab.binding.easee/README.md b/bundles/org.openhab.binding.easee/README.md index 6567f9cbb3a..bcee314fe60 100644 --- a/bundles/org.openhab.binding.easee/README.md +++ b/bundles/org.openhab.binding.easee/README.md @@ -28,7 +28,9 @@ The following configuration parameters are available for the binding/bridge: | username | yes | The username to login at Easee Cloud service. This should be an e-mail address or phone number. | | passord | yes | Your password to login at Easee Cloud service. | | siteId | yes | The ID of the site containing the wallbox(es) and circuit(s) that should be integrated into openHAB. The ID of your site can be found via the sites overview (). You just need to click one of the sites listed there, the id will be part of the URL which is then opened. It will be a number with typically 6 digits. | -| dataPollingInterval | no | Interval (seconds) in which live data values are retrieved from the Easee Cloud API. (default = 120) | +| dataPollingInterval | no | Interval (seconds) in which live data values are retrieved from the Easee Cloud API. (default = 60) | +| webRequestInitialDelay | no | Initial time (seconds) to wait before first request is sent to the Easee Cloud API. (default = 10) | +| webRequestInterval | no | Interval (seconds) between two subsequent requests to be sent to the Easee Cloud API. (default = 2) | ## Thing configuration diff --git a/bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/EaseeBindingConstants.java b/bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/EaseeBindingConstants.java index f3dfcd7ef55..7bf1e852867 100644 --- a/bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/EaseeBindingConstants.java +++ b/bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/EaseeBindingConstants.java @@ -122,8 +122,6 @@ public class EaseeBindingConstants { public static final String CMD_VAL_RESUME_CHARGING = "resume_charging"; // web request constants - public static final long WEB_REQUEST_INITIAL_DELAY = 30; - public static final long WEB_REQUEST_INTERVAL = 5; public static final int WEB_REQUEST_QUEUE_MAX_SIZE = 20; public static final int WEB_REQUEST_TOKEN_EXPIRY_BUFFER_MINUTES = 5; public static final int WEB_REQUEST_TOKEN_MAX_AGE_MINUTES = 60; diff --git a/bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/config/EaseeConfiguration.java b/bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/config/EaseeConfiguration.java index a83eb9bc15c..5f960212db2 100644 --- a/bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/config/EaseeConfiguration.java +++ b/bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/config/EaseeConfiguration.java @@ -28,7 +28,9 @@ public class EaseeConfiguration { private Integer asyncTimeout = 120; private Integer syncTimeout = 120; - private Integer dataPollingInterval = 120; + private Integer dataPollingInterval = 60; + private Integer webRequestInitialDelay = 10; + private Integer webRequestInterval = 2; public String getUsername() { return username; @@ -78,13 +80,30 @@ public class EaseeConfiguration { this.dataPollingInterval = dataPollingInterval; } + public Integer getWebRequestInitialDelay() { + return webRequestInitialDelay; + } + + public void setWebRequestInitialDelay(Integer webRequestInitialDelay) { + this.webRequestInitialDelay = webRequestInitialDelay; + } + + public Integer getWebRequestInterval() { + return webRequestInterval; + } + + public void setWebRequestInterval(Integer webRequestInterval) { + this.webRequestInterval = webRequestInterval; + } + @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("EaseeConfiguration [username=").append(username).append(", password=").append(password) .append(", siteId=").append(siteId).append(", asyncTimeout=").append(asyncTimeout) .append(", syncTimeout=").append(syncTimeout).append(", dataPollingInterval=") - .append(dataPollingInterval).append("]"); + .append(dataPollingInterval).append(", webRequestInitialDelay=").append(webRequestInitialDelay) + .append(", webRequestInterval=").append(webRequestInterval).append("]"); return builder.toString(); } } diff --git a/bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/connector/WebInterface.java b/bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/connector/WebInterface.java index cf69eaefdf4..71da937c361 100644 --- a/bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/connector/WebInterface.java +++ b/bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/connector/WebInterface.java @@ -31,6 +31,7 @@ import org.openhab.binding.easee.internal.Utils; import org.openhab.binding.easee.internal.command.EaseeCommand; import org.openhab.binding.easee.internal.command.account.Login; import org.openhab.binding.easee.internal.command.account.RefreshToken; +import org.openhab.binding.easee.internal.config.EaseeConfiguration; import org.openhab.binding.easee.internal.handler.EaseeBridgeHandler; import org.openhab.binding.easee.internal.handler.StatusHandler; import org.openhab.binding.easee.internal.model.ValidationException; @@ -269,9 +270,10 @@ public class WebInterface implements AtomicReferenceTrait { } public void start() { + EaseeConfiguration config = handler.getBridgeConfiguration(); setAuthenticated(false); updateJobReference(requestExecutorJobReference, scheduler.scheduleWithFixedDelay(requestExecutor, - WEB_REQUEST_INITIAL_DELAY, WEB_REQUEST_INTERVAL, TimeUnit.SECONDS)); + config.getWebRequestInitialDelay(), config.getWebRequestInterval(), TimeUnit.SECONDS)); } /** diff --git a/bundles/org.openhab.binding.easee/src/main/resources/OH-INF/config/config.xml b/bundles/org.openhab.binding.easee/src/main/resources/OH-INF/config/config.xml index 60930c40b5d..1b6ebd0f6ad 100644 --- a/bundles/org.openhab.binding.easee/src/main/resources/OH-INF/config/config.xml +++ b/bundles/org.openhab.binding.easee/src/main/resources/OH-INF/config/config.xml @@ -36,6 +36,18 @@ Interval in which data is polled from EaseeCloud (in seconds). 60 + + + Initial time to wait before first request is sent to EaseeCloud (in seconds). + 10 + + + + Interval between two subsequent requests to be sent to EaseeCloud (in seconds). + 2 + diff --git a/bundles/org.openhab.binding.easee/src/main/resources/OH-INF/i18n/easee.properties b/bundles/org.openhab.binding.easee/src/main/resources/OH-INF/i18n/easee.properties index 4e4b7305fe1..8bd86e3a8ba 100644 --- a/bundles/org.openhab.binding.easee/src/main/resources/OH-INF/i18n/easee.properties +++ b/bundles/org.openhab.binding.easee/src/main/resources/OH-INF/i18n/easee.properties @@ -34,6 +34,10 @@ thing-type.config.easee.site.siteId.label = Site ID thing-type.config.easee.site.siteId.description = The ID of the site containing the charger(s) and circuit(s) that should be integrated into openHAB. thing-type.config.easee.site.username.label = Username thing-type.config.easee.site.username.description = The username to login at Easee Cloud service. This should be an e-mail address or phone number. +thing-type.config.easee.site.webRequestInitialDelay.label = Initial Web Request Delay +thing-type.config.easee.site.webRequestInitialDelay.description = Initial time to wait before first request is sent to EaseeCloud (in seconds). +thing-type.config.easee.site.webRequestInterval.label = Web Request Interval +thing-type.config.easee.site.webRequestInterval.description = Interval between two subsequent requests are sent to EaseeCloud (in seconds). # channel group types @@ -65,10 +69,16 @@ channel-group-type.easee.charger-latestSession.channel.sessionStart.description channel-group-type.easee.charger-state.label = Charger Status channel-group-type.easee.charger-state.channel.cableLocked.label = Cable Locked channel-group-type.easee.charger-state.channel.cableLocked.description = Cable Locked status of the wallbox. +channel-group-type.easee.charger-state.channel.cableRating.label = Cable Rating +channel-group-type.easee.charger-state.channel.cableRating.description = Rating of the connected cable. +channel-group-type.easee.charger-state.channel.cellRSSI.label = Cell RSSI +channel-group-type.easee.charger-state.channel.cellRSSI.description = Cell signal quality. channel-group-type.easee.charger-state.channel.chargerFirmware.label = Current Firmware channel-group-type.easee.charger-state.channel.chargerFirmware.description = Current Firmware of the wallbox. channel-group-type.easee.charger-state.channel.chargerOpMode.label = Charger Operation Mode channel-group-type.easee.charger-state.channel.chargerOpMode.description = Current operation mode. +channel-group-type.easee.charger-state.channel.connectedToCloud.label = Connected to Cloud +channel-group-type.easee.charger-state.channel.connectedToCloud.description = Cloud connection status of the wallbox. channel-group-type.easee.charger-state.channel.dynamicChargerCurrent.label = Dynamic Charger Current channel-group-type.easee.charger-state.channel.dynamicChargerCurrent.description = Dynamic set charging current. channel-group-type.easee.charger-state.channel.dynamicCircuitCurrentP1.label = Dynamic Circuit Current P1 @@ -77,16 +87,46 @@ channel-group-type.easee.charger-state.channel.dynamicCircuitCurrentP2.label = D channel-group-type.easee.charger-state.channel.dynamicCircuitCurrentP2.description = Dynamic set circuit current for phase 2. channel-group-type.easee.charger-state.channel.dynamicCircuitCurrentP3.label = Dynamic Circuit Current P3 channel-group-type.easee.charger-state.channel.dynamicCircuitCurrentP3.description = Dynamic set circuit current for phase 3. +channel-group-type.easee.charger-state.channel.energyPerHour.label = Energy per Hour +channel-group-type.easee.charger-state.channel.energyPerHour.description = Energy transferred per hour. channel-group-type.easee.charger-state.channel.errorCode.label = Error Code channel-group-type.easee.charger-state.channel.errorCode.description = Error Code. channel-group-type.easee.charger-state.channel.fatalErrorCode.label = Fatal Error Code channel-group-type.easee.charger-state.channel.fatalErrorCode.description = Fatal Error Code. +channel-group-type.easee.charger-state.channel.inCurrentT2.label = Input Current T2 +channel-group-type.easee.charger-state.channel.inCurrentT2.description = Input Current on phase T2 +channel-group-type.easee.charger-state.channel.inCurrentT3.label = Input Current T3 +channel-group-type.easee.charger-state.channel.inCurrentT3.description = Input Current on phase T3 +channel-group-type.easee.charger-state.channel.inCurrentT4.label = Input Current T4 +channel-group-type.easee.charger-state.channel.inCurrentT4.description = Input Current on phase T4 +channel-group-type.easee.charger-state.channel.inCurrentT5.label = Input Current T5 +channel-group-type.easee.charger-state.channel.inCurrentT5.description = Input Current on phase T5 +channel-group-type.easee.charger-state.channel.inVoltageT1T2.label = Input Voltage T1T2 +channel-group-type.easee.charger-state.channel.inVoltageT1T2.description = Input voltage between phase T1 and T2 +channel-group-type.easee.charger-state.channel.inVoltageT1T3.label = Input Voltage T1T3 +channel-group-type.easee.charger-state.channel.inVoltageT1T3.description = Input voltage between phase T1 and T3 +channel-group-type.easee.charger-state.channel.inVoltageT1T4.label = Input Voltage T1T4 +channel-group-type.easee.charger-state.channel.inVoltageT1T4.description = Input voltage between phase T1 and T4 +channel-group-type.easee.charger-state.channel.inVoltageT1T5.label = Input Voltage T1T5 +channel-group-type.easee.charger-state.channel.inVoltageT1T5.description = Input voltage between phase T1 and T5 +channel-group-type.easee.charger-state.channel.inVoltageT2T3.label = Input Voltage T2T3 +channel-group-type.easee.charger-state.channel.inVoltageT2T3.description = Input voltage between phase T2 and T3 +channel-group-type.easee.charger-state.channel.inVoltageT2T4.label = Input Voltage T2T4 +channel-group-type.easee.charger-state.channel.inVoltageT2T4.description = Input voltage between phase T2 and T4 +channel-group-type.easee.charger-state.channel.inVoltageT2T5.label = Input Voltage T2T5 +channel-group-type.easee.charger-state.channel.inVoltageT2T5.description = Input voltage between phase T2 and T5 +channel-group-type.easee.charger-state.channel.inVoltageT3T4.label = Input Voltage T3T4 +channel-group-type.easee.charger-state.channel.inVoltageT3T4.description = Input voltage between phase T3 and T4 +channel-group-type.easee.charger-state.channel.inVoltageT3T5.label = Input Voltage T3T5 +channel-group-type.easee.charger-state.channel.inVoltageT3T5.description = Input voltage between phase T3 and T5 +channel-group-type.easee.charger-state.channel.inVoltageT4T5.label = Input Voltage T4T5 +channel-group-type.easee.charger-state.channel.inVoltageT4T5.description = Input voltage between phase T4 and T5 channel-group-type.easee.charger-state.channel.isOnline.label = Online channel-group-type.easee.charger-state.channel.isOnline.description = Online status of the wallbox. -channel-group-type.easee.charger-state.channel.latestFirmware.label = Latest Firmware -channel-group-type.easee.charger-state.channel.latestFirmware.description = Latest Firmware which is available for the wallbox. channel-group-type.easee.charger-state.channel.latestPulse.label = Latest Pulse channel-group-type.easee.charger-state.channel.latestPulse.description = Last data received from charger. +channel-group-type.easee.charger-state.channel.ledMode.label = Led Mode +channel-group-type.easee.charger-state.channel.ledMode.description = Led Mode. channel-group-type.easee.charger-state.channel.lifetimeEnergy.label = Lifetime Energy channel-group-type.easee.charger-state.channel.lifetimeEnergy.description = Total lifetime energy. channel-group-type.easee.charger-state.channel.outputCurrent.label = Output Current @@ -101,6 +141,8 @@ channel-group-type.easee.charger-state.channel.totalPower.label = Total Power channel-group-type.easee.charger-state.channel.totalPower.description = Total Power for all active phases. channel-group-type.easee.charger-state.channel.voltage.label = Voltage channel-group-type.easee.charger-state.channel.voltage.description = Voltage +channel-group-type.easee.charger-state.channel.wiFiRSSI.label = Wi-Fi RSSI +channel-group-type.easee.charger-state.channel.wiFiRSSI.description = Wi-Fi signal quality. channel-group-type.easee.circuit-dynamicCurrent.label = Circuit Dynamic Current channel-group-type.easee.circuit-dynamicCurrent.channel.dynamicCurrents.label = Dynamic Currents channel-group-type.easee.circuit-dynamicCurrent.channel.dynamicCurrents.description = Dynamic circuit currents for phases 1,2,3. @@ -155,9 +197,15 @@ channel-type.easee.type-integer-charger-op-mode.state.option.5 = Error channel-type.easee.type-integer-charger-op-mode.state.option.6 = ReadyToCharge channel-type.easee.type-integer.label = Generic Integer channel-type.easee.type-power.label = Power +channel-type.easee.type-rssi.label = Received Signal Strength Indicator channel-type.easee.type-switch.label = Switch channel-type.easee.type-volt.label = ElectricPotential +# channel group types + +channel-group-type.easee.charger-state.channel.latestFirmware.label = Latest Firmware +channel-group-type.easee.charger-state.channel.latestFirmware.description = Latest Firmware which is available for the wallbox. + # status translations status.token.validated = "Access token validated"