JSON API - piggei/wled-usermod-buzzer GitHub Wiki
Buzzer commands can be included in normal WLED /json/state requests under the buzzer object.
Play once
{"buzzer":{"play":"victory"}}
Repeat
{"buzzer":{"play":"alarm","repeat":3}}
Infinite loop
{"buzzer":{"play":"alarm","loop":true}}
Stop
{"buzzer":{"stop":true}}
Tone
{"buzzer":{"tone":1000,"duration":200}}
Beep
{"buzzer":{"beep":150,"frequency":2000}}
Playback state
The usermod adds a buzzer object to WLED JSON state with fields including:
readyplayingsoundlooprepeatRemainingnotenotesfrequency
Repeat validation
The JSON API applies strict command validation and aligns repeat semantics with the HTTP API:
- omitted
repeat-> normal one-shot playback, or infinite loop whenloop:true; repeatfrom 1 to 255 -> finite total execution count;- explicit
repeat:0-> invalid command, ignored; repeatabove 255 -> invalid command, ignored;loop:truetogether withrepeat-> invalid command, ignored.- Numeric tone/beep/duration/frequency values must be JSON integers within the same 20-20000 Hz / 1-60000 ms limits as HTTP.
- Stringified numbers, negative values, and requests containing multiple command categories are ignored.
Examples:
{"buzzer":{"play":"alarm","repeat":3}}
{"buzzer":{"play":"alarm","repeat":0}}
The second command is invalid and does not start playback.
Night Mode
Night Mode is a configuration policy rather than a JSON playback command. While the current time is inside the configured quiet interval, JSON playback commands are ignored by the service. /json/state exposes muted, nightMode, nightFrom, and nightTo so consumers can distinguish hardware readiness from quiet-policy muting.