@iobroker/dm-utils 1.0.3 → 1.0.6

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/README.md CHANGED
@@ -301,9 +301,13 @@ This method returns a promise that resolves to a `ProgressDialog` object.
301
301
  ### **WORK IN PROGRESS**
302
302
  -->
303
303
  ## Changelog
304
- ### 1.0.3 (2025-01-09)
304
+ ### 1.0.6 (2025-01-14)
305
+
306
+ * (@GermanBluefox) Added the connection type indication
305
307
 
306
- * (@GermanBluefox) Added description for `disabled` control and `status` action.
308
+ ### 1.0.5 (2025-01-11)
309
+
310
+ * (@GermanBluefox) Added action ENABLE_DISABLE and `enabled` status
307
311
 
308
312
  ### 1.0.0 (2025-01-08)
309
313
 
@@ -320,11 +324,11 @@ This method returns a promise that resolves to a `ProgressDialog` object.
320
324
 
321
325
  ### 0.6.9 (2024-11-22)
322
326
 
323
- * (@GermanBluefox) Added max-width option for form
327
+ * (@GermanBluefox) Added a max-width option for form
324
328
 
325
329
  ### 0.6.8 (2024-11-22)
326
330
 
327
- * (@GermanBluefox) Allow grouping of devices
331
+ * (@GermanBluefox) Allowed grouping of devices
328
332
 
329
333
  ### 0.6.7 (2024-11-20)
330
334
 
@@ -1,4 +1,4 @@
1
- import type { ActionContext, ErrorResponse, MessageContext } from '..';
1
+ import type { ActionContext, ConfigConnectionType, ErrorResponse, MessageContext } from '..';
2
2
  import type { ApiVersion, DeviceRefresh, DeviceStatus, RetVal } from './common';
3
3
  type ActionType = 'api' | 'adapter';
4
4
  export type Color = 'primary' | 'secondary' | (string & {});
@@ -7,9 +7,8 @@ export type ControlState = string | number | boolean | null;
7
7
  export declare const ACTIONS: {
8
8
  /** This action will be called when user clicks on connection icon */
9
9
  STATUS: string;
10
- /** This action will be called when user clicks on connection icon */
11
- DISABLE: string;
12
- ENABLE: string;
10
+ /** This action will be called when the user clicks on enabled/disabled icon. The enabled/disabled icon will be shown only if the node status has "enabled" flag set to false or true */
11
+ ENABLE_DISABLE: string;
13
12
  };
