homebridge-yale-sync-keypad
Version:
A pluign to connect to your Yale Sync Alarm account and allow you to change the alarm state using Homekit. Motion sensors are not supported, due to the fact that they are only active when the alarm is set to away.
53 lines (52 loc) • 2.48 kB
TypeScript
import { type PlatformAccessory } from 'homebridge';
import type { YaleSyncKeypadPlatform } from './platform.js';
/**
* NOTES:
*
* if you need to return an error to show the device as "Not Responding" in the Home app:
* throw new this.platform.api.hap.HapStatusError(this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE);
*/
/**
* An instance of this class is created for each panel accessory your platform registers.
* TODO: Add a button to this accessory to trigger the alarm by adding an onclick event to send the trigger request to the Yale Sync API
*/
export declare class AlarmSystemPlatformAccessory {
private readonly platform;
readonly accessory: PlatformAccessory;
private service;
constructor(platform: YaleSyncKeypadPlatform, accessory: PlatformAccessory);
/**
* Get the current state of the alarm system by fetching the state from the Yale Sync API
*/
private getCurrentState;
/**
* Get the target state of the alarm system by fetching the state from the Yale Sync API
* @param showLogs Whether to show logs or not. Default is true. - The logs are disabled for the lifecycle (as long as it hasn't been more than 10 minutes)
*/
getTargetState(showLogs?: boolean): Promise<void>;
/**
* Use the same function for getting the current state and the target state of the alarm system
* Get the current state of the panel by sending a request to the Yale Sync API.
* Return it so that we can update the cached value in the accessory context
* @param cachedValue An object to store whether the value was fetched from the api or from the cache
* @returns The state of the alarm system
*/
private getPanelStateFromYaleApi;
/**
* Change the state of the alarm system by sending a request to the Yale Sync API after converting the HAP state to the Yale Sync state
* @param value The target state of the alarm system (HAP state)
*/
private setTargetState;
/**
* Convert the state of the panel (retrieved from Yale Sync API) to the HAP state
* @param state The state on the panel retrieved from the Yale Sync API
* @returns The HAP state to be displayed in the Home app
*/
private stateTranslateYaleToHAP;
/**
* Convert the state of the panel (retrieved from HAP) to the Yale Sync state
* @param state The HAP state
* @returns The Yale Sync state
*/
private stateTranslateHAPToYale;
}