Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@glasshome/ha-types

TypeScript type definitions and constants for Home Assistant domains, services, events, and WebSocket API.

Auto-generated from Home Assistant Core source code. Part of GlassHome, the local-first dashboard for Home Assistant.

Install

npm install @glasshome/ha-types

Usage

Runtime values

import { KNOWN_DOMAINS } from "@glasshome/ha-types";

// KNOWN_DOMAINS is an array of all Home Assistant domain strings
console.log(KNOWN_DOMAINS.length); // 2000+
console.log(KNOWN_DOMAINS.includes("light")); // true

Type imports

import type { Domain, ServiceCall, HAEvent } from "@glasshome/ha-types";

// Domain is a union of all known HA domain strings
const domain: Domain = "light";

// ServiceCall describes a service invocation
const call: ServiceCall = {
  domain: "light",
  service: "turn_on",
  target: { entity_id: "light.living_room" },
  data: { brightness: 255 },
};

Device & entity constants

import {
  CONNECTION_BLUETOOTH,
  CONNECTION_NETWORK_MAC,
  CONNECTION_UPNP,
  CONNECTION_ZIGBEE,
} from "@glasshome/ha-types";

WebSocket API types

import type {
  CallServiceRequest,
  SubscribeEventsRequest,
  WsResult,
  AuthRequired,
} from "@glasshome/ha-types";

What's included

Module Exports
Domains Domain type, KNOWN_DOMAINS array
Services ServiceCall, ServiceName, Services, per-domain service types
Events HAEvent, CoreEventType, event data types
Entity Registry EntityRegistryEntry, EntityCategory, disabler/hider types
Device Registry DeviceEntry, connection constants
Area Registry AreaEntry
WebSocket Auth types, command request types, result types
Constants 317 domain-specific constants

License

MIT

About

@glasshome/ha-types

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages