dgreif / ring

Unofficial packages for Ring Doorbells, Cameras, Alarm System, and Smart Lighting
MIT License
1.2k stars 163 forks source link

can't get devices list #1490

Closed belqit closed 2 weeks ago

belqit commented 2 weeks ago

Is there an existing issue for this?

Describe The Bug

i don't see my ring intercom in the devices list

To Reproduce


async function fetchRingDevices(refresh_token) {
  try {
    const ring_api = new RingApi({ refreshToken: refresh_token });

    console.log('Fetching locations...');
    const locations = await ring_api.getLocations();
    console.log(`Found ${locations.length} location(s)`);

    if (locations.length === 0) {
      console.error('No locations found in your Ring account');
      return;
    }

    const first_location = locations[0];
    console.log(`Using location: ${first_location.name}`);

    console.log('Fetching devices...');
    const devices = await first_location.getDevices();
    console.log(`Found ${devices.length} device(s)`);

  } catch (error) {
    console.error('Error:', error);
  }
}

fetchRingDevices('my refresh token');

Expected behavior

see my ring device

Relevant log output

Fetching locations...
Found 1 location(s)
Using location: myLocation
Fetching devices...
Found 0 device(s)

Screenshots

WhatsApp Image 2024-09-02 at 15 56 43

Additional context

No response

OS

ubuntu 22.04

Node.js Version

v18.20.3

NPM Version

10.7.0

ring-client-api

13.1.0

Operating System

ubuntu 22.04

dgreif commented 2 weeks ago

@belqit sorry for the confusing API here. getDevices is actually used to get devices which use hubs (e.g. Ring Alarm) to connect. Intercoms, cameras and chimes are all available directly on the location. I think what you are looking for is location.intercoms

belqit commented 2 weeks ago

thanks!

i'm getting this error but it works now

Register request has failed with Error=PHONE_REGISTRATION_ERROR Retry... 1

dgreif commented 2 weeks ago

PHONE_REGISTRATION_ERROR likely comes from the dependency we use to register for push notifications. Try following the steps in the Notifications wiki and hopefully that will make it go away 🤞