ring icon indicating copy to clipboard operation
ring copied to clipboard

Motion/push events never reach HomeKit with push-receiver 4.3.0

Open TNOTA opened this issue 1 month ago • 27 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Describe The Bug

ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY because ring-client-api pins @eneris/push-receiver 4.3.0

Environment

homebridge-ring 14.3.0 (ring-client-api 14.3.0), Homebridge 2.4.0, Node v24.22.1, macOS Reproduced on two separate machines and Ring accounts.

Symptom

Ring app shows motion, but Homebridge never raises a motion event. HomeKit notifications and Apple TV camera pop-ups stop. Each push message produces this error in the log: Error: Public key is not valid for specified curve at ECDH.dhComputeSecret (node:internal/crypto/diffiehellman) at extractDH (http_ece/ece.js) at decrypt (@eneris/push-receiver/src/utils/decrypt.ts:34) at PushReceiver.#handleDataMessage (@eneris/push-receiver/src/client.ts:408) code: 'ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY'

Cause

ring-client-api pins @eneris/push-receiver to exactly 4.3.0. 4.3.0 strips dh= from FCM’s crypto-key header with slice(3). FCM now appears to send dh=KEY; p256ecdsa=SIG, so the signature suffix stays attached and the key is invalid. Every push fails to decrypt. This matches the upstream fix described in koush/ring PR #6, which references eneris/push-receiver#33. I haven’t independently verified when Google changed the format.

Not the fix: updating the top-level package

Installing @eneris/[email protected] at the top level of homebridge-ring/node_modules does nothing. ring-client-api loads its own pinned 4.3.0 copy, nested under ring-client-api/node_modules, so the stack trace still goes through 4.3.0.

Workaround that worked

Replace the nested ring-client-api/node_modules/@eneris/push-receiver with 4.4.0 and restart Homebridge. The errors stopped, “Detected Motion” appeared in the log, and Apple TV pop-ups returned. On one machine there was no nested copy, so I replaced the top-level one instead. This is a manual patch and will be overwritten by a plugin update.

Proposed fix

In ring-client-api, bump the @eneris/push-receiver dependency from 4.3.0 to 4.3.1 or later. 4.4.0 also contains the header fix. Consider using a caret range instead of an exact pin. Release ring-client-api, then bump it in homebridge-ring and release.

Note

4.4.0 also quietly drops messages it can’t decrypt, so this error won’t show up in logs there. That’s expected, not necessarily a sign of failure.

To Reproduce

No response

Expected behavior

Motion Events create pop-up on Apple TV equipped setups.

Relevant log output


Screenshots

No response

Homebridge Ring Config

{
  "refreshToken": "<REDACTED>",
  "alarmOnEntryDelay": false,
  "hideLightGroups": false,
  "hideDoorbellSwitch": true,
  "hideCameraLight": false,
  "hideCameraMotionSensor": false,
  "hideCameraSirenSwitch": false,
  "hideInHomeDoorbellSwitch": true,
  "hideAlarmSirenSwitch": true,
  "showPanicButtons": false,
  "avoidSnapshotBatteryDrain": false,
  "debug": false,
  "disableLogs": false,
  "hideDeviceIds": [
    "<REDACTED>",
    "<REDACTED>",
    "<REDACTED>"
  ],
  "platform": "Ring"
}

Additional context

No response

OS

MacOS 27.2

Node.js Version

24.22.1

NPM Version

12.2.1

Homebridge/HOOBs Version

2.4.0

Homebridge Ring Plugin Version

14.3.0

Operating System

MacOS

TNOTA avatar Oct 29 '26 14:10 TNOTA

I'm also seeing this error.

kylekrajnyak avatar Oct 30 '26 01:10 kylekrajnyak

I'm also seeing this error. Live view working but no motion events.

runjre avatar Oct 30 '26 03:10 runjre

Hit this too (homebridge-ring 14.3.0, Homebridge LXC on Proxmox). Can confirm swapping in push-receiver 4.4.0 fixes it, just wanted to add a couple of things.

The cause is in dist/utils/decrypt.js in 4.3.0. It pulls the key out of the crypto-key header with cryptoKey.value.slice(3), so it assumes the header is exactly dh=<key>. Looks like the headers coming through now have extra params on them (dh=...; p256ecdsa=...), so all that gets passed to ECDH as the public key and you get Public key is not valid for specified curve. 4.3.1+ parses the header properly.

