@signapps/lib
Pure domain logic for Home Assistant entities — light, sensor, weather, switch, actuator, curtain, motion, scene, and MQTT. No dependencies, no React; just the helpers that the UI cards and apps share.
- Workspace:
packages/lib· leaf package (no deps) - Build:
tsc -b --force→dist/
How it works
Each entity type lives in its own subdirectory (src/light/, src/sensor/, …)
and exposes helpers for that domain. The light domain is the richest example:
| Concern | Helpers |
|---|---|
| Color | hexToRgb, rgbToHex, clampByte, byteToHex, parseRgbAttribute |
| Brightness | brightnessToPercent, percentToBrightness, sliderBrightnessValue, BRIGHTNESS_MAX |
| Capabilities | getLightCapabilities, supportsRgbFromModes, supportsColorTempFromModes, supportsBrightnessFromModes |
| Service calls | lightRgbServiceData, lightToggleServiceData, lightBrightnessServiceData |
| Card bindings | resolveLightCardBindings (resolves primary + control entity; HA or MQTT) |
Capability detection inspects an entity's supported_color_modes to decide
whether it supports RGB, color temperature, and/or brightness — so a card can
render only the controls a given light actually supports.
Exports
package.json exports:
| Subpath | Contents |
|---|---|
. | All domains + parseHaEntityDomain, isRelayActuator, isSwitchLikeDomain, MOCK_ENTITY_IDS, attribute types |
./light | The light domain only |
Consumed by
@signapps/ui (card components), plus the web admin and dashboard
apps.