]> git.basschouten.com Git - openhab-addons.git/blob
820adc147407e3715dd844186a8cd72b3ebaf27f
[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_30;
14
15 import static org.openhab.binding.enocean.internal.EnOceanBindingConstants.*;
16
17 import java.util.function.Function;
18
19 import org.openhab.binding.enocean.internal.eep.Base._4BSMessage;
20 import org.openhab.binding.enocean.internal.messages.ERP1Message;
21 import org.openhab.core.config.core.Configuration;
22 import org.openhab.core.library.types.QuantityType;
23 import org.openhab.core.library.unit.SIUnits;
24 import org.openhab.core.types.State;
25 import org.openhab.core.types.UnDefType;
26
27 /**
28  *
29  * @author Daniel Weber - Initial contribution
30  */
31 public class A5_30_03 extends _4BSMessage {
32
33     protected static final byte ALL_DIGITALPINS_HIGH = 0x0F;
34     protected static final byte WAKEUPPIN_HIGH = 0x10;
35
36     public A5_30_03() {
37         super();
38
39         this.supportsTeachInVariation3 = true;
40     }
41
42     public A5_30_03(ERP1Message packet) {
43         super(packet);
44
45         this.supportsTeachInVariation3 = true;
46     }
47
48     @Override
49     protected State convertToStateImpl(String channelId, String channelTypeId,
50             Function<String, State> getCurrentStateFunc, Configuration config) {
51         switch (channelId) {
52             case CHANNEL_TEMPERATURE:
53                 double temp = (getDB_2Value() - 255) / -6.375;
54                 return new QuantityType<>(temp, SIUnits.CELSIUS);
55         }
56
57         return UnDefType.UNDEF;
58     }
59 }