2 * Copyright (c) 2010-2024 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.tacmi.internal;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
20 * This enum holds all the different measures and states available to be
21 * retrieved by the TACmi binding, including the scale factors needed to convert the received values to the real
24 * @author Timo Wendt - Initial contribution
25 * @author Wolfgang Klimt - improvements
26 * @author Christian Niessner - Ported to OpenHAB2
29 public enum TACmiMeasureType {
41 KILOWATTHOURS(11, 10),
55 private final int typeval;
56 private final int offset;
58 private static final Logger logger = LoggerFactory.getLogger(TACmiMeasureType.class);
60 private TACmiMeasureType(int typeval, int offset) {
61 this.typeval = typeval;
65 public int getTypeValue() {
69 public int getOffset() {
74 * Return measure type for a specific int value
76 public static TACmiMeasureType fromInt(int type) {
77 for (TACmiMeasureType mtype : TACmiMeasureType.values()) {
78 if (mtype.getTypeValue() == type) {
82 logger.debug("Received unexpected measure type {}", type);
83 return TACmiMeasureType.UNSUPPORTED;