UNPKG

@koush/ring-client-api

Version:

Unofficial API for Ring doorbells, cameras, security alarm system and smart lighting

32 lines (31 loc) 1.53 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); require("dotenv/config"); const api_1 = require("../api"); const util_1 = require("../api/util"); function example() { return __awaiter(this, void 0, void 0, function* () { const ringApi = new api_1.RingApi({ refreshToken: process.env.RING_REFRESH_TOKEN, debug: true, }), [location] = yield ringApi.getLocations(), [chime] = location.chimes, newRingtone = yield chime.getRingtoneByDescription('Triangle', 'ding'); yield chime.updateChime({ settings: { ding_audio_id: newRingtone.id, ding_audio_user_id: newRingtone.user_id, }, }); yield chime.playSound('ding'); yield chime.playSound('motion'); }); } example().catch(util_1.logError);