2 * Copyright (c) 2010-2021 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.networkupstools.internal;
17 import javax.measure.Unit;
18 import javax.measure.quantity.Power;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.openhab.core.library.unit.Units;
22 import org.openhab.core.thing.ThingTypeUID;
23 import org.openhab.core.thing.type.ChannelTypeUID;
25 import tec.uom.se.format.SimpleUnitFormat;
26 import tec.uom.se.unit.ProductUnit;
29 * The {@link NUTBindingConstants} class defines common constants, which are
30 * used across the whole binding.
32 * @author Hilbrand Bouwkamp - Initial contribution
35 public class NUTBindingConstants {
37 public static final String BINDING_ID = "networkupstools";
39 // List of all Thing Type UIDs
40 public static final ThingTypeUID THING_TYPE_UPS = new ThingTypeUID(BINDING_ID, "ups");
42 public static final String METADATA_NETWORKUPSTOOLS = "networkupstools";
43 public static final ChannelTypeUID CHANNEL_TYPE_DYNAMIC_NUMBER = new ChannelTypeUID(BINDING_ID, "number");
44 public static final ChannelTypeUID CHANNEL_TYPE_DYNAMIC_STRING = new ChannelTypeUID(BINDING_ID, "string");
45 public static final ChannelTypeUID CHANNEL_TYPE_DYNAMIC_SWITCH = new ChannelTypeUID(BINDING_ID, "switch");
46 public static final URI DYNAMIC_CHANNEL_CONFIG_QUANTITY_TYPE = URI
47 .create("channel-type:ups:dynamic-channel-config-quantity-type");
49 public static final Unit<Power> AMPERE_PER_HOUR = new ProductUnit<>(Units.AMPERE.divide(Units.HOUR));
50 public static final Unit<Power> VOLT_AMPERE = new ProductUnit<>(Units.VOLT.multiply(Units.AMPERE));
53 SimpleUnitFormat.getInstance().label(AMPERE_PER_HOUR, "Ah");
54 SimpleUnitFormat.getInstance().label(VOLT_AMPERE, "VA");
57 private static final String PARAMETER_PREFIX_UPS = "ups.";
60 * Enum with nut names which value will be set a parameter on the thing.
61 * These are values that don't change at all (e.g. type of ups) or not very often (e.g. firmware version).
63 public enum Parameters {
64 UPS_FIRMWARE(PARAMETER_PREFIX_UPS + "firmware"),
65 UPS_FIRMWARE_AUX(PARAMETER_PREFIX_UPS + "firmware.aux"),
66 UPS_ID(PARAMETER_PREFIX_UPS + "id"),
67 UPS_MFR(PARAMETER_PREFIX_UPS + "mfr"),
68 UPS_MFR_DATE(PARAMETER_PREFIX_UPS + "mfr.date"),
69 UPS_MODEL(PARAMETER_PREFIX_UPS + "model"),
70 UPS_SERIAL(PARAMETER_PREFIX_UPS + "serial");
72 private final String nutName;
74 private Parameters(final String nutName) {
75 this.nutName = nutName;
78 public String getNutName() {