Like the original post says, where the 4.3.0 copy lives depends on how npm laid things out. On my box there was no nested copy under ring-client-api/node_modules, it was at homebridge-ring/node_modules/@eneris/push-receiver (which is also the path in the stack trace). So I wrote a small script that asks node which copy ring-client-api actually loads and replaces that one, so you don't have to work out the layout yourself.

What it does:

  • finds homebridge-ring (checks /var/lib/homebridge, ~/.homebridge and the global npm folder, or you can pass the node_modules path)
  • resolves the push-receiver ring-client-api really uses
  • bails if it's already on 4.3.1 or newer
  • downloads 4.4.0 with npm pack, moves the old copy to your home dir as a backup, puts the new one in, keeps the file owner
  • checks it loads, rolls back if it doesn't

Save the script at the bottom as fix-ring-push-receiver.sh (have a read through it first) and run it from the Homebridge UI terminal or as root on the box (i've only tested running it via ssh directly).

bash fix-ring-push-receiver.sh --restart

or skip --restart and restart Homebridge yourself. If it can't find your install, pass the path: bash fix-ring-push-receiver.sh /path/to/node_modules.

After the restart I got a pile of "Ignoring push notification received in first two seconds after starting up" (the backlog coming through, decrypting fine now) and no more ECDH errors.

Usual caveat: this is a manual patch and updating/reinstalling homebridge-ring will put 4.3.0 back until ring-client-api bumps the dependency. The script prints an undo command, or just reinstall the plugin.

fix-ring-push-receiver.sh
#!/usr/bin/env bash
# Swaps the @eneris/push-receiver copy that ring-client-api actually loads
# for 4.4.0, which fixes "Public key is not valid for specified curve"
# (ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY) on push notifications.
#
# Usage: ./fix-ring-push-receiver.sh [path/to/node_modules] [--restart]
#
# Manual patch - a homebridge-ring update/reinstall will undo it.
set -euo pipefail

TARGET_VERSION=4.4.0
RESTART=0
NM_DIR=""

for arg in "$@"; do
  case "$arg" in
    --restart) RESTART=1 ;;
    -h|--help) sed -n '2,9p' "$0"; exit 0 ;;
    *) NM_DIR="$arg" ;;
  esac
done

# the official homebridge apt package keeps node here, not on the default PATH
[ -d /opt/homebridge/bin ] && export PATH="/opt/homebridge/bin:$PATH"
command -v node >/dev/null || { echo "can't find node, is homebridge installed?"; exit 1; }
command -v npm >/dev/null || { echo "can't find npm"; exit 1; }

# find the node_modules folder homebridge-ring lives in
if [ -z "$NM_DIR" ]; then
  for d in /var/lib/homebridge/node_modules "$HOME/.homebridge/node_modules" \
           "$(npm root -g 2>/dev/null)" /usr/local/lib/node_modules /usr/lib/node_modules; do
    if [ -n "$d" ] && [ -d "$d/homebridge-ring" ]; then NM_DIR="$d"; break; fi
  done
fi
if [ -z "$NM_DIR" ] || [ ! -d "$NM_DIR/homebridge-ring" ]; then
  echo "couldn't find homebridge-ring. pass the node_modules folder that contains it, e.g."
  echo "  $0 /var/lib/homebridge/node_modules"
  exit 1
fi
echo "homebridge-ring: $NM_DIR/homebridge-ring"

