homebridge-freeathome-local-api
Version:
Control your free@home setup using the local API provided by your System Access Point
18 lines • 804 B
JavaScript
import { isChannel, isDevice, } from "freeathome-local-api-client";
/**
* Determines whether the specified accessory is a free@home accessory.
* @param accessory The accessory to be tested
* @param logger {Logger} The logger instance to be used.
* @returns {boolean} A value indicating whether the specified object is a free@home accessory.
*/
export function isFreeAtHomeAccessory(accessory, logger) {
const keys = Object.keys(accessory.context);
const hasKeys = keys.includes("device") &&
keys.includes("deviceSerial") &&
keys.includes("channel") &&
keys.includes("channelId");
return (hasKeys &&
isChannel(accessory.context.channel, logger) &&
isDevice(accessory.context.device, logger));
}
//# sourceMappingURL=freeAtHomeContext.js.map