iCloud binding: Can´t use "findMyPhone" channel

Hi there,

i´m currently making a oH 1.8.3 to oH 2 migration and had first look on the iCloud binding.
As we´re only using iOS devices this is a pretty nice feature to work with.
But there´s some part that´s not working.

iCloud.things

Bridge icloud:account:openHAB [appleId="openhab@mydomain.com", password="HighSecurityPassword", refreshTimeInMinutes=30]
{
  Thing device iPUserA "UserA iPhone" [deviceId="SomeDeviceIDforUserA"]
  Thing device iPUserB "UserB iPhone" [deviceId="SomeDeviceIDforUserB"]
  Thing device iPGuest "Guest iPhone" [deviceId="SomeDeviceIDfortheGuest"]
  Thing device iPBusiness "Business" [deviceId="SomeDeviceIDfortheBusiness"]
}

iCloud.items (example with UserB)

String iPUserB_BatteryStatus "Ladestatus [%s]" <battery> (iPhones) {channel="icloud:device:openHAB:iPUserB:batteryStatus"}
Number iPUserB_BatteryLevel "Akku [%d %%]" <battery> (iPhones) {channel="icloud:device:openHAB:iPUserB:batteryLevel"}
Switch iPUserB_FindMyPhone "Find my Phone" (iPhones) {channel="icloud:device:openHAB:iPUserB:findMyPhone", autoupdate="false"}
Switch iPUserB_Refresh "Update erzwingen" (iPhones) {channel="icloud:device:openHAB:iPUserB:location", autoupdate="false"}
Location iPUserB_Location "Ort" (iPhones) {channel="icloud:device:openHAB:iPUserB:location"}
Number iPUserB_Accuracy "Genauigkeit" (iPhones) {channel="icloud:device:openHAB:iPUserB:locationAccuracy"}
DateTime iPUserB_LastUpdate "Letztes Update [%1$td.%1$tm.%1$tY, %1$tH:%1$tM]" (iPhones) {channel="icloud:device:openHAB:iPUserB:locationLastUpdate"}

default.sitemap

			Text item=fbUserB valuecolor=[OPEN="green", CLOSED="gray"]
			{
				Text item=iPUserB_BatteryStatus
				Text item=iPUserB_BatteryLevel
				Switch item=iPUserB_FindMyPhone mappings=[ ON="Suchen!" ]
				Text item=iPUserB_Accuracy
				Text item=iPUserB_LastUpdate
				Mapview item=iPUserB_Location
				Switch item=iPUserB_Refresh mappings=[ REFRESH='Aktualisieren' ]
			}

When using the FindMyPhone button i get the following error in my logfile

2018-07-15 12:15:39.530 [ome.event.ItemCommandEvent] - Item 'iPUserB_FindMyPhone' received command ON

==> /var/log/openhab2/openhab.log <==

2018-07-15 12:15:40.988 [WARN ] [g.icloud.handler.ICloudDeviceHandler] - Unable to execute find my device request

java.io.IOException: Server returned HTTP response code: 500 for URL: https://fmipmobile.icloud.com/fmipservice/device/openhab@mydomain.com/playSound

	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894) [?:?]

	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492) [?:?]

	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263) [?:?]

	at org.openhab.binding.icloud.internal.Connection.getResponse(Connection.java:107) [236:org.openhab.binding.icloud:2.3.0]

	at org.openhab.binding.icloud.internal.Connection.postRequest(Connection.java:97) [236:org.openhab.binding.icloud:2.3.0]

	at org.openhab.binding.icloud.internal.Connection.findMyDevice(Connection.java:69) [236:org.openhab.binding.icloud:2.3.0]

	at org.openhab.binding.icloud.handler.ICloudAccountBridgeHandler.findMyDevice(ICloudAccountBridgeHandler.java:107) [236:org.openhab.binding.icloud:2.3.0]

	at org.openhab.binding.icloud.handler.ICloudDeviceHandler.handleCommand(ICloudDeviceHandler.java:95) [236:org.openhab.binding.icloud:2.3.0]

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]

	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [101:org.eclipse.smarthome.core:0.10.0.oh230]

	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [101:org.eclipse.smarthome.core:0.10.0.oh230]

	at com.sun.proxy.$Proxy135.handleCommand(Unknown Source) [236:org.openhab.binding.icloud:2.3.0]

	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [108:org.eclipse.smarthome.core.thing:0.10.0.oh230]

	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [108:org.eclipse.smarthome.core.thing:0.10.0.oh230]

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]

	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [101:org.eclipse.smarthome.core:0.10.0.oh230]

	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [101:org.eclipse.smarthome.core:0.10.0.oh230]

	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

	at java.lang.Thread.run(Thread.java:748) [?:?]

==> /var/log/openhab2/events.log <==

2018-07-15 12:15:41.023 [vent.ItemStateChangedEvent] - iPUserB_FindMyPhone changed from NULL to OFF

Is this a known bug in the binding or am i doing something wrong?
I sticked to the documentation from https://www.openhab.org/addons/bindings/icloud/

By the way: There´s a typo in the documentation.

"Battery Status [%s %%]"
"Battery Level [%.0f]"

Is has to be

