Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ Calling `getItem(...)` or `...` returns an `Item` object with the following prop
- .persistence ⇒ [`ItemPersistence`](#itempersistence)
- .semantics ⇒ [`ItemSemantics`](https://openhab.github.io/openhab-js/items.ItemSemantics.html)
- .type ⇒ `string`
- .groupType ⇒ `string|null`
- .name ⇒ `string`
- .label ⇒ `string`
- .state ⇒ `string`
Expand Down
10 changes: 10 additions & 0 deletions src/items/items.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ class Item {
return this.rawItem.getType().toString();
}

/**
* Type of the Group, if this Item is a Group and has a type, else `null`.
* @type {string|null}
*/
get groupType () {
if (this.type !== 'Group') return null;
const baseItem = this.rawItem.getBaseItem();
return (baseItem !== null) ? baseItem.getType().toString() : null;
}

/**
* Name of Item
* @type {string}
Expand Down
1 change: 1 addition & 0 deletions types/items/itemchannellink.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export type Item = {
persistence: import("./item-persistence");
semantics: import("./item-semantics");
readonly type: string;
readonly groupType: string;
readonly name: string;
readonly label: string;
readonly state: string;
Expand Down
2 changes: 1 addition & 1 deletion types/items/itemchannellink.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions types/items/items.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ export class Item {
* @type {string}
*/
get type(): string;
/**
* Type of the Group, if this Item is a Group and has a type, else `null`.
* @type {string|null}
*/
get groupType(): string;
/**
* Name of Item
* @type {string}
Expand Down
2 changes: 1 addition & 1 deletion types/items/items.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions types/items/metadata.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export type Item = {
persistence: import("./item-persistence");
semantics: import("./item-semantics");
readonly type: string;
readonly groupType: string;
readonly name: string;
readonly label: string;
readonly state: string;
Expand Down
2 changes: 1 addition & 1 deletion types/items/metadata.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions types/quantity.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export type Item = {
persistence: import("./items/item-persistence");
semantics: import("./items/item-semantics");
readonly type: string;
readonly groupType: string;
readonly name: string;
readonly label: string;
readonly state: string;
Expand Down
2 changes: 1 addition & 1 deletion types/quantity.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions types/rules/operation-builder.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export type Item = {
persistence: import("../items/item-persistence");
semantics: import("../items/item-semantics");
readonly type: string;
readonly groupType: string;
readonly name: string;
readonly label: string;
readonly state: string;
Expand Down Expand Up @@ -39,13 +40,6 @@ export type Item = {
readonly configuration: any;
toString(): any;
};
/**
* Toggles the state of an item
*
* @memberof OperationBuilder
* @extends OperationConfig
* @hideconstructor
*/
removeMetadata(namespace?: string): {
rawMetadata: any;
readonly value: string;
Expand Down
2 changes: 1 addition & 1 deletion types/rules/operation-builder.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions types/triggers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export type Item = {
persistence: import("./items/item-persistence");
semantics: import("./items/item-semantics");
readonly type: string;
readonly groupType: string;
readonly name: string;
readonly label: string;
readonly state: string;
Expand Down
Loading