forked from dgreif/ring
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ts
29 lines (25 loc) · 759 Bytes
/
config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { RingApiOptions } from '../api'
import { readFileSync, writeFileSync } from 'fs'
export interface RingPlatformConfig extends RingApiOptions {
alarmOnEntryDelay?: boolean
beamDurationSeconds?: number
hideLightGroups?: boolean
hideDoorbellSwitch?: boolean
hideCameraMotionSensor?: boolean
hideCameraSirenSwitch?: boolean
hideAlarmSirenSwitch?: boolean
showPanicButtons?: boolean
}
export function updateHomebridgeConfig(
homebridge: any,
update: (config: string) => string
) {
const configPath = homebridge.user.configPath(),
config = readFileSync(configPath).toString(),
updatedConfig = update(config)
if (config !== updatedConfig) {
writeFileSync(configPath, updatedConfig)
return true
}
return false
}