]> git.basschouten.com Git - openhab-addons.git/blob
a669af0281a5e3c1b2ca4394595a3936c69c57e3
[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.hue.internal.dto.clip2;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.library.types.OnOffType;
17 import org.openhab.core.types.State;
18 import org.openhab.core.types.UnDefType;
19
20 import com.google.gson.annotations.SerializedName;
21
22 /**
23  * DTO for CLIP 2 motion sensor.
24  *
25  * @author Andrew Fiddian-Green - Initial contribution
26  */
27 @NonNullByDefault
28 public class Motion {
29     private boolean motion;
30     private @SerializedName("motion_valid") boolean motionValid;
31
32     public boolean isMotion() {
33         return motion;
34     }
35
36     public boolean isMotionValid() {
37         return motionValid;
38     }
39
40     public State getMotionState() {
41         return motionValid ? OnOffType.from(motion) : UnDefType.UNDEF;
42     }
43
44     public State getMotionValidState() {
45         return OnOffType.from(motionValid);
46     }
47 }