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.lutron.internal.protocol;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.binding.lutron.internal.handler.LeapBridgeHandler;
18 import org.openhab.binding.lutron.internal.protocol.leap.LeapCommand;
19 import org.openhab.binding.lutron.internal.protocol.lip.LutronCommandType;
20 import org.openhab.binding.lutron.internal.protocol.lip.LutronOperation;
21 import org.openhab.binding.lutron.internal.protocol.lip.TargetType;
24 * Lutron TIMECLOCK command object
26 * @author Bob Adair - Initial contribution
29 public class TimeclockCommand extends LutronCommandNew {
30 public static final Integer ACTION_CLOCKMODE = 1;
31 public static final Integer ACTION_SUNRISE = 2;
32 public static final Integer ACTION_SUNSET = 3;
33 public static final Integer ACTION_EXECEVENT = 5;
34 public static final Integer ACTION_SETEVENT = 6;
35 public static final Integer EVENT_ENABLE = 1;
36 public static final Integer EVENT_DISABLE = 2;
38 private final Integer action;
39 private final @Nullable Object parameter;
40 private final @Nullable Boolean enable;
43 * TimeclockCommand constructor
46 * @param integrationId
49 * @param enable true = enable, false = disable
51 public TimeclockCommand(LutronOperation operation, Integer integrationId, Integer action,
52 @Nullable Object parameter, @Nullable Boolean enable) {
53 super(TargetType.TIMECLOCK, operation, LutronCommandType.TIMECLOCK, integrationId);
55 this.parameter = parameter;
60 public String lipCommand() {
61 StringBuilder builder = new StringBuilder().append(operation).append(commandType);
62 builder.append(',').append(integrationId);
63 builder.append(',').append(action);
64 if (parameter != null) {
65 builder.append(',').append(parameter);
69 builder.append((enable) ? '1' : '2');
72 return builder.toString();
76 public @Nullable LeapCommand leapCommand(LeapBridgeHandler bridgeHandler, @Nullable Integer leapZone) {
81 public String toString() {