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