]> git.basschouten.com Git - openhab-addons.git/blob
6525f0546656b0688c72213eeec1461ff05ee728
[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.charger;
14
15 import static org.openhab.binding.easee.internal.EaseeBindingConstants.*;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.easee.internal.command.JsonResultProcessor;
19 import org.openhab.binding.easee.internal.handler.EaseeThingHandler;
20 import org.openhab.core.library.types.OnOffType;
21 import org.openhab.core.thing.Channel;
22 import org.openhab.core.types.Command;
23
24 /**
25  * implements the command api call of the charger.
26  *
27  * @author Alexander Friese - initial contribution
28  */
29 @NonNullByDefault
30 public class SendCommandPauseResume extends SendCommand {
31
32     public SendCommandPauseResume(EaseeThingHandler handler, String chargerId, Channel channel, Command command,
33             JsonResultProcessor resultProcessor) {
34         super(handler, channel, command, resultProcessor);
35         String value;
36         if (command.equals(OnOffType.ON)) {
37             value = CMD_VAL_PAUSE_CHARGING;
38         } else {
39             value = CMD_VAL_RESUME_CHARGING;
40         }
41         this.url = COMMANDS_URL.replaceAll("\\{id\\}", chargerId).replaceAll("\\{command\\}", value);
42     }
43 }