@george.talusan/homebridge-eufy-robovac
Version:
Homebridge Plugin for Eufy Robovac
67 lines (66 loc) • 2.55 kB
TypeScript
/**
* Error code mapping from eufy-robovac to Matter.js RVC ErrorState
*
* This module provides a mapping between eufy robovac error codes (both numeric and string-based)
* and Matter.js RvcOperationalState.ErrorState enum values.
*
* All mappings use standard Matter ErrorState enum (0x00-0x4E range).
* No manufacturer-specific codes are needed as all 21 unique device errors map cleanly to standard states.
*
* Note: Consumable alerts (S1-S8) are excluded from this mapping as they are maintenance warnings,
* not operational errors. They are emitted as 'alert' events and should be logged as warnings.
*/
/**
* Mapping of eufy error codes (numeric and string) to Matter ErrorState values
*/
export declare const EUFY_TO_MATTER_ERROR_MAP: Record<string | number, {
matterErrorStateId: number;
description: string;
}>;
/**
* Matter.js RvcOperationalState ErrorState enum values (for reference)
*/
export declare enum MatterErrorState {
NoError = 0,
UnableToStartOrResume = 1,
UnableToCompleteOperation = 2,
CommandInvalidInState = 3,
FailedToFindChargingDock = 64,
Stuck = 65,
DustBinMissing = 66,
DustBinFull = 67,
WaterTankEmpty = 68,
WaterTankMissing = 69,
WaterTankLidOpen = 70,
MopCleaningPadMissing = 71,
LowBattery = 72,
CannotReachTargetArea = 73,
DirtyWaterTankFull = 74,
DirtyWaterTankMissing = 75,
WheelsJammed = 76,
BrushJammed = 77,
NavigationSensorObscured = 78
}
/**
* Consumable alert codes that should be logged as warnings, not mapped to error states
* These are excluded from the error mapping because they emit 'alert' events, not 'error' events
*/
export declare const CONSUMABLE_ALERTS: Set<string>;
/**
* Maps a eufy error code to a Matter ErrorState ID
* @param eufyErrorCode - The error code from eufy-robovac (numeric or string)
* @returns The Matter ErrorState ID, or 0 (NoError) if not found
*/
export declare function mapEufyErrorToMatterErrorState(eufyErrorCode: string | number): number;
/**
* Gets the description for a eufy error code
* @param eufyErrorCode - The error code from eufy-robovac (numeric or string)
* @returns The error description, or a generic description if not found
*/
export declare function getEufyErrorDescription(eufyErrorCode: string | number): string;
/**
* Gets the Matter ErrorState name for an error ID
* @param errorStateId - The Matter ErrorState ID
* @returns The human-readable name
*/
export declare function getMatterErrorStateName(errorStateId: number): string;