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.
38 lines • 1.14 kB
JavaScript
import { PLATFORM_NAME, PLUGIN_NAME } from '../settings.js';
import { resolve as DnsResolve } from 'dns';
/**
* An async wait function that will wait for the specified number of milliseconds
*/
export async function wait(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
}
/**
* Combine the plugin info with the MAC Address of the panel to provide a good seed for a UUID
* @param id The MAC Address of the panel
* @returns The name to use to generate a UUID
*/
export function panelUUID(id) {
return `${PLUGIN_NAME}.${PLATFORM_NAME}.panel.${id}`;
}
export function checkNetwork() {
return new Promise((resolve) => {
DnsResolve('https://mob.yalehomesystem.co.uk', (err) => {
if (err && err.code === 'ENOTFOUND') {
resolve(false);
}
else {
resolve(true);
}
});
});
}
export function checkNetworkResponse() {
return new Promise((resolve) => {
DnsResolve('https://mob.yalehomesystem.co.uk', (err) => {
resolve(err);
});
});
}
//# sourceMappingURL=functions.js.map