[openhab-cloud] unable to send notifications with new Firebase api

Hi,

I’m trying to use the new Firebase api since the old one isn’t working anymore.

I downloaded the latest openhab-cloud sources from github (main branch, not the latest release) and installed them with npm install.

I updated my old config.json:

"gcm" : {
      "senderId": "3xxxxxxxxx7",
      "serviceFile" : "serviceAccountKey.json"
    },

downloaded a serviceaccountkey.json from the google console: (“service accounts”, not sure what is sensitive or not)

{
  "type": "service_account",
  "project_id": "openhabcloud-70a4c",
  "private_key_id": "bxxxxxxxxxxxxxxxxxxxxxxxxxxxx13",
  "private_key": "-----BEGIN PRIVATE KEY-----\nXXXXXXXXXXXXXXXXXXXXXXXXX\n-----END PRIVATE KEY-----\n",
  "client_email": "firebase-adminsdk-xxxxx@openhabcloud-xxxxx.iam.gserviceaccount.com",
  "client_id": "1xxxxxxxxxxxxxxxxxxxx4",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-xxxxx%40openhabcloud-xxxxx.iam.gserviceaccount.com",
  "universe_domain": "googleapis.com"
}

and enabled the v1 api.

so far so good, I’m able to log in from my android app and everything is working as expected. but when I try to send a notification from openhab cloud / my devices or from a rule I get no notification and see the folowing error in my oh cloud logs:

info: FCM Response: {"responses":[{"success":false,"error":{"code":"messaging/mismatched-credential","message":"SenderId mismatch"}}],"successCount":0,"failureCount":1}

I’ve tried multiple service accounts (regenerate key), multiple re-installs of oh cloud, Loglevel debug doesnt give me more information.

Any suggestions? What am I missing? Any help is appreciated!

The issue may be due to changes Google has made to their Firebase SDK. You may have to compile the android app yourself along with your service account file for notifications to work on a private instance The production app is compiled using the myopenHAB.org services file, but we were using a deprecated way of circumventing this requirement that worked on private instances, but unfortunately , that no longer works now.

Awesome! that works!

After setting up the Android SDK and replacing the google-services.json with my own I was able to build an apk. After installing this apk on my devices I’m able to send (and receive) notifications again!

Thank you so much!

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.