]> git.basschouten.com Git - openhab-addons.git/blob
5c79e06d24df39d2c04881cc5c5fc62f27398bb2
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.easee.internal.command.circuit;
14
15 import static org.openhab.binding.easee.internal.EaseeBindingConstants.*;
16
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.handler.EaseeThingHandler;
22
23 /**
24  * implements the settings api call of the circuit.
25  *
26  * @author Alexander Friese - initial contribution
27  */
28 @NonNullByDefault
29 public class CircuitSettings extends AbstractCommand {
30     private final String url;
31
32     public CircuitSettings(EaseeThingHandler handler, String circuitId) {
33         super(handler, RetryOnFailure.NO, ProcessFailureResponse.YES);
34         String siteId = handler.getBridgeConfiguration().getSiteId();
35         this.url = CIRCUIT_SETTINGS_URL.replaceAll("\\{siteId\\}", siteId).replaceAll("\\{circuitId\\}", circuitId);
36     }
37
38     @Override
39     protected Request prepareRequest(Request requestToPrepare) {
40         requestToPrepare.method(HttpMethod.GET);
41         return requestToPrepare;
42     }
43
44     @Override
45     protected String getURL() {
46         return url;
47     }
48
49     @Override
50     protected String getChannelGroup() {
51         return CHANNEL_GROUP_CIRCUIT_SETTINGS;
52     }
53 }