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.vesync.internal.handlers;
15 import java.util.List;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
20 * The {@link VeSyncDeviceMetadata} class contains the definition for the identification of multiple device types,
21 * to a single family of devices.
23 * New Device Type Ids are formatted as [DeviceType][-][Device Generation][-][Device Region]
25 * @author David Goodyear - Initial contribution
28 public class VeSyncDeviceMetadata {
30 public VeSyncDeviceMetadata(final String deviceFamilyName, final List<String> deviceGenerations,
31 final List<String> nonStandardIds) {
32 this.deviceFamilyName = deviceFamilyName;
33 this.deviceGenerations = deviceGenerations;
34 this.nonStandardIds = nonStandardIds;
38 * The name of the family the set of ID's represents.
41 public final String deviceFamilyName;
44 * The version id, that represents the specific model of the device
46 public final List<String> deviceGenerations;
49 * Device Types not following the standard 3 segment convention
51 public final List<String> nonStandardIds;
53 public boolean deviceTypeIdMatches(final String deviceType, final String[] deviceTypeSegments) {
54 if (nonStandardIds.contains(deviceType)) {
57 if (deviceTypeSegments.length == 3) {
58 return deviceGenerations.contains(deviceTypeSegments[1]);
63 public String getDeviceFamilyName() {
64 return deviceFamilyName;