hap-fluent
AccessoryHandler
| Name | Description |
|---|---|
| AccessoryHandler | Class-based wrapper around a Homebridge PlatformAccessory that manages its fluent service helpers and exposes a typed services map. |
| FluentAccessory | A Homebridge PlatformAccessory augmented with strongly-typed FluentService properties for each declared service. |
| ServicesObject | A record mapping camelCase service names to their corresponding FluentService instances. |
| ServicesStateObject | Partial characteristic-value map for initializing an accessory's services. |
| createServicesObject | Build a strongly-typed service map by wrapping an array of service instances. |
| initializeAccessory | Initialize a PlatformAccessory with fluent service wrappers and apply initial characteristic values in a single call. |
Errors
| Class | Description |
|---|---|
| ConfigurationError | Error thrown when logger or plugin configuration is invalid or incomplete. |
| FluentCharacteristicError | Error thrown when a characteristic get, set, or update operation fails. |
| FluentError | Base class for all HAP Fluent errors. |
| FluentServiceError | Error thrown when a service-level operation fails (e.g., wrapping an invalid service). |
| ValidationError | Error thrown when input validation fails (e.g., an invalid service or characteristic value is passed to a hap-fluent function). |
FluentCharacteristic
| Class | Description |
|---|---|
| FluentCharacteristic | Type-safe, chainable wrapper around a single HAP-NodeJS Characteristic. |
FluentService
| Name | Description |
|---|---|
| FluentService | Strongly-typed, fluent view of a HAP service and all its characteristics. |
| getOrAddService | Retrieve an existing service from an accessory, or create and attach a new one, then wrap it with the fluent helper interface. |
| wrapService | Wrap an existing HAP Service instance with the fluent helper interface. |
Logger
| Name | Description |
|---|---|
| LoggerOptions | Configuration options for the global hap-fluent logger. |
| LogLevel | Valid Pino log level identifiers. |
| configureLogger | Configure the global hap-fluent logger instance. |
| createChildLogger | Create a child Pino logger with additional bound context fields. |
| getLogger | Get the current global logger instance. |
Other
TypeGuards
| Name | Description |
|---|---|
| CharacteristicValue | Union of all valid HAP characteristic value types per the HAP specification. |
| isBoolean | Determine whether value is a boolean. |
| isCharacteristic | Determine whether obj is a valid hap-nodejs Characteristic instance. |
| isCharacteristicValue | Determine whether value is a valid HAP CharacteristicValue. |
| isNumber | Determine whether value is a finite number (excludes NaN). |
| isService | Determine whether obj is a valid hap-nodejs Service instance. |
| isString | Determine whether value is a string. |
TypeUtils
| Name | Description |
|---|---|
| CharacteristicNames | Extract the camelCase characteristic name union from a FluentService type. |
| CharacteristicType | Extract the FluentCharacteristic<T> type for a named characteristic on a service. |
| OptionalProperties | Make a subset of properties on T optional while leaving others unchanged. |
| PartialServiceState | A partial ServiceState for incremental characteristic updates. |
| RequireProperties | Make a subset of properties on T required while leaving others unchanged. |
| ServiceState | A flat record mapping characteristic names to their current HAP values. |
| ValuePredicate | A predicate function for characteristic values. |
| ValueTransformer | A function that transforms a characteristic value from one type/shape to another. |
| createClampTransformer | Create a ValueTransformer that clamps a numeric value to [min, max]. |
| createRangePredicate | Create a ValuePredicate that validates whether a number falls within [min, max]. |
| createScaleTransformer | Create a ValueTransformer that linearly maps a value from one numeric range to another. |
| isFluentCharacteristic | Determine whether value is a FluentCharacteristic instance. |