-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix types package not working because i didn't understand typescript
- Loading branch information
1 parent
0ae3d05
commit f81ee81
Showing
9 changed files
with
635 additions
and
628 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
// SPDX-FileCopyrightText: © 2023 Amber Cronin <[email protected]> | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
import { Feature } from "./zigbee_features"; | ||
|
||
export interface Device { | ||
[index: string]: any; | ||
ieee_address: string; | ||
|
@@ -113,3 +108,109 @@ export interface BridgeResponse { | |
error?: string; | ||
data: any; | ||
} | ||
|
||
export type Feature = | ||
| BinaryFeature | ||
| EnumFeature | ||
| NumericFeature | ||
| CompositeFeature | ||
| ListFeature | ||
| TextFeature | ||
| LockStateEnumFeature | ||
| LockFeature | ||
| FanFeature | ||
| CoverFeature | ||
| SwitchFeature | ||
| ClimateFeature; | ||
|
||
interface BaseFeature { | ||
access?: 1 | 2 | 5 | 7; | ||
description?: string; | ||
name: string; | ||
type: string; | ||
property?: string; | ||
} | ||
|
||
interface FeaturePreset { | ||
description: string; | ||
name: string; | ||
value: number; // check this | ||
} | ||
|
||
/** | ||
* Generic Features | ||
*/ | ||
|
||
interface BinaryFeature extends BaseFeature { | ||
type: "binary"; | ||
value_on: string | boolean; | ||
value_off: string | boolean; | ||
value_toggle?: string | boolean; | ||
} | ||
|
||
interface NumericFeature extends BaseFeature { | ||
type: "numeric"; | ||
value_max?: number; | ||
value_min?: number; | ||
value_step?: number; | ||
unit?: string; | ||
presets?: FeaturePreset[]; | ||
} | ||
|
||
interface EnumFeature extends BaseFeature { | ||
type: "enum"; | ||
values: any[]; | ||
} | ||
|
||
interface ListFeature extends BaseFeature { | ||
type: "list"; | ||
length_min?: number; | ||
length_max?: number; | ||
item_type: Feature[]; | ||
} | ||
|
||
interface TextFeature extends BaseFeature { | ||
type: "text"; | ||
property: string; | ||
} | ||
|
||
interface CompositeFeature extends BaseFeature { | ||
type: "composite"; | ||
property: string; | ||
features: BinaryFeature[] | NumericFeature[] | EnumFeature[]; | ||
} | ||
|
||
/** | ||
* Specific Features | ||
*/ | ||
|
||
interface LockFeature extends BaseFeature { | ||
type: "lock"; | ||
features: LockStateEnumFeature[] | BinaryFeature[]; | ||
} | ||
|
||
interface LockStateEnumFeature extends EnumFeature { | ||
name: "lock_state"; | ||
property: "lock_state"; | ||
values: string[]; | ||
} | ||
|
||
interface FanFeature extends BaseFeature { | ||
type: "fan"; | ||
features: BinaryFeature[] | EnumFeature[]; | ||
} | ||
|
||
interface CoverFeature extends BaseFeature { | ||
type: "cover"; | ||
features: BinaryFeature[] | NumericFeature[]; | ||
} | ||
|
||
interface SwitchFeature extends BaseFeature { | ||
type: "switch"; | ||
features: BinaryFeature[]; | ||
} | ||
|
||
interface ClimateFeature extends BaseFeature { | ||
type: "climate"; | ||
features: Feature[]; // TODO https://www.zigbee2mqtt.io/guide/usage/exposes.html#climate | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
{ | ||
"name": "@starlight/types", | ||
"packageManager": "[email protected]", | ||
"private": true, | ||
"workspaces": [ | ||
"packages/*" | ||
] | ||
"private": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "node16" | ||
}, | ||
"files": ["index.d.ts"] | ||
} |
This file was deleted.
Oops, something went wrong.