# ask node which push-receiver ring-client-api resolves to. it might be nested
# under ring-client-api, under homebridge-ring, or hoisted, depending on install
PR_DIR=$(cd "$NM_DIR/homebridge-ring" && node -e '
  const cut = (p, name) => p.slice(0, p.lastIndexOf("node_modules/" + name) + ("node_modules/" + name).length)
  const ring = cut(require.resolve("ring-client-api"), "ring-client-api")
  console.log(cut(require.resolve("@eneris/push-receiver", { paths: [ring] }), "@eneris/push-receiver"))
')
CURRENT=$(node -p "require('$PR_DIR/package.json').version")
echo "push-receiver in use: $PR_DIR ($CURRENT)"

# 4.3.1+ has the header fix, nothing to do if we're already there
if node -e '
  const [a, b] = process.argv.slice(1).map(v => v.split(".").map(Number))
  const d = a[0] - b[0] || a[1] - b[1] || a[2] - b[2]
  process.exit(d >= 0 ? 0 : 1)
' "$CURRENT" 4.3.1; then
  echo "already on $CURRENT, which has the fix. nothing to do."
  exit 0
fi

[ -w "$(dirname "$PR_DIR")" ] || { echo "no write access to $(dirname "$PR_DIR"), try again with sudo"; exit 1; }

TMP=$(mktemp -d)
trap 'rm -rf "$TMP"' EXIT
echo "downloading @eneris/push-receiver@$TARGET_VERSION..."
(cd "$TMP" && npm pack "@eneris/push-receiver@$TARGET_VERSION" --silent >/dev/null)
tar xzf "$TMP"/eneris-push-receiver-*.tgz -C "$TMP"
[ "$(node -p "require('$TMP/package/package.json').version")" = "$TARGET_VERSION" ] || { echo "download looks wrong, stopping"; exit 1; }

# keep the old copy outside node_modules so npm doesn't trip over it
OWNER=$(stat -c %u:%g "$PR_DIR" 2>/dev/null || stat -f %u:%g "$PR_DIR")
BACKUP="$HOME/push-receiver-$CURRENT-backup-$(date +%Y%m%d%H%M%S)"
mv "$PR_DIR" "$BACKUP"
cp -R "$TMP/package" "$PR_DIR"
chown -R "$OWNER" "$PR_DIR" 2>/dev/null || true

if ! node -e "require('$PR_DIR')" 2>/dev/null; then
  echo "new version won't load, putting the old one back"
  rm -rf "$PR_DIR"; mv "$BACKUP" "$PR_DIR"
  exit 1
fi

echo
echo "done: $CURRENT -> $TARGET_VERSION"
echo "old copy saved to $BACKUP"
echo "to undo: rm -rf '$PR_DIR' && mv '$BACKUP' '$PR_DIR'"

if [ "$RESTART" = 1 ]; then
  if command -v hb-service >/dev/null; then hb-service restart
  elif systemctl list-units --type=service 2>/dev/null | grep -q homebridge; then systemctl restart homebridge
  else echo "not sure how to restart on this setup, restart homebridge yourself"; fi
else
  echo "restart homebridge to pick it up (or rerun with --restart)"
fi

synsterky avatar Oct 31 '26 03:10 synsterky

Same issue here with same environment / versions. Above fix from @synsterky is working. Thanks so much!

Joburgal avatar Nov 01 '26 09:11 Joburgal

I applied the fix from @synsterky and the errors are gone. I am using the plugin just in combination with the Ring Intercom audio and still don’t get any notifications on my HomePods and the exposed button is not reacting. I then removed the Homebridge user from my Ring config, deinstalled the plugin and did a fresh install with immediately applying the patch again. After adding it back to my HomeKit configuration still the same result. Anyone else experiencing this?

CooperCGN avatar Nov 02 '26 10:11 CooperCGN

Confirming this also affects HOOBS 5, and the @eneris/push-receiver 4.4.0 fix from @synsterky works!

My setup:

  • HOOBS 5.1.8 on Raspberry Pi
  • homebridge-ring 14.3.0
  • Node.js 20.19.1
  • @eneris/push-receiver 4.3.0

I was getting Public key is not valid for specified curve errors, and Ring motion events had stopped triggering my HomeKit automations and Apple TV camera notifications.

After manually upgrading the affected dependency to 4.4.0, my Apple TV notifications started working again.

For HOOBS users, here’s what worked for me:

First, SSH into your HOOBS device and identify the push-receiver copy actually used by your Ring bridge.

My active Ring installation was located at:

/var/lib/hoobs/ringbridge2/node_modules/homebridge-ring

From that directory, I used Node’s module resolution to identify the dependency:

cd /var/lib/hoobs/ringbridge2/node_modules/homebridge-ring
node - <<'NODE'
const path = require('path');
const ringPath = require.resolve('ring-client-api');
const ringDir = path.dirname(ringPath);
const receiverPath = require.resolve('@eneris/push-receiver', {
  paths: [ringDir]
});
const receiverDir = receiverPath.substring(
  0,
  receiverPath.indexOf('/@eneris/push-receiver/') +
  '/@eneris/push-receiver'.length
);
console.log('Push receiver:', receiverDir);
console.log('Version:', require(path.join(receiverDir, 'package.json')).version);
NODE

In my installation, this resolved to:

/var/lib/hoobs/ringbridge2/node_modules/ring-client-api/node_modules/@eneris/push-receiver

The installed version was 4.3.0.

I stopped my Ring bridge in HOOBS, then ran the following commands over SSH:

IMPORTANT: Replace PR_DIR with the actual path returned by the previous check. Don’t assume your bridge is named ringbridge2.

set -e

PR_DIR="/var/lib/hoobs/ringbridge2/node_modules/ring-client-api/node_modules/@eneris/push-receiver"
BACKUP="/var/lib/hoobs/ringbridge2/push-receiver-4.3.0-backup"

# Verify affected version
node -e "if (require('$PR_DIR/package.json').version !== '4.3.0') process.exit(1)"

# Back up original dependency
sudo cp -a "$PR_DIR" "$BACKUP"

# Download fixed version
TMP=$(mktemp -d)
(cd "$TMP" && npm pack @eneris/[email protected] --silent)

# Extract and install
tar -xzf "$TMP"/eneris-push-receiver-*.tgz -C "$TMP"
sudo cp -a "$TMP/package/." "$PR_DIR/"

# Verify installed version
node -p "require('$PR_DIR/package.json').version"

rm -rf "$TMP"

The final command should output 4.4.0.

After restarting the Ring bridge through the HOOBS interface, my Apple TV camera notifications immediately started working again.

A couple of notes:

  • This is a manual dependency patch, not an official HOOBS fix.
  • Back up the original dependency before changing anything.
  • Updating or reinstalling the Ring plugin may overwrite the fix.
  • I only modified the dependency used by my active Ring bridge, not the other copies installed elsewhere in HOOBS.
  • If your installed version is already 4.3.1 or newer, this particular patch shouldn’t be necessary.

Hopefully this helps anyone running Ring through HOOBS rather than standard Homebridge!

jimmyfisher avatar Nov 02 '26 16:11 jimmyfisher

Used this fix and now the live video feed is showing on my Apple TV when there is motion! Thank you!!

Noeebar avatar Nov 05 '26 21:11 Noeebar

I have this same issue running on Home Assistant OS

dcox1696 avatar Nov 06 '26 15:11 dcox1696

Can confirm the above fix from @synsterky worked for me too. Running the latest Homebridge docker container on a RPi 4b.

dfinstein avatar Nov 06 '26 18:11 dfinstein

Any timeline on when this update will be released?

tr1um9h avatar Nov 08 '26 22:11 tr1um9h

Applied the fix and now notifications are coming through and my exterior lights are working on motion again. Thanks @synsterky

JeffFlowerday avatar Nov 09 '26 13:11 JeffFlowerday

I tried this and the receiver version is 4.4.0 but still not working

tr1um9h avatar Nov 10 '26 19:11 tr1um9h

I tried this and the receiver version is 4.4.0 but still not working

Have you tried deleting all your devices in the Ring Control Center and re-authenticated the Ring Plug-in?

JeffFlowerday avatar Nov 10 '26 22:11 JeffFlowerday

I generated a new refresh token yes

tr1um9h avatar Nov 10 '26 22:11 tr1um9h

I'm using Homebridge v2.5.0 with Home Bridge-Ring v14.3.0 I updated both instances of push-receiver from version 4.3.0 to 4.4.0 I then restarted homebridge, then restarted Homebridge Ring child bridge and refreshed the token Finally deleted all devices from Ring App; Control Centre; Authorized Client Devices. I then re authorized home-bridge ring and again restarted homebridge HomeKit has still not received any Ring Doorbell Motion Notifications. I'm hoping for a new version of Homebridge Ring with this bug fixed.

RWSmitty avatar Nov 11 '26 20:11 RWSmitty

I tried one last time generating a new token for Ring v14.3, and restarting the Ring Child Bridge, and then restarting HomeBridge and Eureka Push notifications are working again. Fantastic ! Thank-you to TNOTA and @synsterky for identifying the problem and the fix.

RWSmitty avatar Nov 11 '26 21:11 RWSmitty

The push-receiver 4.4.0 fix on a standalone app consuming ring-client-api 14.3.0 worked. I did need to add an npm overrides due to the 4.3.0 pin. I did not need to regen a token.

Motion pushes weren't working on 4.3.0, and after the fix motion events came through normally.

Thanks for the fix!

matthew-jones-uk avatar Nov 13 '26 21:11 matthew-jones-uk

does the Ring Plugin update v14.3.0 → v15.0.0-beta.0 include push-receiver 4.4.0 ?

RWSmitty avatar Nov 14 '26 14:11 RWSmitty

I have installed the 15.0.0-beta.0 - and it fixed it...

drheck avatar Nov 17 '26 21:11 drheck

I just tried the beta and I'm still not receiving push notifications I re-authenticated made sure to check that notifications are on in the home app

tr1um9h avatar Nov 20 '26 16:11 tr1um9h