Tutorial: Own openhab-cloud and GCM / notifications (Firebase)

Hi all,

I had trouble setting up push notifications for the out of the box openhab app for Android, using my own own openhab-cloud installation (installed on local Linux ARM device). From the community I received some help (special thanks to @Felix_Raetz) and this is how I got it working:

  1. Login to firebase (the new name for GCM)
    https://firebase.google.com/

Remark: As you use an Android phone, you probably have already a google account in place. You can use this account or create a new one.

  1. Move to the console
    https://console.firebase.google.com/

  2. add a new project and assign a name of your choice (not sure if it’s important to set the correct region, but I selected Germany for myself)

  3. Click on “add Firebase to your Android app”
    android

  4. Enter any dummy package name like bla.bla and click on register App button (afterwards some more hints will be shown in the popup window, just close it)

  5. Click on the three dots followed by Settings

  6. Select the cloud messaging tab

  7. copy / paste the server key (=password) and sender id (=jid) to your config file (see next step).
    Important: Please note that you will need to add @gcm.googleapis.com to your sender id (people have reported that @googleapis.com works as well for them, but I use it with the gcm subdomain)

  8. Open your config file and make the required changes
    config2
    I installed openhab-cloud to /opt/openhab-cloud and my config file is config.json. Paste the copied values and don’t forget to add @gcm.googleapis.com to the sender id (=jid)

  9. when starting openhab-cloud on your server the log (in my case /var/log/syslog) should show:
    info: openHAB-cloud: Initializing XMPP connection to GCM
    and a few lines down
    info: openHAB-cloud: GCM XMPP connection is online

best regards

Stefan

10 Likes

Hi Stefan, I followed your instructions but I do not see the log message ‘GCM XMPP connection is online’

Can you please assist?

sorry, but I’m not an expert. If it doesn’t work (anymore) using the instructions above, I’m lost :-/

No trouble, we got it working.

would be great if you could share your findings with the forum

I didnt actually solve it :frowning: Tr1cks, Pavel on the forum did

Hello,

Please let me know if I should install something else then myOpenhab Cloud Connector form PAPER UI. I ask you this because I don’t find the file config.json nor
opt/openhab-cloud/

Thank you,
Marian

phew… long time ago :wink: Meanwhile I have switched to myopenhab.org because I like to control my devices via google assistant.

For now I can just assume that I downloaded openhab cloud from here:

So I was able to choose the install dir on my own. No clue what happens if you install via PaperUI. Anyway, it should be somewhere on your system :wink:

Stefan

Hi all,

as of today, I can confirm that the tutorial still works, even though the firebase-website has undergone a layout “upgrade”…

System

  • openHAB-Cloud 1.0.5
  • openHAB 2.4.0
2 Likes

Hello, who send push notifications to IOS? How can I get certificates?

Just to confirm that this tutorial is still valid today (12th december 2020), even if the Firebase interface is a bit different now… but the main concepts are still the same.
Nevertheless, my log file is inside /opt/openhabcloud/logs and not inside /var/log/syslog.

1 Like

I’m struggeling with the new user interface of Firebase, and the deprecation of the cloud Messaging API.

Could someone please help me and tell me, how to get the jid and password for the config.json?

The user interface looks as following:

EDIT: I found out, that you can enable the Cloud messagaging API (legacy) by clicking on the three dots right of it.

This post is old but i think it is still relevant for those who decides to use their own private OpenHab Cloud instance. I am having issue with the Android/IOS app, as the app complain the following which i capture through android studio debug. Does it mean the open source all from PlayStore or App Store can’t be used because they tied to openhab google-services.json?

E/FcmRegistrationWorker: FCM registration failed
java.io.IOException: FIS_AUTH_ERROR
at com.google.firebase.iid.GmsRpc.handleResponse(com.google.firebase:firebase-iid@@20.3.0:81)
at com.google.firebase.iid.GmsRpc.lambda$extractResponseWhenComplete$0$GmsRpc(com.google.firebase:firebase-iid@@20.3.0:91)
at com.google.firebase.iid.GmsRpc$$Lambda$0.then(Unknown Source:2)
at com.google.android.gms.tasks.zzc.run(com.google.android.gms:play-services-tasks@@18.0.1:3)
at com.google.firebase.iid.FirebaseIidExecutors$$Lambda$0.execute(Unknown Source:0)
at com.google.android.gms.tasks.zzd.zzd(com.google.android.gms:play-services-tasks@@18.0.1:1)
at com.google.android.gms.tasks.zzr.zzb(com.google.android.gms:play-services-tasks@@18.0.1:5)
at com.google.android.gms.tasks.zzw.zzb(com.google.android.gms:play-services-tasks@@18.0.1:3)
at com.google.android.gms.tasks.zzc.run(com.google.android.gms:play-services-tasks@@18.0.1:8)
at com.google.android.gms.cloudmessaging.zzz.execute(Unknown Source:0)
at com.google.android.gms.tasks.zzd.zzd(com.google.android.gms:play-services-tasks@@18.0.1:1)
at com.google.android.gms.tasks.zzr.zzb(com.google.android.gms:play-services-tasks@@18.0.1:5)
at com.google.android.gms.tasks.zzw.zzb(com.google.android.gms:play-services-tasks@@18.0.1:3)
at com.google.android.gms.tasks.TaskCompletionSource.setResult(com.google.android.gms:play-services-tasks@@18.0.1:1)
at com.google.android.gms.cloudmessaging.zzq.zza(com.google.android.gms:play-services-cloud-messaging@@16.0.0:9)
at com.google.android.gms.cloudmessaging.zzs.zza(com.google.android.gms:play-services-cloud-messaging@@16.0.0:7)
at com.google.android.gms.cloudmessaging.zzf.zza(com.google.android.gms:play-services-cloud-messaging@@16.0.0:45)
at com.google.android.gms.cloudmessaging.zzi.handleMessage(Unknown Source:2)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Hello.
I also set up a private cloud instance and activated the legacy API in Firebase for the usage for the android app. However, it states that the legacy API only works until June 20, 2024 and that the migration to the new API must take place by then.
Is there already a plan regarding this?

Best regards

Hi, We’re also interested in continuing to use push notifications on a private cloud instance.

What are the next steps for migrating to the new Firebase API? Should I open an issue on the OpenHAB-Cloud GitHub page? I’m also a full-stack developer for mobile applications, so I could contribute to this migration. However, I would need some guidance because this would be my first time contributing to open-source projects, and I’m not familiar with the process. Any advice on how to proceed would be greatly appreciated.

Hi,

I want to bring up the feature again. Are there any new news on the topic? I got an email, that the API will be removed at 20.06.2024. So in my opinion all instances of the cloud (myopenHAB included) are no longer able to deliver push notifications to Android devices.
Maybe there is an alternative approach: I know that Homeassistant also send push notifications to android devices without a cloud connection. Maybe it uses an Android API to send push notifications. So we could also do that for the android app?

Best regards