2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.easee.internal.command.charger;
15 import static org.openhab.binding.easee.internal.EaseeBindingConstants.*;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jetty.client.api.Request;
19 import org.eclipse.jetty.http.HttpMethod;
20 import org.openhab.binding.easee.internal.command.AbstractCommand;
21 import org.openhab.binding.easee.internal.command.JsonResultProcessor;
22 import org.openhab.binding.easee.internal.handler.EaseeThingHandler;
25 * implements the latest charging session api call of the charger.
27 * @author Alexander Friese - initial contribution
30 public class LatestChargingSession extends AbstractCommand {
31 private final String url;
33 public LatestChargingSession(EaseeThingHandler handler, String chargerId, JsonResultProcessor resultProcessor) {
34 // retry does not make much sense as it is a polling command, command might fail if no charging sessions are
35 // available, therefore just ignore failure.
36 super(handler, RetryOnFailure.NO, ProcessFailureResponse.NO, resultProcessor);
37 this.url = LATEST_CHARGING_SESSION_URL.replaceAll("\\{id\\}", chargerId);
41 protected Request prepareRequest(Request requestToPrepare) {
42 requestToPrepare.method(HttpMethod.GET);
43 return requestToPrepare;
47 protected String getURL() {
52 protected String getChannelGroup() {
53 return CHANNEL_GROUP_CHARGER_LATEST_SESSION;