UNPKG

homebridge-gpio-sensor-door

Version:

Raspberry Pi GPIO Doorsensor plugin for Homebridge forked from homebridge-gpio-garagedoor-d

69 lines 2.5 kB
"use strict"; var Characteristic; class DoorStateExtension { static init(exportedTypes) { Characteristic = exportedTypes.Characteristic; } } exports.DoorStateExtension = DoorStateExtension; function getCurrentDoorState(service) { return service.getCharacteristic(Characteristic.CurrentDoorState).value; } exports.getCurrentDoorState = getCurrentDoorState; function getTargetDoorState(service) { return service.getCharacteristic(Characteristic.TargetDoorState).value; } exports.getTargetDoorState = getTargetDoorState; function asDoorState(targetState) { switch (targetState) { case Characteristic.TargetDoorState.OPEN: return Characteristic.CurrentDoorState.OPEN; case Characteristic.TargetDoorState.CLOSED: return Characteristic.CurrentDoorState.CLOSED; } } exports.asDoorState = asDoorState; function asOperationState(targetState) { switch (targetState) { case Characteristic.TargetDoorState.OPEN: return Characteristic.CurrentDoorState.OPENING; case Characteristic.TargetDoorState.CLOSED: return Characteristic.CurrentDoorState.CLOSING; } } exports.asOperationState = asOperationState; function getCurrentDoorStateDescription(doorState) { switch (doorState) { case Characteristic.CurrentDoorState.OPEN: return "OPEN"; case Characteristic.CurrentDoorState.OPENING: return "OPENING"; case Characteristic.CurrentDoorState.CLOSING: return "CLOSING"; case Characteristic.CurrentDoorState.CLOSED: return "CLOSED"; case Characteristic.CurrentDoorState.STOPPED: return "STOPPED"; } } exports.getCurrentDoorStateDescription = getCurrentDoorStateDescription; function getTargetDoorStateDescription(doorState) { switch (doorState) { case Characteristic.TargetDoorState.OPEN: return "OPEN"; case Characteristic.TargetDoorState.CLOSED: return "CLOSED"; case Characteristic.CurrentDoorState.STOPPED: return "STOPPED"; } } exports.getCurrentDoorStateDescription = getCurrentDoorStateDescription; function getTargetDoorStateDescription(doorState) { switch (doorState) { case Characteristic.TargetDoorState.OPEN: return "OPEN"; case Characteristic.TargetDoorState.CLOSED: return "CLOSED"; } } exports.getTargetDoorStateDescription = getTargetDoorStateDescription;