Skip to main content

@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 --forcedist/

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:

ConcernHelpers
ColorhexToRgb, rgbToHex, clampByte, byteToHex, parseRgbAttribute
BrightnessbrightnessToPercent, percentToBrightness, sliderBrightnessValue, BRIGHTNESS_MAX
CapabilitiesgetLightCapabilities, supportsRgbFromModes, supportsColorTempFromModes, supportsBrightnessFromModes
Service callslightRgbServiceData, lightToggleServiceData, lightBrightnessServiceData
Card bindingsresolveLightCardBindings (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:

SubpathContents
.All domains + parseHaEntityDomain, isRelayActuator, isSwitchLikeDomain, MOCK_ENTITY_IDS, attribute types
./lightThe light domain only

Consumed by

@signapps/ui (card components), plus the web admin and dashboard apps.