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.unifi.internal.api.model;
15 import org.openhab.binding.unifi.internal.api.util.UniFiTidyLowerCaseStringDeserializer;
17 import com.google.gson.annotations.JsonAdapter;
18 import com.google.gson.annotations.SerializedName;
21 * The {@link UniFiDevice} represents the data model of a UniFi Wireless Device
22 * (better known as an Access Point).
24 * @author Matthew Bowman - Initial contribution
26 public class UniFiDevice {
28 protected final transient UniFiController controller;
30 @SerializedName("_id")
33 @JsonAdapter(UniFiTidyLowerCaseStringDeserializer.class)
40 private String siteId;
42 public UniFiDevice(UniFiController controller) {
43 this.controller = controller;
46 public String getId() {
50 public String getModel() {
54 public String getName() {
55 return name == null || name.isBlank() ? mac : name;
58 public String getMac() {
62 public UniFiSite getSite() {
63 return controller.getSite(siteId);
67 public String toString() {
68 return String.format("UniFiDevice{mac: '%s', name: '%s', model: '%s', site: %s}", mac, name, model, getSite());