github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/doc/content/en/docs/javascript/events.md (about)

     1  ---
     2  title: "Events"
     3  linkTitle: "events"
     4  date: 2024-01-13
     5  description: >
     6  
     7  ---
     8  
     9  In the Smart Home system, there is a JavaScript function called **PushSystemEvent** that plays a crucial role in dynamic system management. This function accepts various commands for interacting with tasks, triggers, and other components of the system.
    10  
    11  | Command                   | Description                                                    |
    12  |---------------------------|----------------------------------------------------------------|
    13  | `command_enable_task`      | Enables the execution of a task.                                |
    14  | `command_disable_task`     | Disables the execution of a task.                               |
    15  | `command_enable_trigger`   | Enables a trigger, activating the triggering capability.       |
    16  | `command_disable_trigger`  | Disables a trigger, suspending the triggering capability.      |
    17  | `event_call_trigger`       | Initiates a trigger call event.                                 |
    18  | `event_call_action`        | Initiates an action call event.                                 |
    19  | `command_load_entity`      | Loads an entity into the system.                                |
    20  | `command_unload_entity`    | Unloads an entity from the system.                              |
    21  
    22  #### Example of Usage:
    23  
    24  ```javascript
    25  // Example of enabling a task
    26  PushSystemEvent('command_enable_task', { id: 1 });
    27  
    28  // Example of calling a trigger
    29  PushSystemEvent('event_call_trigger', { id: 1 });
    30  
    31  // Example of loading an entity
    32  PushSystemEvent('command_load_entity', { id: 'sensor.entity1' });
    33  ```
    34  
    35  These commands provide control over tasks, triggers, trigger call events, actions, as well as loading and unloading entities in the Smart Home system. Their use enables dynamic management of system functionality and interaction with its components.