]> git.basschouten.com Git - openhab-addons.git/blob
3555d6438e895738ad16d72e7ebe78a593f85601
[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.enocean.internal.eep.A5_07;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.enocean.internal.messages.ERP1Message;
17 import org.openhab.core.library.types.OnOffType;
18 import org.openhab.core.types.State;
19 import org.openhab.core.types.UnDefType;
20
21 /**
22  *
23  * @author Daniel Weber - Initial contribution
24  */
25 @NonNullByDefault
26 public class A5_07_01 extends A5_07 {
27
28     private static final int PIR_OFF = 0x7f;
29
30     public A5_07_01(ERP1Message packet) {
31         super(packet);
32     }
33
34     @Override
35     protected State getIllumination() {
36         return UnDefType.UNDEF;
37     }
38
39     @Override
40     protected State getMotion() {
41         return getDB1Value() <= PIR_OFF ? OnOffType.OFF : OnOffType.ON;
42     }
43
44     @Override
45     protected State getSupplyVoltage() {
46         if (!getBit(getDB0Value(), 0)) {
47             return UnDefType.UNDEF;
48         }
49
50         return getSupplyVoltage(getDB3Value());
51     }
52 }