@glasshome/ha-types 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +79 -0
- package/dist/index.d.mts +9297 -0
- package/dist/index.mjs +2036 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 GlassHome Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# @glasshome/ha-types
|
|
2
|
+
|
|
3
|
+
TypeScript type definitions and constants for Home Assistant domains, services, events, and WebSocket API.
|
|
4
|
+
|
|
5
|
+
Auto-generated from Home Assistant Core source code.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @glasshome/ha-types
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Runtime values
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { KNOWN_DOMAINS } from "@glasshome/ha-types";
|
|
19
|
+
|
|
20
|
+
// KNOWN_DOMAINS is an array of all Home Assistant domain strings
|
|
21
|
+
console.log(KNOWN_DOMAINS.length); // 2000+
|
|
22
|
+
console.log(KNOWN_DOMAINS.includes("light")); // true
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Type imports
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import type { Domain, ServiceCall, HAEvent } from "@glasshome/ha-types";
|
|
29
|
+
|
|
30
|
+
// Domain is a union of all known HA domain strings
|
|
31
|
+
const domain: Domain = "light";
|
|
32
|
+
|
|
33
|
+
// ServiceCall describes a service invocation
|
|
34
|
+
const call: ServiceCall = {
|
|
35
|
+
domain: "light",
|
|
36
|
+
service: "turn_on",
|
|
37
|
+
target: { entity_id: "light.living_room" },
|
|
38
|
+
data: { brightness: 255 },
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Device & entity constants
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import {
|
|
46
|
+
CONNECTION_BLUETOOTH,
|
|
47
|
+
CONNECTION_NETWORK_MAC,
|
|
48
|
+
CONNECTION_UPNP,
|
|
49
|
+
CONNECTION_ZIGBEE,
|
|
50
|
+
} from "@glasshome/ha-types";
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### WebSocket API types
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import type {
|
|
57
|
+
CallServiceRequest,
|
|
58
|
+
SubscribeEventsRequest,
|
|
59
|
+
WsResult,
|
|
60
|
+
AuthRequired,
|
|
61
|
+
} from "@glasshome/ha-types";
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## What's included
|
|
65
|
+
|
|
66
|
+
| Module | Exports |
|
|
67
|
+
|--------|---------|
|
|
68
|
+
| Domains | `Domain` type, `KNOWN_DOMAINS` array |
|
|
69
|
+
| Services | `ServiceCall`, `ServiceName`, `Services`, per-domain service types |
|
|
70
|
+
| Events | `HAEvent`, `CoreEventType`, event data types |
|
|
71
|
+
| Entity Registry | `EntityRegistryEntry`, `EntityCategory`, disabler/hider types |
|
|
72
|
+
| Device Registry | `DeviceEntry`, connection constants |
|
|
73
|
+
| Area Registry | `AreaEntry` |
|
|
74
|
+
| WebSocket | Auth types, command request types, result types |
|
|
75
|
+
| Constants | 317 domain-specific constants |
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
MIT
|