private @Nullable String deviceId;
+ private @Nullable ICloudDeviceInformation deviceInformationRecord;
+
public ICloudDeviceHandler(Thing thing) {
super(thing);
}
public void deviceInformationUpdate(List<ICloudDeviceInformation> deviceInformationList) {
ICloudDeviceInformation deviceInformationRecord = getDeviceInformationRecord(deviceInformationList);
if (deviceInformationRecord != null) {
+ this.deviceInformationRecord = deviceInformationRecord;
if (deviceInformationRecord.getDeviceStatus() == 200) {
updateStatus(ONLINE);
} else {
if (channelId.equals(FIND_MY_PHONE)) {
if (command == OnOffType.ON) {
try {
- final String deviceId = this.deviceId;
- if (deviceId == null) {
- this.logger.debug("Can't send Find My Device request, because deviceId is null!");
+
+ if (deviceInformationRecord == null) {
+ this.logger
+ .debug("Can't send Find My Device request, because deviceInformationRecord is null!");
return;
}
- bridgeHandler.findMyDevice(deviceId);
+ if (deviceInformationRecord.getId() == null) {
+ this.logger.debug(
+ "Can't send Find My Device request, because deviceInformationRecord.getId() is null!");
+ return;
+ }
+ bridgeHandler.findMyDevice(deviceInformationRecord.getId());
} catch (IOException | InterruptedException e) {
this.logger.warn("Unable to execute find my device request", e);
}
private @Nullable ICloudDeviceInformation getDeviceInformationRecord(
List<ICloudDeviceInformation> deviceInformationList) {
this.logger.debug("Device: [{}]", this.deviceId);
-
for (ICloudDeviceInformation deviceInformationRecord : deviceInformationList) {
String currentId = deviceInformationRecord.getDeviceDiscoveryId();
if (currentId == null || currentId.isBlank()) {