Need help using api-ring #677
Unanswered
multinet33
asked this question in
Q&A
Replies: 1 comment 3 replies
-
Could you elaborate on your current setup for running the example? Did you clone the |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello
I've installed homebridge UI and homebridge ring pluging : all is OK
I've a token
Now I try to interact with my RING alarm using TS bug I get error when executing sample scripts :
here is a script I want to run :
`import 'dotenv/config'
import { RingApi } from 'ring-client-api'
async function example() {
const { env } = process,
ringApi = new RingApi({
// Replace with your refresh token
refreshToken: "here is my token*",
}),
locations = await ringApi.getLocations(),
location = locations[0],
cameras = await ringApi.getCameras(),
camera = cameras[0]
// Locations API
location.onConnected.subscribe((connected) => {
const state = connected ? 'Connected' : 'Connecting'
console.log(
${state} to location ${location.name} - ${location.id}
)})
const locationCameraEvents = await location.getCameraEvents({
// same params as camera.getEvents
}),
locationAlarmEvents = await location.getHistory({
limit: 1,
category: 'alarm',
//offset: 100 - number of events to skip over for pagination
}),
locationBeamsEvents = await location.getHistory({
limit: 1,
category: 'beams',
})
console.log('Location Camera Event', locationCameraEvents.events[0])
console.log('Location Alarm Event', locationAlarmEvents[0])
console.log('Location Beams Event', locationBeamsEvents[0])
console.log('Monitoring Status', await location.getAccountMonitoringStatus())
// Camera API
const eventsResponse = await camera.getEvents({
limit: 10,
kind: 'ding',
state: 'accepted',
// olderThanId: previousEventsResponse.meta.pagination_key
// favorites: true
})
console.log('Got events', eventsResponse.events[0])
const eventsWithRecordings = eventsResponse.events.filter(
(event) => event.recording_status === 'ready'
),
transcodedUrl = await camera.getRecordingUrl(
eventsWithRecordings[0].ding_id_str, // MUST use the ding_id_str, not ding_id
{
transcoded: true, // get transcoded version of the video. false by default. transcoded has ring log and timestamp
}
),
untranscodedUrl = await camera.getRecordingUrl(
eventsWithRecordings[0].ding_id_str
)
console.log('Recording Transcoded URL', transcodedUrl)
console.log('Recording Untranscoded URL', untranscodedUrl)
}
example()
`
and that is the error I get :
root@odroid-stretch64:~# tsc api-example.ts
node_modules/@homebridge/camera-utils/lib/return-audio-transcoder.d.ts:3:38 - error TS2307: Cannot find module 'homebridge' or its corresponding type declarations.
3 import { PrepareStreamRequest } from 'homebridge';
~~~~~~~~~~~~
node_modules/ring-client-api/lib/api/location.d.ts:47:30 - error TS2503: Cannot find namespace 'SocketIOClient'.
47 getConnection(): Promise<SocketIOClient.Socket>;
~~~~~~~~~~~~~~
Found 2 errors.
Can you help me
Thanks a lot
Beta Was this translation helpful? Give feedback.
All reactions