UNPKG

homebridge-broadlink-rm-pro

Version:

Broadlink RM plugin (including the mini and pro) for homebridge with AC Pro and TV features

36 lines (26 loc) 832 B
const path = require('path'); const nodePersist = require('node-persist'); const init = ({ homebridgeDirectory, homebridge }) => { if (!homebridgeDirectory) { homebridgeDirectory = homebridge.user.storagePath() } nodePersist.initSync({ dir: `${homebridgeDirectory}/plugin-persist/homebridge-broadlink-rm`, forgiveParseErrors: true }); } const clear = ({ host, name }) => { if (!host) {host = 'default';} return nodePersist.removeItemSync(`${host}-${name}`); } const load = ({ host, name }) => { if (!host) {host = 'default';} return nodePersist.getItemSync(`${host}-${name}`); } const save = ({ host, name, state }) => { if (!host) {host = 'default';} return nodePersist.setItemSync(`${host}-${name}`, state); } module.exports = { init, clear, load, save };