mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-08 09:56:52 +00:00
Add a note about the location of the event emitting function to the Shelly documentation (#38447)
* Add note about emitEvent * Apply code rabbit suggestion
This commit is contained in:
parent
7111e0fdfd
commit
72acb64fef
@ -163,6 +163,10 @@ If the **Input Mode** of the switch connected to the device is set to `Button`,
|
|||||||
|
|
||||||
Each script which generates events using [Shelly.emitEvent()](https://shelly-api-docs.shelly.cloud/gen2/Scripts/ShellyScriptLanguageFeatures#shellyemitevent) also gets an corresponding event entity. This entity is disabled by default. After changing a script, it's required to manually reload the device before new event types show up.
|
Each script which generates events using [Shelly.emitEvent()](https://shelly-api-docs.shelly.cloud/gen2/Scripts/ShellyScriptLanguageFeatures#shellyemitevent) also gets an corresponding event entity. This entity is disabled by default. After changing a script, it's required to manually reload the device before new event types show up.
|
||||||
|
|
||||||
|
{% note %}
|
||||||
|
To avoid increased startup time, only the first 5 KB of the script is downloaded and analyzed. If your script exceeds 5 KB, place the event emitting function at the beginning to ensure it is processed.
|
||||||
|
{% endnote %}
|
||||||
|
|
||||||
For example, the following script will emit an event every time an input (button or switch) on the device is changed.
|
For example, the following script will emit an event every time an input (button or switch) on the device is changed.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
Loading…
x
Reference in New Issue
Block a user