public static final String PARAMETER_VOUCHER_DATA_QUOTA = "voucherDataQuota";
public static final String PARAMETER_PORT_NUMBER = "portNumber";
public static final String PARAMETER_MAC_ADDRESS = "macAddress";
- public static final String PARAMETER_WIFI_NAME = "wifi";
// UniFi device types
public static final String DEVICE_TYPE_UAP = "uap";
private String model;
+ private String version;
+
+ private String serial;
+
private String type;
private String name;
return model;
}
+ public String getVersion() {
+ return version;
+ }
+
+ public String getSerial() {
+ return serial;
+ }
+
public String getName() {
return name == null || name.isBlank() ? mac : name;
}
import static org.openhab.binding.unifi.internal.UniFiBindingConstants.CHANNEL_AP_ENABLE;
import static org.openhab.binding.unifi.internal.UniFiBindingConstants.DEVICE_TYPE_UAP;
+import java.util.Map;
+
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.unifi.internal.UniFiAccessPointThingConfig;
import org.openhab.core.thing.ThingStatusDetail;
import org.openhab.core.types.Command;
import org.openhab.core.types.State;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* An access point managed by the UniFi controller software.
@NonNullByDefault
public class UniFiAccessPointThingHandler extends UniFiBaseThingHandler<UniFiDevice, UniFiAccessPointThingConfig> {
- private final Logger logger = LoggerFactory.getLogger(UniFiAccessPointThingHandler.class);
-
private UniFiAccessPointThingConfig config = new UniFiAccessPointThingConfig();
public UniFiAccessPointThingHandler(final Thing thing) {
return state;
}
+ @Override
+ protected void updateProperties(final UniFiDevice device) {
+ updateProperties(Map.of( //
+ Thing.PROPERTY_MODEL_ID, device.getModel(), //
+ Thing.PROPERTY_FIRMWARE_VERSION, device.getVersion(), //
+ Thing.PROPERTY_SERIAL_NUMBER, device.getSerial()));
+ }
+
@Override
protected boolean handleCommand(final UniFiController controller, final UniFiDevice device,
final ChannelUID channelUID, final Command command) throws UniFiException {
final @Nullable E entity = getEntity();
getThing().getChannels().forEach(channel -> updateState(entity, channel.getUID()));
+
+ updateProperties(entity);
}
}
*/
protected abstract State getChannelState(E entity, String channelId);
+ /**
+ * Updates relevant Thing properties from the UniFi entity object.
+ * Default implementation does not update any properties.
+ *
+ * @param entity UniFi entity object to get the properties information from
+ */
+ protected void updateProperties(E entity) {
+ }
+
/**
* Send the given command to the UniFi controller.
*
import static org.openhab.binding.unifi.internal.UniFiBindingConstants.PARAMETER_SID;
import static org.openhab.binding.unifi.internal.UniFiBindingConstants.PARAMETER_SITE;
import static org.openhab.binding.unifi.internal.UniFiBindingConstants.PARAMETER_WID;
-import static org.openhab.binding.unifi.internal.UniFiBindingConstants.PARAMETER_WIFI_NAME;
import java.util.Map;
import java.util.concurrent.TimeUnit;
for (final UniFiWlan wlan : cache.getWlans()) {
final ThingUID thingUID = new ThingUID(UniFiBindingConstants.THING_TYPE_WLAN, bridgeUID,
stripIdShort(wlan.getId()));
- final String siteName = wlan.getSite() == null ? "" : wlan.getSite().getName();
- final Map<String, Object> properties = Map.of(PARAMETER_WID, wlan.getId(), PARAMETER_SITE, siteName,
- PARAMETER_WIFI_NAME, wlan.getName());
+ final Map<String, Object> properties = Map.of(PARAMETER_WID, wlan.getId());
thingDiscovered(DiscoveryResultBuilder.create(thingUID).withThingType(UniFiBindingConstants.THING_TYPE_WLAN)
.withBridge(bridgeUID).withRepresentationProperty(PARAMETER_WID).withTTL(TTL_SECONDS)