]> git.basschouten.com Git - openhab-addons.git/blob
77593db4407bcc7cd551c20e4f8d62fb5e58ba57
[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.handler.EaseeThingHandler;
19 import org.openhab.core.library.types.OnOffType;
20 import org.openhab.core.thing.Channel;
21 import org.openhab.core.types.Command;
22
23 /**
24  * implements the command api call of the charger.
25  *
26  * @author Alexander Friese - initial contribution
27  */
28 @NonNullByDefault
29 public class SendCommandStartStop extends SendCommand {
30
31     public SendCommandStartStop(EaseeThingHandler handler, String chargerId, Channel channel, Command command) {
32         super(handler, channel, command);
33         String value;
34         if (command.equals(OnOffType.ON)) {
35             value = CMD_VAL_START_CHARGING;
36         } else {
37             value = CMD_VAL_STOP_CHARGING;
38         }
39         this.url = COMMANDS_URL.replaceAll("\\{id\\}", chargerId).replaceAll("\\{command\\}", value);
40     }
41 }