Skip to content

Commit 3daa853

Browse files
[TYPES] Supports load message (#3097)
* Added typing for smartName in the enum objects * Added typing for `supportsLoadingMessage` in the instance objects * Update schemas/io-package.json Co-authored-by: Copilot <[email protected]> * Clarify iframe loading message in comments * Linter --------- Co-authored-by: Copilot <[email protected]>
1 parent 890daaf commit 3daa853

File tree

3 files changed

+40
-12
lines changed

3 files changed

+40
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
-->
66

77
## __WORK IN PROGRESS__
8-
* (@Apollon77) Allows only numbers for ts and tc fields in state when provided for setState
9-
* (@GermanBluefox) Added typing for visIconSets in `io-package.json`(for vis-2 SVG icon sets)
8+
* (@Apollon77) Allows only numbers for `ts` and `lc` fields in state when provided for setState
9+
* (@GermanBluefox) Added typing for `visIconSets` in `io-package.json`(for vis-2 SVG icon sets)
10+
* (@GermanBluefox) Added typing for `smartName` in the enum objects
11+
* (@GermanBluefox) Added typing for `supportsLoadingMessage` in the instance objects
1012

1113
## 7.0.7 (2025-04-17) - Lucy
1214
* (@foxriver76) fixed the edge-case problem on Windows (if adapter calls `readDir` on single file)

packages/types-dev/objects.d.ts

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,15 @@ declare global {
186186
role?: string;
187187
}
188188

189+
type SmartNameObject = { [lang in ioBroker.Languages]?: string } & {
190+
/** Which kind of device it is */
191+
smartType?: string | null;
192+
/** Which value to set when the ON command is issued */
193+
byON?: string | null;
194+
};
195+
196+
type SmartName = null | false | string | SmartNameObject;
197+
189198
interface StateCommon extends ObjectCommon {
190199
/** Type of this state. See https://github.com/ioBroker/ioBroker/blob/master/doc/SCHEMA.md#state-commonrole for a detailed description */
191200
type: CommonType;
@@ -268,16 +277,7 @@ declare global {
268277
* The string "ignore" (deprecated please use boolean `false` instead) or boolean value `false` is a special case, causing the state to be ignored.
269278
* A value of `null` means that the device should be removed by the IOT adapters
270279
*/
271-
smartName?:
272-
| null
273-
| false
274-
| string
275-
| ({ [lang in Languages]?: string } & {
276-
/** Which kind of device it is */
277-
smartType?: string | null;
278-
/** Which value to set when the ON command is issued */
279-
byON?: string | null;
280-
});
280+
smartName?: SmartName;
281281
}
282282

283283
interface ChannelCommon extends ObjectCommon {
@@ -320,6 +320,13 @@ declare global {
320320

321321
// Make it possible to narrow the object type using the custom property
322322
custom?: undefined;
323+
324+
/**
325+
* Settings for IOT adapters and how the state should be named in e.g., Alexa.
326+
* The string "ignore" (deprecated please use boolean `false` instead) or boolean value `false` is a special case, causing the state to be ignored.
327+
* A value of `null` means that the device should be removed by the IOT adapters
328+
*/
329+
smartName?: SmartName;
323330
}
324331

325332
interface MetaCommon extends ObjectCommon {
@@ -627,6 +634,21 @@ declare global {
627634
singleton?: boolean;
628635
/** Order number in admin tabs */
629636
order?: number;
637+
/**
638+
* If page sends 'iobLoaded' event:
639+
*
640+
* if (window.parent !== window) {
641+
* try {
642+
* window.parent.postMessage('iobLoaded', '*');
643+
* } catch {
644+
* // ignore
645+
* }
646+
* }
647+
*
648+
* When loaded in iframe, inform parent window
649+
* Admin will hide a loading spinner when the message will be received.
650+
*/
651+
supportsLoadingMessage?: boolean;
630652
};
631653
/** If the mode is `schedule`, start one time adapter by ioBroker start, or by the configuration changes */
632654
allowInit?: boolean;

schemas/io-package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,10 @@
11451145
"singleton": {
11461146
"description": "If true, only one TAB for all instances will be shown.",
11471147
"type": "boolean"
1148+
},
1149+
"supportsLoadingMessage": {
1150+
"description": "If true, the page sends an 'iobLoaded' event when loaded",
1151+
"type": "boolean"
11481152
}
11491153
}
11501154
},

0 commit comments

Comments
 (0)