mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
Use device.Id instead of device.DiscoveryId to fix playsound (#16846)
Signed-off-by: Simon Spielmann <simon.spielmann@gmx.de> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
0838b6555f
commit
8d49b11556
@ -62,6 +62,8 @@ public class ICloudDeviceHandler extends BaseThingHandler implements ICloudDevic
|
|||||||
|
|
||||||
private @Nullable String deviceId;
|
private @Nullable String deviceId;
|
||||||
|
|
||||||
|
private @Nullable ICloudDeviceInformation deviceInformationRecord;
|
||||||
|
|
||||||
public ICloudDeviceHandler(Thing thing) {
|
public ICloudDeviceHandler(Thing thing) {
|
||||||
super(thing);
|
super(thing);
|
||||||
}
|
}
|
||||||
@ -70,6 +72,7 @@ public class ICloudDeviceHandler extends BaseThingHandler implements ICloudDevic
|
|||||||
public void deviceInformationUpdate(List<ICloudDeviceInformation> deviceInformationList) {
|
public void deviceInformationUpdate(List<ICloudDeviceInformation> deviceInformationList) {
|
||||||
ICloudDeviceInformation deviceInformationRecord = getDeviceInformationRecord(deviceInformationList);
|
ICloudDeviceInformation deviceInformationRecord = getDeviceInformationRecord(deviceInformationList);
|
||||||
if (deviceInformationRecord != null) {
|
if (deviceInformationRecord != null) {
|
||||||
|
this.deviceInformationRecord = deviceInformationRecord;
|
||||||
if (deviceInformationRecord.getDeviceStatus() == 200) {
|
if (deviceInformationRecord.getDeviceStatus() == 200) {
|
||||||
updateStatus(ONLINE);
|
updateStatus(ONLINE);
|
||||||
} else {
|
} else {
|
||||||
@ -137,12 +140,18 @@ public class ICloudDeviceHandler extends BaseThingHandler implements ICloudDevic
|
|||||||
if (channelId.equals(FIND_MY_PHONE)) {
|
if (channelId.equals(FIND_MY_PHONE)) {
|
||||||
if (command == OnOffType.ON) {
|
if (command == OnOffType.ON) {
|
||||||
try {
|
try {
|
||||||
final String deviceId = this.deviceId;
|
|
||||||
if (deviceId == null) {
|
if (deviceInformationRecord == null) {
|
||||||
this.logger.debug("Can't send Find My Device request, because deviceId is null!");
|
this.logger
|
||||||
|
.debug("Can't send Find My Device request, because deviceInformationRecord is null!");
|
||||||
return;
|
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) {
|
} catch (IOException | InterruptedException e) {
|
||||||
this.logger.warn("Unable to execute find my device request", e);
|
this.logger.warn("Unable to execute find my device request", e);
|
||||||
}
|
}
|
||||||
@ -183,7 +192,6 @@ public class ICloudDeviceHandler extends BaseThingHandler implements ICloudDevic
|
|||||||
private @Nullable ICloudDeviceInformation getDeviceInformationRecord(
|
private @Nullable ICloudDeviceInformation getDeviceInformationRecord(
|
||||||
List<ICloudDeviceInformation> deviceInformationList) {
|
List<ICloudDeviceInformation> deviceInformationList) {
|
||||||
this.logger.debug("Device: [{}]", this.deviceId);
|
this.logger.debug("Device: [{}]", this.deviceId);
|
||||||
|
|
||||||
for (ICloudDeviceInformation deviceInformationRecord : deviceInformationList) {
|
for (ICloudDeviceInformation deviceInformationRecord : deviceInformationList) {
|
||||||
String currentId = deviceInformationRecord.getDeviceDiscoveryId();
|
String currentId = deviceInformationRecord.getDeviceDiscoveryId();
|
||||||
if (currentId == null || currentId.isBlank()) {
|
if (currentId == null || currentId.isBlank()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user