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.leap.Request;
20 import org.openhab.binding.lutron.internal.protocol.lip.LutronCommandType;
21 import org.openhab.binding.lutron.internal.protocol.lip.LutronOperation;
22 import org.openhab.binding.lutron.internal.protocol.lip.TargetType;
25 * Lutron GROUP command object
27 * @author Bob Adair - Initial contribution
30 public class GroupCommand extends LutronCommandNew {
31 public static final Integer ACTION_GROUPSTATE = 3;
32 public static final Integer STATE_GRP_OCCUPIED = 3;
33 public static final Integer STATE_GRP_UNOCCUPIED = 4;
34 public static final Integer STATE_GRP_UNKNOWN = 255;
36 private final Integer action;
37 private final @Nullable Integer state;
40 * GroupCommand constructor
43 * @param integrationId
47 public GroupCommand(LutronOperation operation, Integer integrationId, Integer action, @Nullable Integer state) {
48 super(TargetType.GROUP, operation, LutronCommandType.GROUP, integrationId);
54 public String lipCommand() {
55 StringBuilder builder = new StringBuilder().append(operation).append(commandType);
56 builder.append(',').append(integrationId);
57 builder.append(',').append(action);
59 builder.append(',').append(state);
62 return builder.toString();
66 public @Nullable LeapCommand leapCommand(LeapBridgeHandler bridgeHandler, @Nullable Integer leapZone) {
67 if (action.equals(GroupCommand.ACTION_GROUPSTATE)) {
68 // Get status for all occupancy groups because you can't query just one
69 return new LeapCommand(Request.getOccupancyGroupStatus());
76 public String toString() {