Skip to content

Commit e7acb14

Browse files
authored
[easee] speedup command processing (openhab#18027)
* speedup command processing Signed-off-by: Alexander Friese <[email protected]>
1 parent 76e4db2 commit e7acb14

File tree

6 files changed

+89
-8
lines changed

6 files changed

+89
-8
lines changed

bundles/org.openhab.binding.easee/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ The following configuration parameters are available for the binding/bridge:
2828
| username | yes | The username to login at Easee Cloud service. This should be an e-mail address or phone number. |
2929
| passord | yes | Your password to login at Easee Cloud service. |
3030
| 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 (<https://easee.cloud/sites>). 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. |
31-
| dataPollingInterval | no | Interval (seconds) in which live data values are retrieved from the Easee Cloud API. (default = 120) |
31+
| dataPollingInterval | no | Interval (seconds) in which live data values are retrieved from the Easee Cloud API. (default = 60) |
32+
| webRequestInitialDelay | no | Initial time (seconds) to wait before first request is sent to the Easee Cloud API. (default = 10) |
33+
| webRequestInterval | no | Interval (seconds) between two subsequent requests to be sent to the Easee Cloud API. (default = 2) |
3234

3335
## Thing configuration
3436

bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/EaseeBindingConstants.java

-2
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ public class EaseeBindingConstants {
122122
public static final String CMD_VAL_RESUME_CHARGING = "resume_charging";
123123

124124
// web request constants
125-
public static final long WEB_REQUEST_INITIAL_DELAY = 30;
126-
public static final long WEB_REQUEST_INTERVAL = 5;
127125
public static final int WEB_REQUEST_QUEUE_MAX_SIZE = 20;
128126
public static final int WEB_REQUEST_TOKEN_EXPIRY_BUFFER_MINUTES = 5;
129127
public static final int WEB_REQUEST_TOKEN_MAX_AGE_MINUTES = 60;

bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/config/EaseeConfiguration.java

+21-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public class EaseeConfiguration {
2828

2929
private Integer asyncTimeout = 120;
3030
private Integer syncTimeout = 120;
31-
private Integer dataPollingInterval = 120;
31+
private Integer dataPollingInterval = 60;
32+
private Integer webRequestInitialDelay = 10;
33+
private Integer webRequestInterval = 2;
3234

3335
public String getUsername() {
3436
return username;
@@ -78,13 +80,30 @@ public void setDataPollingInterval(Integer dataPollingInterval) {
7880
this.dataPollingInterval = dataPollingInterval;
7981
}
8082

83+
public Integer getWebRequestInitialDelay() {
84+
return webRequestInitialDelay;
85+
}
86+
87+
public void setWebRequestInitialDelay(Integer webRequestInitialDelay) {
88+
this.webRequestInitialDelay = webRequestInitialDelay;
89+
}
90+
91+
public Integer getWebRequestInterval() {
92+
return webRequestInterval;
93+
}
94+
95+
public void setWebRequestInterval(Integer webRequestInterval) {
96+
this.webRequestInterval = webRequestInterval;
97+
}
98+
8199
@Override
82100
public String toString() {
83101
StringBuilder builder = new StringBuilder();
84102
builder.append("EaseeConfiguration [username=").append(username).append(", password=").append(password)
85103
.append(", siteId=").append(siteId).append(", asyncTimeout=").append(asyncTimeout)
86104
.append(", syncTimeout=").append(syncTimeout).append(", dataPollingInterval=")
87-
.append(dataPollingInterval).append("]");
105+
.append(dataPollingInterval).append(", webRequestInitialDelay=").append(webRequestInitialDelay)
106+
.append(", webRequestInterval=").append(webRequestInterval).append("]");
88107
return builder.toString();
89108
}
90109
}

bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/connector/WebInterface.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.openhab.binding.easee.internal.command.EaseeCommand;
3232
import org.openhab.binding.easee.internal.command.account.Login;
3333
import org.openhab.binding.easee.internal.command.account.RefreshToken;
34+
import org.openhab.binding.easee.internal.config.EaseeConfiguration;
3435
import org.openhab.binding.easee.internal.handler.EaseeBridgeHandler;
3536
import org.openhab.binding.easee.internal.handler.StatusHandler;
3637
import org.openhab.binding.easee.internal.model.ValidationException;
@@ -269,9 +270,10 @@ public WebInterface(ScheduledExecutorService scheduler, EaseeBridgeHandler handl
269270
}
270271

271272
public void start() {
273+
EaseeConfiguration config = handler.getBridgeConfiguration();
272274
setAuthenticated(false);
273275
updateJobReference(requestExecutorJobReference, scheduler.scheduleWithFixedDelay(requestExecutor,
274-
WEB_REQUEST_INITIAL_DELAY, WEB_REQUEST_INTERVAL, TimeUnit.SECONDS));
276+
config.getWebRequestInitialDelay(), config.getWebRequestInterval(), TimeUnit.SECONDS));
275277
}
276278

277279
/**

bundles/org.openhab.binding.easee/src/main/resources/OH-INF/config/config.xml

+12
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@
3636
<description>Interval in which data is polled from EaseeCloud (in seconds).</description>
3737
<default>60</default>
3838
</parameter>
39+
<parameter name="webRequestInitialDelay" type="integer" required="false" min="5" max="60" unit="s"
40+
groupName="connection">
41+
<label>Initial Web Request Delay</label>
42+
<description>Initial time to wait before first request is sent to EaseeCloud (in seconds).</description>
43+
<default>10</default>
44+
</parameter>
45+
<parameter name="webRequestInterval" type="integer" required="false" min="1" max="10" unit="s"
46+
groupName="connection">
47+
<label>Web Request Interval</label>
48+
<description>Interval between two subsequent requests to be sent to EaseeCloud (in seconds).</description>
49+
<default>2</default>
50+
</parameter>
3951
</config-description>
4052
<config-description uri="thing-type:easee:charger">
4153
<parameter name="id" type="text" required="true">

bundles/org.openhab.binding.easee/src/main/resources/OH-INF/i18n/easee.properties

+50-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ thing-type.config.easee.site.siteId.label = Site ID
3434
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.
3535
thing-type.config.easee.site.username.label = Username
3636
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.
37+
thing-type.config.easee.site.webRequestInitialDelay.label = Initial Web Request Delay
38+
thing-type.config.easee.site.webRequestInitialDelay.description = Initial time to wait before first request is sent to EaseeCloud (in seconds).
39+
thing-type.config.easee.site.webRequestInterval.label = Web Request Interval
40+
thing-type.config.easee.site.webRequestInterval.description = Interval between two subsequent requests are sent to EaseeCloud (in seconds).
3741

3842
# channel group types
3943

@@ -65,10 +69,16 @@ channel-group-type.easee.charger-latestSession.channel.sessionStart.description
6569
channel-group-type.easee.charger-state.label = Charger Status
6670
channel-group-type.easee.charger-state.channel.cableLocked.label = Cable Locked
6771
channel-group-type.easee.charger-state.channel.cableLocked.description = Cable Locked status of the wallbox.
72+
channel-group-type.easee.charger-state.channel.cableRating.label = Cable Rating
73+
channel-group-type.easee.charger-state.channel.cableRating.description = Rating of the connected cable.
74+
channel-group-type.easee.charger-state.channel.cellRSSI.label = Cell RSSI
75+
channel-group-type.easee.charger-state.channel.cellRSSI.description = Cell signal quality.
6876
channel-group-type.easee.charger-state.channel.chargerFirmware.label = Current Firmware
6977
channel-group-type.easee.charger-state.channel.chargerFirmware.description = Current Firmware of the wallbox.
7078
channel-group-type.easee.charger-state.channel.chargerOpMode.label = Charger Operation Mode
7179
channel-group-type.easee.charger-state.channel.chargerOpMode.description = Current operation mode.
80+
channel-group-type.easee.charger-state.channel.connectedToCloud.label = Connected to Cloud
81+
channel-group-type.easee.charger-state.channel.connectedToCloud.description = Cloud connection status of the wallbox.
7282
channel-group-type.easee.charger-state.channel.dynamicChargerCurrent.label = Dynamic Charger Current
7383
channel-group-type.easee.charger-state.channel.dynamicChargerCurrent.description = Dynamic set charging current.
7484
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
7787
channel-group-type.easee.charger-state.channel.dynamicCircuitCurrentP2.description = Dynamic set circuit current for phase 2.
7888
channel-group-type.easee.charger-state.channel.dynamicCircuitCurrentP3.label = Dynamic Circuit Current P3
7989
channel-group-type.easee.charger-state.channel.dynamicCircuitCurrentP3.description = Dynamic set circuit current for phase 3.
90+
channel-group-type.easee.charger-state.channel.energyPerHour.label = Energy per Hour
91+
channel-group-type.easee.charger-state.channel.energyPerHour.description = Energy transferred per hour.
8092
channel-group-type.easee.charger-state.channel.errorCode.label = Error Code
8193
channel-group-type.easee.charger-state.channel.errorCode.description = Error Code.
8294
channel-group-type.easee.charger-state.channel.fatalErrorCode.label = Fatal Error Code
8395
channel-group-type.easee.charger-state.channel.fatalErrorCode.description = Fatal Error Code.
96+
channel-group-type.easee.charger-state.channel.inCurrentT2.label = Input Current T2
97+
channel-group-type.easee.charger-state.channel.inCurrentT2.description = Input Current on phase T2
98+
channel-group-type.easee.charger-state.channel.inCurrentT3.label = Input Current T3
99+
channel-group-type.easee.charger-state.channel.inCurrentT3.description = Input Current on phase T3
100+
channel-group-type.easee.charger-state.channel.inCurrentT4.label = Input Current T4
101+
channel-group-type.easee.charger-state.channel.inCurrentT4.description = Input Current on phase T4
102+
channel-group-type.easee.charger-state.channel.inCurrentT5.label = Input Current T5
103+
channel-group-type.easee.charger-state.channel.inCurrentT5.description = Input Current on phase T5
104+
channel-group-type.easee.charger-state.channel.inVoltageT1T2.label = Input Voltage T1T2
105+
channel-group-type.easee.charger-state.channel.inVoltageT1T2.description = Input voltage between phase T1 and T2
106+
channel-group-type.easee.charger-state.channel.inVoltageT1T3.label = Input Voltage T1T3
107+
channel-group-type.easee.charger-state.channel.inVoltageT1T3.description = Input voltage between phase T1 and T3
108+
channel-group-type.easee.charger-state.channel.inVoltageT1T4.label = Input Voltage T1T4
109+
channel-group-type.easee.charger-state.channel.inVoltageT1T4.description = Input voltage between phase T1 and T4
110+
channel-group-type.easee.charger-state.channel.inVoltageT1T5.label = Input Voltage T1T5
111+
channel-group-type.easee.charger-state.channel.inVoltageT1T5.description = Input voltage between phase T1 and T5
112+
channel-group-type.easee.charger-state.channel.inVoltageT2T3.label = Input Voltage T2T3
113+
channel-group-type.easee.charger-state.channel.inVoltageT2T3.description = Input voltage between phase T2 and T3
114+
channel-group-type.easee.charger-state.channel.inVoltageT2T4.label = Input Voltage T2T4
115+
channel-group-type.easee.charger-state.channel.inVoltageT2T4.description = Input voltage between phase T2 and T4
116+
channel-group-type.easee.charger-state.channel.inVoltageT2T5.label = Input Voltage T2T5
117+
channel-group-type.easee.charger-state.channel.inVoltageT2T5.description = Input voltage between phase T2 and T5
118+
channel-group-type.easee.charger-state.channel.inVoltageT3T4.label = Input Voltage T3T4
119+
channel-group-type.easee.charger-state.channel.inVoltageT3T4.description = Input voltage between phase T3 and T4
120+
channel-group-type.easee.charger-state.channel.inVoltageT3T5.label = Input Voltage T3T5
121+
channel-group-type.easee.charger-state.channel.inVoltageT3T5.description = Input voltage between phase T3 and T5
122+
channel-group-type.easee.charger-state.channel.inVoltageT4T5.label = Input Voltage T4T5
123+
channel-group-type.easee.charger-state.channel.inVoltageT4T5.description = Input voltage between phase T4 and T5
84124
channel-group-type.easee.charger-state.channel.isOnline.label = Online
85125
channel-group-type.easee.charger-state.channel.isOnline.description = Online status of the wallbox.
86-
channel-group-type.easee.charger-state.channel.latestFirmware.label = Latest Firmware
87-
channel-group-type.easee.charger-state.channel.latestFirmware.description = Latest Firmware which is available for the wallbox.
88126
channel-group-type.easee.charger-state.channel.latestPulse.label = Latest Pulse
89127
channel-group-type.easee.charger-state.channel.latestPulse.description = Last data received from charger.
128+
channel-group-type.easee.charger-state.channel.ledMode.label = Led Mode
129+
channel-group-type.easee.charger-state.channel.ledMode.description = Led Mode.
90130
channel-group-type.easee.charger-state.channel.lifetimeEnergy.label = Lifetime Energy
91131
channel-group-type.easee.charger-state.channel.lifetimeEnergy.description = Total lifetime energy.
92132
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
101141
channel-group-type.easee.charger-state.channel.totalPower.description = Total Power for all active phases.
102142
channel-group-type.easee.charger-state.channel.voltage.label = Voltage
103143
channel-group-type.easee.charger-state.channel.voltage.description = Voltage
144+
channel-group-type.easee.charger-state.channel.wiFiRSSI.label = Wi-Fi RSSI
145+
channel-group-type.easee.charger-state.channel.wiFiRSSI.description = Wi-Fi signal quality.
104146
channel-group-type.easee.circuit-dynamicCurrent.label = Circuit Dynamic Current
105147
channel-group-type.easee.circuit-dynamicCurrent.channel.dynamicCurrents.label = Dynamic Currents
106148
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
155197
channel-type.easee.type-integer-charger-op-mode.state.option.6 = ReadyToCharge
156198
channel-type.easee.type-integer.label = Generic Integer
157199
channel-type.easee.type-power.label = Power
200+
channel-type.easee.type-rssi.label = Received Signal Strength Indicator
158201
channel-type.easee.type-switch.label = Switch
159202
channel-type.easee.type-volt.label = ElectricPotential
160203

204+
# channel group types
205+
206+
channel-group-type.easee.charger-state.channel.latestFirmware.label = Latest Firmware
207+
channel-group-type.easee.charger-state.channel.latestFirmware.description = Latest Firmware which is available for the wallbox.
208+
161209
# status translations
162210

163211
status.token.validated = "Access token validated"

0 commit comments

Comments
 (0)