]> git.basschouten.com Git - openhab-addons.git/blob
96fff4fc67db488b4bccdb04efefa0a97cd177ff
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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.lutron.internal.radiora.protocol;
14
15 /**
16  * Feedback for when a device was changed locally (not through Master Control)
17  * <p>
18  * <b>Syntax:</b>
19  *
20  * <pre>
21  * {@code
22  * LZC,<Zone Number>,<State>
23  * }
24  * </pre>
25  *
26  * <b>Examples:</b>
27  * <p>
28  * Dimmer 1 changed from 100% to 50%
29  *
30  * <pre>
31  * LZC,01,CHG
32  * </pre>
33  *
34  * Dimmer 4 changed from OFF to 25%
35  *
36  * <pre>
37  * LZC,04,ON
38  * </pre>
39  *
40  * @author Jeff Lauterbach - Initial Contribution
41  *
42  */
43 public class LocalZoneChangeFeedback extends RadioRAFeedback {
44
45     private int zoneNumber; // 1 to 32
46     private State state; // ON, OFF, CHG
47
48     public enum State {
49         ON,
50         OFF,
51         CHG
52     }
53
54     public LocalZoneChangeFeedback(String msg) {
55         String[] params = parse(msg, 2);
56
57         zoneNumber = Integer.parseInt(params[1].trim());
58         state = State.valueOf(params[2].trim().toUpperCase());
59     }
60
61     public State getState() {
62         return state;
63     }
64
65     public int getZoneNumber() {
66         return zoneNumber;
67     }
68 }