openhab / openhab-ios

The repository of the iOS client
Eclipse Public License 2.0
193 stars 128 forks source link

"You currently have no devices registered with openHAB Cloud." for a private instance of openhab-cloud #592

Open kgoderis opened 4 years ago

kgoderis commented 4 years ago

I see the above behaviour (in openhab-cloud) when using the iOS client, but first of all, I am posting the issue here as similar issues for other people using Android where found to be linked to the Android client.

I run a private instance of openhab-cloud at myhost.mydomain.be, exposing ports 443 and 80, and in which a user is properly defined. When configuring the iOS client with that username and pwd, and then setting both the local and remote url to "https://myhost.mydomain.be", then the client can fetch the sitemap and all of the underlying openhab instance, but the client does not register the UUID at the openhab-cloud instance. the openhab instance is running on the same host, with different http and https ports obviously

Leaving the local url empty, and connecting using 4G instead of Wifi results in the same. Adding a trailing "/" does not change anything either

Lastly, I remember seeing some post somewhere with screenshots and so describing the process to recompile the iOS app in order to generate an app Id on order to get apple dev certificates. Does anyone know by any chance the url of that post? I can simply not find it back, google is not my friend here :-(

weakfl commented 4 years ago

Take a look at #407 for a similar feature request.

What happens is that the App is sending the device information (containing the APNS device token) to your private instance. Check your request logs and you should see a request to the endpoint /addAppleRegistration.

You'd have to handle device registration and sending notifications on your instance. Maybe it's possible to setup APNS on your private instance (given that you have a developer account to generate the required APNS authentication key), but you'll have to ask that at the openhab/openhab-cloud repo.

I'm not sure how this should/could be handled in the app. I don't think it's possible to set up more than one 'openHAB Cloud Connector' Add-on so how would you trigger notifications within rules?

kgoderis commented 4 years ago

@weakfl Tx. The important message here is that the APN certificates are required to get the devices registered, not only for sending out notifications from the OH instance.

On a separate note, what is not clear in all the recipes describing the private solution, in case the iOS app is recompiled, do you need an instance of that binary on your iPhone, or does it work with the App Store instance. My impression is that you only need to compile it to get an AppId to feed into the certification generation. If it would work with the stock app, how notifications will arrive and be badged, given that one would not have an app with the generated AppId installed on the receiving iPhone.

weakfl commented 4 years ago

On a separate note, what is not clear in all the recipes describing the private solution, in case the iOS app is recompiled, do you need an instance of that binary on your iPhone, or does it work with the App Store instance. My impression is that you only need to compile it to get an AppId to feed into the certification generation.

You'll need your own app version as the device token is bound to the bundle id.