forked from openhab/openhab-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathitemchannellink.d.ts
More file actions
202 lines (202 loc) · 7.25 KB
/
itemchannellink.d.ts
File metadata and controls
202 lines (202 loc) · 7.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
export type Item = {
rawItem: HostItem;
persistence: import("./item-persistence");
semantics: import("./item-semantics");
readonly type: string;
readonly groupType: string;
readonly name: string;
readonly label: string;
readonly category: string;
readonly state: string;
readonly numericState: number;
readonly quantityState: import("../quantity").Quantity;
readonly boolState: boolean;
readonly rawState: any;
readonly previousState: string;
readonly previousNumericState: number;
readonly previousQuantityState: import("../quantity").Quantity;
readonly previousRawState: any;
readonly lastStateUpdateTimestamp: any;
readonly lastStateUpdateInstant: any;
readonly lastStateChangeTimestamp: any;
readonly lastStateChangeInstant: any;
readonly members: any[];
readonly descendents: any[];
readonly isInitialized: boolean;
readonly isUninitialized: boolean;
getMetadata(namespace?: string): {
value: string;
/**
* Class representing an openHAB Item -> channel link.
*
* @memberof items.itemChannelLink
* @hideconstructor
*/
configuration: any;
rawMetadata: any;
readonly key: string;
toString(): string;
} | {
namespace: {
value: string;
/**
* Class representing an openHAB Item -> channel link.
*
* @memberof items.itemChannelLink
* @hideconstructor
*/
configuration: any;
rawMetadata: any;
readonly key: string;
toString(): string;
};
};
replaceMetadata(namespace: string, value: string, configuration?: any): {
value: string;
/**
* Class representing an openHAB Item -> channel link.
*
* @memberof items.itemChannelLink
* @hideconstructor
*/
configuration: any;
rawMetadata: any;
readonly key: string;
toString(): string;
};
removeMetadata(namespace?: string): {
value: string;
/**
* Class representing an openHAB Item -> channel link.
*
* @memberof items.itemChannelLink
* @hideconstructor
*/
configuration: any;
rawMetadata: any;
readonly key: string;
toString(): string;
};
sendCommand(value: any, expire?: JSJoda.Duration, onExpire?: any): void;
sendCommandIfDifferent(value: any): boolean;
sendIncreaseCommand(value: any): boolean;
sendDecreaseCommand(value: any): boolean;
getToggleState(): "OPEN" | "PLAY" | "ON" | "PAUSE" | "CLOSED" | "OFF";
sendToggleCommand(): void;
postToggleUpdate(): void;
postUpdate(value: any): void;
readonly groupNames: string[];
addGroups(...groupNamesOrItems: any[]): void;
removeGroups(...groupNamesOrItems: any[]): void;
readonly tags: string[];
addTags(...tagNames: string[]): void;
removeTags(...tagNames: string[]): void;
toString(): any;
};
/**
* Gets a channel link of from an Item.
*
* @memberof items.itemChannelLink
* @param {Item|string} itemOrName {@link Item} or the name of the Item
* @param {string} channelUID
* @returns {ItemChannelLink|null} the ItemChannelLink or `null` if none exists
*/
export function getItemChannelLink(itemOrName: Item | string, channelUID: string): ItemChannelLink | null;
/**
* Adds a new channel link to an Item.
*
* If this is called from file-based scripts, the Item -> channel link is registered with the ScriptedItemChannelLinkProvider and shares the same lifecycle as the script.
* You can still persist the Item -> channel link permanently in this case by setting the `persist` parameter to `true`.
* If this is called from UI-based scripts, the Item -> channel link is stored to the ManagedItemChannelLinkProvider and independent of the script's lifecycle.
*
* @memberOf items.itemChannelLink
* @param {Item|string} itemOrName {@link Item} or the name of the Item
* @param {string} channelUID
* @param {object} [configuration] channel configuration
* @param {boolean} [persist=false] whether to persist the Item -> channel link permanently (only respected for file-based scripts)
* @returns {ItemChannelLink} the ItemChannelLink
* @throws {Error} if the Item -> channel link already exists
*/
export function addItemChannelLink(itemOrName: Item | string, channelUID: string, configuration?: object, persist?: boolean): ItemChannelLink;
/**
* Adds or updates a channel link of an Item.
* If you use this in file-based scripts, better use {@link addItemChannelLink} to provide channel links.
*
* If an Item -> channel link is not provided by this script or the ManagedItemChannelLinkProvider, it is not editable and a warning is logged.
*
* @memberof items.itemChannelLink
* @param {Item|string} itemOrName {@link Item} or the name of the Item
* @param {string} channelUID
* @param {object} [configuration] channel configuration
* @returns {ItemChannelLink|null} the old ItemChannelLink or `null` if it did not exist
*/
export function replaceItemChannelLink(itemOrName: Item | string, channelUID: string, configuration?: object): ItemChannelLink | null;
/**
* Removes a channel link from an Item.
*
* @memberof items.itemChannelLink
* @param {Item|string} itemOrName {@link Item} or the name of the Item
* @param {string} channelUID
* @returns {ItemChannelLink|null} the removed ItemChannelLink or `null` if none exists, or it cannot be removed
*/
export function removeItemChannelLink(itemOrName: Item | string, channelUID: string): ItemChannelLink | null;
/**
* Removes all channel links from the given Item.
*
* @memberof items.itemChannelLink
* @param {string} itemName the name of the Item
* @returns {number} number of links removed
*/
export function removeLinksForItem(itemName: string): number;
/**
* Removes all orphaned (Item or channel missing) links.
*
* @memberof items.itemChannelLink
* @returns {number} number of links removed
*/
export function removeOrphanedItemChannelLinks(): number;
/**
* Item channel link namespace.
* This namespace provides access to Item channel links.
*
* @namespace items.itemChannelLink
*/
/**
* @typedef {import('./items').Item} Item
* @private
*/
/**
* Class representing an openHAB Item -> channel link.
*
* @memberof items.itemChannelLink
* @hideconstructor
*/
export class ItemChannelLink {
/**
* Create an ItemChannelLink instance, wrapping native openHAB Item -> channel link.
* @param {*} rawItemChannelLink {@link https://www.openhab.org/javadoc/latest/org/openhab/core/thing/link/itemchannellink org.openhab.core.thing.link.ItemChannelLink}
*/
constructor(rawItemChannelLink: any);
/**
* raw Java {@link https://www.openhab.org/javadoc/latest/org/openhab/core/thing/link/itemchannellink org.openhab.core.thing.link.ItemChannelLink}
* @type {*}
*/
rawItemChannelLink: any;
/**
* The name of the linked Item.
* @type {string}
*/
get itemName(): string;
/**
* The UID of the linked channel.
* @type {string}
*/
get channelUID(): string;
/**
* The channel link configuration.
* @type {object}
*/
get configuration(): any;
toString(): any;
}
//# sourceMappingURL=itemchannellink.d.ts.map