-
Notifications
You must be signed in to change notification settings - Fork 1
Internal Events
Internal Events are used to propagate state changes of a module to other modules on the same hardware. Every event includes the following 2 pieces of information:
-
eventId-- integer, identifies category of the condition that occured -
sourceId-- String, ID of the module issueing the event. Internal events do not get forwarded to the socket server and are therefore only available to modules that share the same ESP32. However, Custom event Hooks can be created to execute commands when events occur.
Due to the eventId being somewhat limited in the information it can carry, internal events are used for syncing major information with other modules on the same hardware. For more structured/verbose information socket events should be used.
| ID | event type | source module |
|---|---|---|
| 0 | socket disconnected |
socket |
| 1 | socket connected |
socket |
| 2 | socket authed |
socket |
| 3 | wifi disconnected |
WiFi |
| 4 | wifi connected |
WiFi |
| 5 | busy |
all[1] |
| 6 | ready |
all[1] |
| 7 | time synced |
socket |
| 8 | debug on |
core[2] |
| 9 | debug off |
core[2] |
| 10 | input trigger low |
input |
| 11 | input trigger high |
input |
-
↑modules can signal
busyon timed actions or while moving to indicate they are not ready to receive the next command. Followed byreadyonce the modul is available again. - ↑used by the module manager to sync the debug state accross all modules
In order to automate tasks on certain conditions, every ESP32 can hold up to 16 custom event hooks that each hold a single command. In order for a command to be activated, 2 conditions that constitute the event hook must be met:
-
listeningId: the event hook only reacts if the module issuing the event matches this exactly (wildcard*allows for anysourceIdto satisfy this check) -
eventId: the event type of the occuring event
In order to edit, add or delete event hooks, connect the ESP32 via serial interface and start the setup routine by sending the text setup over the interface. The firmware will then list the currently initialized modules and some managment options. Choose the option to manage internal events by sending i over the interface. The listed event hooks can then be edited or remoded or entirely new ones created. The following information is needed for every event hook:
| Name | Type | Description |
|---|---|---|
| eventId | integer | specifies what type of event to listen for |
| listeningId | String |
controlId of the event issuing module to listen for |
| controlId | String |
controlId of the module to receive the attached command |
| controlKey | String | command key of the receiving module[3] |
| valueType | integer | defines what type the value can take[3] |
| controlValue | boolean integer float String |
value accompanying the controlKey[4]
|
-
↑both the available
controlKeys and the corresponding type ofcontrolValuedepend on the type of module addressed, see the individual modules for further information - ↑only 4 types of controlValue are available (check module in question for permitted type), identified by number:
| # | Type |
|---|---|
| 0 | bool |
| 1 | integer |
| 2 | float |
| 3 | String |