Event-Driven Sensor Updates
These are JSON events sent by the ESP32 when the state of a monitored sensor changes.
sensor_update
Section titled “sensor_update”Sent when a change is detected in a sensor enabled via
enable_monitor
.
Event Fields:
Field | Type | Description |
---|---|---|
action | string | "sensor_update" |
type | string | The sensor type: "button" , "potentiometer" , or "touch" . |
pin | int | The GPIO pin number. |
value | int | The new sensor value (state for button, analog reading for potentiometer and touch). |
timestamp | long | Timestamp in milliseconds. |
Event Examples:
-
Button Press:
{"action":"sensor_update","type":"button","pin":14,"value":0,"timestamp":1234567} -
Potentiometer Change:
{"action":"sensor_update","type":"potentiometer","pin":34,"value":2048,"timestamp":1234567} -
Touch Sensor Activation:
{"action":"sensor_update","type":"touch","pin":4,"value":50,"timestamp":1234567}