Skip to content

Commit

Permalink
Changed description of reserved actions
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Jan 9, 2025
1 parent 5c6f1be commit 03a1653
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,6 @@ The returned object must contain:

This method can be implemented asynchronously and can take a lot of time to complete.

Reserved control names:
- `disabled` - The disabled control has its own pre-defined place on the device card and is used to disable the device. The state of this control is boolean.

### `handleDeviceControlState(deviceId: string, controlId: string, context: MessageContext)

This method is called when GUI requests the update of the state.
Expand All @@ -234,6 +231,8 @@ For interactions, there are methods you can call on `context`:

There are some reserved action names, you can find the list below:
- `status` - This action is called when the user clicks on the status icon. So to implement the "click-on-status" functionality, the developer has to implement this action.
- `disable` - This action will be called when the user clicks on the `enabled` icon. `disable` and `enable` actions cannot be together.
- `enable` - This action will be called when the user clicks on the `disabled` icon. `disable` and `enable` actions cannot be together.

### `showMessage(text: ioBroker.StringOrTranslated)`

Expand Down
10 changes: 10 additions & 0 deletions src/types/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ export type Color = 'primary' | 'secondary' | (string & {}); // color (you can u

export type ControlState = string | number | boolean | null;

/** Reserved action names */
export const ACTIONS = {
/** This action will be called when user clicks on connection icon */
STATUS: 'status',
/** This action will be called when user clicks on connection icon */
DISABLE: 'disable',
ENABLE: 'enable',
};

export interface ActionBase<T extends ActionType> {
/** Unique (for this adapter) action ID. It could be the name from ACTIONS too, but in this case some predefined appearance will be applied */
id: string;
/**
* This can either be base64 or the URL to an icon.
Expand Down

0 comments on commit 03a1653

Please sign in to comment.