mirror of
https://github.com/tsightler/ring-mqtt.git
synced 2025-10-15 21:31:44 +08:00
Revert to standard ring-client-api
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import RingSocketDevice from './base-socket-device.js'
|
||||
import { RingDeviceType } from '@tsightler/ring-client-api'
|
||||
import { RingDeviceType } from 'ring-client-api'
|
||||
|
||||
export default class BeamOutdoorPlug extends RingSocketDevice {
|
||||
constructor(deviceInfo) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import RingSocketDevice from './base-socket-device.js'
|
||||
import { RingDeviceType } from '@tsightler/ring-client-api'
|
||||
import { RingDeviceType } from 'ring-client-api'
|
||||
|
||||
export default class BinarySensor extends RingSocketDevice {
|
||||
constructor(deviceInfo) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import RingSocketDevice from './base-socket-device.js'
|
||||
import { allAlarmStates, RingDeviceType } from '@tsightler/ring-client-api'
|
||||
import { allAlarmStates, RingDeviceType } from 'ring-client-api'
|
||||
import utils from '../lib/utils.js'
|
||||
import state from '../lib/state.js'
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import RingSocketDevice from './base-socket-device.js'
|
||||
import { RingDeviceType } from '@tsightler/ring-client-api'
|
||||
import { RingDeviceType } from 'ring-client-api'
|
||||
import utils from '../lib/utils.js'
|
||||
|
||||
export default class Thermostat extends RingSocketDevice {
|
||||
|
@@ -5,8 +5,8 @@ import { fileURLToPath } from 'url'
|
||||
import { readFile } from 'fs/promises'
|
||||
import writeFileAtomic from 'write-file-atomic'
|
||||
import { createHash, randomBytes } from 'crypto'
|
||||
import { RingRestClient } from '@tsightler/ring-client-api/rest-client'
|
||||
import { requestInput } from './node_modules/@tsightler/ring-client-api/lib/util.js'
|
||||
import { RingRestClient } from 'ring-client-api/rest-client'
|
||||
import { requestInput } from './node_modules/ring-client-api/lib/util.js'
|
||||
|
||||
async function getRefreshToken(systemId) {
|
||||
let generatedToken
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { RingApi, RingDeviceType, RingCamera, RingChime, RingIntercom } from '@tsightler/ring-client-api'
|
||||
import { RingApi, RingDeviceType, RingCamera, RingChime, RingIntercom } from 'ring-client-api'
|
||||
import chalk from 'chalk'
|
||||
import utils from './utils.js'
|
||||
import go2rtc from './go2rtc.js'
|
||||
@@ -125,12 +125,6 @@ export default new class RingMqtt {
|
||||
state.updateToken(newRefreshToken)
|
||||
this.updatePushToken()
|
||||
})
|
||||
|
||||
this.client.onNewPushCredentials.subscribe((credentials) => {
|
||||
debug('Recevied updated push credentials')
|
||||
state.updatePushCredentials(credentials)
|
||||
})
|
||||
|
||||
} catch(error) {
|
||||
this.client = false
|
||||
debug(chalk.yellowBright(error.message))
|
||||
|
@@ -74,17 +74,11 @@ export default new class State {
|
||||
}
|
||||
|
||||
updateToken(newRefreshToken) {
|
||||
debug('Saving refresh token to state file')
|
||||
debug('Saving updated refresh token to state file')
|
||||
this.data.ring_token = newRefreshToken
|
||||
this.saveStateFile()
|
||||
}
|
||||
|
||||
updatePushCredentials(pushCredentials) {
|
||||
debug('Saving push credentials to state file')
|
||||
this.data.push_credentials = pushCredentials.newCredentials
|
||||
this.saveStateFile()
|
||||
}
|
||||
|
||||
setDeviceSavedState(deviceId, stateData) {
|
||||
this.data.devices[deviceId] = stateData
|
||||
this.saveStateFile()
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { RingRestClient } from '../node_modules/@tsightler/ring-client-api/lib/rest-client.js'
|
||||
import { RingRestClient } from '../node_modules/ring-client-api/lib/rest-client.js'
|
||||
import utils from './utils.js'
|
||||
import { dirname } from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
Reference in New Issue
Block a user