Skip to content
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

[easeee] Fix new api limits #18257

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 9 additions & 9 deletions bundles/org.openhab.binding.easee/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ Auto-discovery is supported and will discover all circuits and chargers assigned

The following configuration parameters are available for the binding/bridge:

| Configuration Parameter | Required | Description |
|------------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 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 (<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. |
| dataPollingInterval | no | Interval (seconds) in which live data values are retrieved from the Easee Cloud API. (default = 60) |
| sessionDataPollingInterval | no | Interval (seconds) in which session data values are retrieved from the Easee Cloud API. (default = 360) |
| 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) |
| Configuration Parameter | Required | Description |
|----------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| username | yes | The username to login at Easee Cloud service. This should be an e-mail address or phone number. |
| password | 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 (<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. |
| dataPollingInterval | no | Interval (seconds) in which live data values are retrieved from the Easee Cloud API. (default = 60) |
| sessionDataPollingInterval | no | Interval (seconds) in which session data values are retrieved from the Easee Cloud API. (default = 360) |
| 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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingStatus;
import org.openhab.core.thing.ThingStatusDetail;
import org.openhab.core.thing.ThingStatusInfo;
import org.openhab.core.thing.binding.BaseThingHandler;
import org.openhab.core.types.Command;
import org.openhab.core.types.State;
Expand Down Expand Up @@ -77,6 +78,25 @@ void reInit() {
}
}

@Override
public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) {
super.bridgeStatusChanged(bridgeStatusInfo);
if (bridgeStatusInfo.getStatus() == ThingStatus.ONLINE) {
logger.debug("bridgeStatusChanged: ONLINE");
if (isInitialized()) {
startPolling();
}
} else {
logger.debug("bridgeStatusChanged: NOT ONLINE");
if (isInitialized()) {
if (bridgeStatusInfo.getStatus() == ThingStatus.UNKNOWN) {
updateStatus(ThingStatus.UNKNOWN, ThingStatusDetail.NONE, STATUS_WAITING_FOR_BRIDGE);
}
stopPolling();
}
}
}

@Override
public void initialize() {
logger.debug("About to initialize Charger");
Expand Down Expand Up @@ -131,6 +151,14 @@ private void startPolling() {
POLLING_INITIAL_DELAY, getBridgeConfiguration().getSessionDataPollingInterval(), TimeUnit.SECONDS));
}

/**
* Stops the polling.
*/
private void stopPolling() {
cancelJobReference(dataPollingJobReference);
cancelJobReference(sessionDataPollingJobReference);
}

/**
* Poll the Easee Cloud API one time.
*/
Expand Down Expand Up @@ -198,8 +226,7 @@ protected final void updateOnlineStatus(CommunicationStatus status, JsonObject j
@Override
public void dispose() {
logger.debug("Handler disposed.");
cancelJobReference(dataPollingJobReference);
cancelJobReference(sessionDataPollingJobReference);
stopPolling();
}

/**
Expand Down