"Battery Status [%s]"
"Battery Level [%d %%]"

Otherwise the item for Battery status shows “Not Loading %” and the Level item doesn´t show anything at all.

kind regards
Michael

I don’t know this binding or how it works, but I do know that a 500 HTTP code means forbidden. Is your username/password correct?

Yes the username/password combination is correct.
Otherwise oH wouldn´t be able to get the informations from all other channels.
It´s just this one channel that isn´t working.

For example:
2018-07-16 19:12:10.756 [vent.ItemStateChangedEvent] - iPUserB_Accuracy changed from 24.0 to 48.0

@rlkoshak: Just for you i “just edited” the documentation.
It wasn´t just editing a textfile.

  1. You need a Github account
  2. You need to fork (forks belong in the kitchen)
  3. You need to make the changes
  4. You need to create Pull request
    These are four steps to edit a documentation. I don´t think that normal users will create a GitHub Account just to change the documentation. But you already heard that, i know…

Back to the problem…
Is this feature not supported anymore?

Find my iPhone works for me.
I don’t know if it’s the key, but in my items file I don’t use , autoupdate="false".

Have you configured “Find my iPhone” in the iCloud Settings of your device?

Sure i did…
That´s because all other channels of this binding works.
Only the ‘{channel=“icloud:device:openHAB:iPUserB:findMyPhone”, autoupdate=“false”}’ isn´t working.
All other channels like Battery Status/Level, Force Update, Location, Accucary and Last Update are working fine.

Even without ‘autoupdate=“false”’ i get the http 500 error.

Asking in another direction: What should the ‘findMyPhone’ channel do?

Bear in mind that “Find my iPhone” setting is a separate setting.

It plays a sound and shows a notification on your iDevice.

Just to clarify, you´re talking about:
Settings -> iCloud -> iCloud -> Find my Phone
Find my Phone - On / Off
Send last Location - On / Off

The other option is
Settings -> iCloud -> iCloud -> Share Location
Share Location - On / Off

Both settings are turned ‘On’ on all of the devices that are connected to the oH binding.

I just made a quick test.
Without the Find my Phone option you´re not able to receive any data from iCloud.
The option is required to get the data for all of the channels.

To answer that question again:

Yes, i did because otherwise i wouldn´t receive any data from the device at all.

No, the feature “Find my Phone” is required for all channels of this binding.

Ok, it was just a guess. Beside that I have no idea and I think you have triple checked all the channel ID.

Someone had the same problem.

Do you use one or more iCloud accounts or a iCloud account with family share?

That could be the problem.
I´m using a dedicated openHAB iCloud with family share.
The iOS devices are all linked to a iCloud account for the owner.
So there´s no account with all devices, just the family share.

Looks like the binding is only able to run “Find my Phone” when the device is directly attached to this account.
But how does it know which of the devices is meant?
In the log he´s only trying to open ‘https://fmipmobile.icloud.com/fmipservice/device/openhab@mydomain.com/playSound’ and not a specific device.

I think the family share account is very likely the problem. Maybe @patrik_gfeller could have a look at it and verify our assumption.

If you are making a small change to a page, the type of change I would expect most users like you would make, you can do it right in the browser.

Click on the file.

Click the pencil icon.

Make your changes.

Save the file and fill in the comment describing what you changed and signing off on the edit.

You do need a GitHub account.

You shouldn´t start getting personal and don´t say things from above like you did there.
You don´t know me.
But thanks that you didn´t even noticed that i made a change and created a pull request.
But hey i´m just the user saying the doc is shit and you´re the high qualified developer…

I guess we are both making assumptions. I’m not a developer on OH. I spend my time contributing to the project by helping users on this forum, mostly with Rules. I don’t do much with the Docs and I don’t do anything with the code. So I would’t have seen your PR.

And I said “like you” because you made it clear you are not a developer. I wouldn’t expect a non-developer to start out by making sweeping changes to the OH docs. That requires a lot more coordination and effort than could be expected from any new contributor, let alone a non-developer.

I guess I missed the day in class where they taught that using the word “you” is an insult.

I need to fork the doc before otherwise i´m not able to make changes:
You’re editing a file in a project you don’t have write access to. Submitting a change to this file will write it to a new branch in your fork bredmich/openhab2-addons, so you can send a pull request.
So no, it´s not just editing a page from the docs…

Get back to real question: Is the channel findMyPhone only usable when the iOS devices are directly attached to the account used for the Bridge.

Can I make a suggestion, not sure if you’ve tried this yet but here goes.

Try breaking this problem down into smaller chunks, build up to your end game. Have you reduced your configuration down to a single device and tested whether that works or not.

I have two iPhones, both are on separate accounts and they are working fine for me. I used the example in the docs to complete my configuration. You could have found genuine bug/issue or your trying to do something outside of the original scope the developer had in mind.

Regards,

Garry

I am using an iCloud family share.

And you‘re able to send an Sound with findMyPhone to alle attached iOS devices no matter on what account they‘re binded to?

I am able to play sounds on my wife’s phone using the native iOS app, as we are using a family share. I am not able to find her phone using the openhab iCloud binding. I can read her battery status, her location, but finding the phone only works on my own device.