matijse / eufy-ha-mqtt-bridge

Receive Eufy alerts and thumbnails in Home Assistant via MQTT
124 stars 25 forks source link

It looks like the registration at Google/Firebase for push is not always working... Not sure why. #78

Open MrYutz opened 3 years ago

MrYutz commented 3 years ago

I would like to help test this. It looks like the original app is on the spark plan and it only allows 10K registrations per month.

Once users have cached credentials, they can re-use them. Let's see if this fixes itself at the start of the new month - July in our case.

I completed a new install, and can't get past this error. I think you may be able to replace the firebase / GCM auth keys in the code to get a round this.

I am testing.

matijse commented 3 years ago

Thanks for testing, but yeah the FCM registration error occurs randomly but not clear why... Your theory sounds plausible, does it work now in July?

MrYutz commented 3 years ago

It does.

I also tested by swapping out all the credentials for a new firebase / GCM project. That worked as expected with no other code changes.

At this point, I think my theory is pretty solid. If the google firebase project gets more than 10K new auths or re-auths, it starts denying a new one. They are not included in the free plan.

Maybe the best approach is to allow creds for a new firebase project in the config file?

I'll post my test FCM test project config so you can test if you want to.

{
  "project_info": {
    "project_number": "246205401711",
    "project_id": "eufy-home-assistant",
    "storage_bucket": "eufy-home-assistant.appspot.com"
  },
  "client": [
    {
      "client_info": {
        "mobilesdk_app_id": "1:246205401711:android:f0b7dfb9d37aff7c319b9a",
        "android_client_info": {
          "package_name": "com.bustedcamel.homeassistant.eufy"
        }
      },
      "oauth_client": [
        {
          "client_id": "246205401711-gbgfbdu97pbmhm7ekui7t065a7l3k5uh.apps.googleusercontent.com",
          "client_type": 1,
          "android_info": {
            "package_name": "com.bustedcamel.homeassistant.eufy",
            "certificate_hash": "f051262f9f99b638f3c76de349830638555b4a0a"
          }
        },
        {
          "client_id": "246205401711-1b11901lptlp1rk7qth8a4u6pbijtkv3.apps.googleusercontent.com",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "AIzaSyDQCrOiuWNDumMw7fSDf2Bpyhspr3b9WGo"
        }
      ],
      "services": {
        "appinvite_service": {
          "other_platform_oauth_client": [
            {
              "client_id": "246205401711-1b11901lptlp1rk7qth8a4u6pbijtkv3.apps.googleusercontent.com",
              "client_type": 3
            }
          ]
        }
      }
    }
  ],
  "configuration_version": "1"
}
matijse commented 3 years ago

But then you would have the credentials for the "wrong" project, and you would not get the push notifications from Eufy right? The whole script depends on these push notifications, so that won't really be a solution then...

MrYutz commented 3 years ago

Yeah. You're right. I was down in the weeds figuring out why the auth was failing. I was not getting push notifications, but I think that is the root issue for the GCM error.

skrobul commented 2 years ago

Getting PHONE_REGISTRATION_ERROR each time when trying to start the application up. I have collected debug information in this gist - hope it helps with troubleshooting. My error message looks more like #3, but I guess it's related.

skrobul commented 2 years ago

btw, eufy-node-client is deprecated and the project's readme recommends using eufy-security-client instead. From brief skimming it looks like they handle FCM/GCM registration differently - is there anything that can be 'borrowed' from that code to make it work?