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.hdpowerview.internal.dto;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
19 * An enum for the type of power supply in a shade.
21 * @author Andrew Fiddian-Green - Initial contribution
24 public enum BatteryKind {
26 HARDWIRED_POWER_SUPPLY(1),
28 RECHARGEABLE_BATTERY_WAND(3);
30 private int batteryKind;
32 private BatteryKind(int i) {
37 * Determine the BatteryKind by parsing the given string value.
39 * @param value the string to parse, or null.
40 * @return the BatteryKind or ERROR_UNKNOWN in case of error.
42 public static BatteryKind fromString(@Nullable String value) {
45 int intValue = Integer.parseInt(value);
46 for (BatteryKind e : values()) {
47 if (e.batteryKind == intValue) {
51 } catch (NumberFormatException e) {