2 * Copyright (c) 2010-2022 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
47 * @param integrationId
50 * @param enable true = enable, false = disable
52 public TimeclockCommand(LutronOperation operation, Integer integrationId, Integer action,
53 @Nullable Object parameter, @Nullable Boolean enable) {
54 super(TargetType.TIMECLOCK, operation, LutronCommandType.TIMECLOCK, integrationId);
56 this.parameter = parameter;
61 public String lipCommand() {
62 StringBuilder builder = new StringBuilder().append(operation).append(commandType);
63 builder.append(',').append(integrationId);
64 builder.append(',').append(action);
65 if (parameter != null) {
66 builder.append(',').append(parameter);
70 builder.append((enable) ? '1' : '2');
73 return builder.toString();
77 public @Nullable LeapCommand leapCommand(LeapBridgeHandler bridgeHandler, @Nullable Integer leapZone) {
82 public String toString() {