Skip to content

Internal Events

doomke edited this page Jun 13, 2023 · 14 revisions

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:

  1. eventId -- integer, identifies category of the condition that occured
  2. 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.

Event IDs

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
  1. modules can signal busy on timed actions or while moving to indicate they are not ready to receive the next command. Followed by ready once the modul is available again.
  2. used by the module manager to sync the debug state accross all modules

Custom Event Hooks

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:

  1. listeningId: the event hook only reacts if the module issuing the event matches this exactly (wildcard * allows for any sourceId to satisfy this check)
  2. eventId: the event type of the occuring event

For example an output could be turned off if a connection is lost or if a temperature sensor registers values outside a certain parameter range with this methode.

General

Guides

Principle of Operation

Modules

Software Hardware
camera camera
infoLED infoLED
input input
macro macro
output output
servo servo
socket socket
stepper stepper
WiFi wifi

Clone this wiki locally