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:
Maciej Bieniek 2025-04-09 07:25:43 +02:00 committed by GitHub
parent 7111e0fdfd
commit 72acb64fef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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.
{% 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.
```javascript