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.hue.internal.dto.clip2;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.core.library.types.OnOffType;
18 import org.openhab.core.types.State;
19 import org.openhab.core.types.UnDefType;
21 import com.google.gson.annotations.SerializedName;
24 * DTO for CLIP 2 motion sensor.
26 * @author Andrew Fiddian-Green - Initial contribution
30 private boolean motion;
31 private @SerializedName("motion_valid") boolean motionValid;
32 private @Nullable @SerializedName("motion_report") MotionReport motionReport;
35 * The underlying field is deprecated in the CLIP 2 API.
36 * Moved to motion_report/motion.
37 * Should be used only as fallback for older firmwares.
39 * @return true if motion is detected
41 public boolean isMotion() {
46 * The underlying field is deprecated in the CLIP 2 API.
47 * Motion is valid when motion_report property is present, invalid when absent.
48 * Should be used only as fallback for older firmwares.
50 public boolean isMotionValid() {
54 public State getMotionState() {
55 return motionValid ? OnOffType.from(motion) : UnDefType.UNDEF;
58 public State getMotionValidState() {
59 return OnOffType.from(motionValid);
62 public @Nullable MotionReport getMotionReport() {