homebridge-resideo
Version:
The Resideo plugin allows you to access your Resideo device(s) from HomeKit.
58 lines (56 loc) • 1.84 kB
JavaScript
/* Copyright(C) 2022-2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
*
* util.ts: homebridge-resideo platform class.
*/
/**
* Converts the value to celsius if the temperature units are in Fahrenheit
*/
export function toCelsius(value, unit) {
if (unit === 0) {
return value;
}
// celsius should be to the nearest 0.5 degree
return Math.round((5 / 9) * (value - 32) * 2) / 2;
}
/**
* Converts the value to fahrenheit if the temperature units are in Fahrenheit
*/
export function toFahrenheit(value, unit) {
if (unit === 0) {
return value;
}
return Math.round((value * 9) / 5 + 32);
}
// Map HomeKit Modes to Resideo Modes
export var HomeKitModes;
(function (HomeKitModes) {
HomeKitModes[HomeKitModes["Off"] = 0] = "Off";
HomeKitModes[HomeKitModes["Heat"] = 1] = "Heat";
HomeKitModes[HomeKitModes["Cool"] = 2] = "Cool";
HomeKitModes[HomeKitModes["Auto"] = 3] = "Auto";
})(HomeKitModes || (HomeKitModes = {}));
// Don't change the order of these!
export var ResideoModes;
(function (ResideoModes) {
ResideoModes["Off"] = "Off";
ResideoModes["Heat"] = "Heat";
ResideoModes["Cool"] = "Cool";
ResideoModes["Auto"] = "Auto";
})(ResideoModes || (ResideoModes = {}));
;
/*
export enum holdModes {
NoHold = 0, //this.hap.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS
TemporaryHold = 1, //this.hap.Characteristic.ProgrammableSwitchEvent.DOUBLE_PRESS
PermanentHold = 2, //this.hap.Characteristic.ProgrammableSwitchEvent.LONG_PRESS
}
export enum fanModes {
Auto = 0, //this.hap.Characteristic.TargetFanState.AUTO
On = 1, //this.hap.Characteristic.TargetFanState.ON
}
export type resideoHold = {
NoHold: 'NoHold',
TemporaryHold: 'TemporaryHold',
PermanentHold: 'PermanentHold'
}; */
//# sourceMappingURL=utils.js.map