14
13
  export interface ActionBase<T extends ActionType> {
15
14
  /** Unique (for this adapter) action ID. It could be the name from ACTIONS too, but in this case some predefined appearance will be applied */
@@ -99,16 +98,28 @@ export interface InstanceDetails<T extends ActionType = 'api'> {
99
98
  actions?: InstanceAction<T>[];
100
99
  }
101
100
  export interface DeviceInfo<T extends ActionType = 'api'> {
101
+ /** ID of the action. Should be unique only in one adapter. Other adapters could have same names */
102
102
  id: string;
103
+ /** Name of the device. It will be shown in the card header */
104
+ name: ioBroker.StringOrTranslated;
105
+ /** base64 or url icon for device card */
103
106
  icon?: string;
104
107
  manufacturer?: ioBroker.StringOrTranslated;
105
108
  model?: ioBroker.StringOrTranslated;
109
+ /** Color or 'primary', 'secondary' for the text in the card header */
106
110
  color?: Color;
111
+ /** Background color of card header (you can use primary, secondary or color rgb value or hex) */
107
112
  backgroundColor?: Color;
108
- name: ioBroker.StringOrTranslated;
109
113
  status?: DeviceStatus | DeviceStatus[];
114
+ /** Connection type, how the device is connected */
115
+ connectionType?: ConfigConnectionType;
116
+ /** If this flag is true or false, the according indication will be shown. Additionally, if ACTIONS.ENABLE_DISABLE is implemented, this action will be sent to backend by clicking on this indication */
117
+ enabled?: boolean;
118
+ /** List of actions on the card */
110
119
  actions?: DeviceAction<T>[];
120
+ /** List of controls on the card. The difference of controls and actions is that the controls can show status (e.g. on/off) and can work directly with states */
111
121
  controls?: DeviceControl<T>[];
122
+ /** If true, the button `more` will be shown on the card and called `dm:deviceDetails` action to get the details */
112
123
  hasDetails?: boolean;
113
124
  /** Device type for grouping */
114
125
  group?: {
@@ -5,7 +5,6 @@ exports.ACTIONS = void 0;
5
5
  exports.ACTIONS = {
6
6
  /** This action will be called when user clicks on connection icon */
7
7
  STATUS: 'status',
8
- /** This action will be called when user clicks on connection icon */
9
- DISABLE: 'disable',
10
- ENABLE: 'enable',
8
+ /** This action will be called when the user clicks on enabled/disabled icon. The enabled/disabled icon will be shown only if the node status has "enabled" flag set to false or true */
9
+ ENABLE_DISABLE: 'enable/disable',
11
10
  };
@@ -1,9 +1,7 @@
1
1
  export type ApiVersion = 'v1';
2
+ export type ConfigConnectionType = 'lan' | 'wifi' | 'bluetooth' | 'thread' | 'z-wave' | 'zigbee' | 'other';
3
+ export type ConfigIconType = 'add' | 'backlight' | 'delete' | 'dimmer' | 'edit' | 'group' | 'identify' | 'info' | 'light' | 'lines' | 'next' | 'pair' | 'pause' | 'play' | 'previous' | 'qrcode' | 'refresh' | 'search' | 'settings' | 'socket' | 'stop' | 'unpair' | 'user' | string;
2
4
  export type DeviceStatus = 'connected' | 'disconnected' | {
3
- /**
4
- * This can either be the name of a font awesome icon (e.g. "fa-signal") or the URL to an icon.
5
- */
6
- icon?: string;
7
5
  battery?: number | boolean | 'charging' | string;
8
6
  connection?: 'connected' | 'disconnected';
9
7
  rssi?: number;
@@ -13,7 +11,8 @@ export type ActionButton = {
13
11
  label: ioBroker.StringOrTranslated;
14
12
  type: 'apply' | 'cancel';
15
13
  noTranslation?: boolean;
16
- icon?: string;
14
+ /** base64 or icon name */
15
+ icon?: ConfigIconType;
17
16
  variant?: 'contained' | 'outlined' | 'text';
18
17
  style?: Record<string, number | string>;
19
18
  color?: 'primary' | 'secondary';
@@ -40,7 +39,6 @@ interface ObjectBrowserCustomFilter {
40
39
  }
41
40
  export type ObjectBrowserType = 'state' | 'instance' | 'channel' | 'device' | 'chart';
42
41
  export type ConfigItemType = 'tabs' | 'panel' | 'text' | 'number' | 'color' | 'checkbox' | 'slider' | 'ip' | 'user' | 'room' | 'func' | 'select' | 'autocomplete' | 'image' | 'objectId' | 'password' | 'instance' | 'chips' | 'alive' | 'pattern' | 'sendto' | 'setState' | 'staticInfo' | 'staticText' | 'staticLink' | 'staticImage' | 'table' | 'accordion' | 'jsonEditor' | 'language' | 'certificate' | 'certificates' | 'certCollection' | 'custom' | 'datePicker' | 'timePicker' | 'divider' | 'header' | 'cron' | 'fileSelector' | 'file' | 'imageSendTo' | 'selectSendTo' | 'autocompleteSendTo' | 'textSendTo' | 'coordinates' | 'interface' | 'license' | 'checkLicense' | 'uuid' | 'port' | 'deviceManager' | 'topic' | 'qrCode' | 'state';
43
- type ConfigIconType = 'edit' | 'auth' | 'send' | 'web' | 'warning' | 'error' | 'info' | 'search' | 'book' | 'help' | 'upload' | 'user' | 'group' | 'delete' | 'refresh' | 'add' | 'unpair' | 'pair' | string;
44
42
  export interface ConfigItemConfirmData {
45
43
  condition: string;
46
44
  text?: ioBroker.StringOrTranslated;
@@ -358,7 +356,7 @@ export interface ConfigItemStaticInfo extends Omit<ConfigItem, 'data'> {
358
356
  labelIcon?: string;
359
357
  /** Unit */
360
358
  unit?: ioBroker.StringOrTranslated;
361
- /** Normally the title and value are shown on the left and right of the line. With this flag, the value will appear just after the label*/
359
+ /** Normally, the title and value are shown on the left and right of the line. With this flag, the value will appear just after the label*/
362
360
  narrow?: boolean;
363
361
  /** Add to label the colon at the end if not exist in label */
364
362
  addColon?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/dm-utils",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "description": "ioBroker Device Manager utilities for backend",
5
5
  "main": "build/index.js",
6
6
  "publishConfig": {