Skip to content

Alarm Module

The Alarm Module blockAlarm Module: sounding
Alarm Module: normal, sounding. Asset render of the block model, not an in-game screenshot.

The Alarm Module is a siren. When activated it plays a sound once a second for a set time, and its lamp glows and lights up the area.

Alarm Module

Shaped crafting table recipe. Progression: early automation. Ingredients: 6 × Iron Ingot, 1 × Note Block, 1 × Redstone, 1 × Copper Ingot. It appears in the recipe book once you pick up one of its ingredients.

Place it where it should be heard and link it to a Network Repeater. It looks the same from every side.

Setting Meaning
Sound bell, pling, chime or bass. Default bell.
Volume 10 to 100. Default 60.
Seconds How long one activation lasts, 1 to 60. Default 10.
Save, Test, Stop Save the settings, sound it, or silence it.

Programs can change the same settings with configure, using Sound.BELL and the other constants.

Yes: device.activate(), device.deactivate() and the other methods. An alarm with its own program can listen to a detector on the same network; see the Guard alarm.

alarms.named(alias)

Refer to an Alarm Module by its name. Use it in a constant, then handle its events with on NAME.event(...).

Parameters: alias: string. Gives: Alarm. Cost: 4 operations.

const siren = alarms.named("siren")

alarms.from(alias)

Resolve an alarm module by name.

Parameters: alias: string. Gives: Alarm, or an error. Errors: device.type, device.unavailable, device.unknown, host.denied. Capability: alarm.write. Cost: 16 operations.

siren, err = alarms.from("siren")

Properties: siren.connected, siren.id, siren.kind, siren.name. They are read-only.

siren.activate()

Sound the alarm for its configured duration, renewing it when already active.

Gives: bool, or an error. Errors: alarm.limit, device.type, device.unavailable, device.unknown, host.denied. Capability: alarm.write. Cost: 32 operations.

ok, err = siren.activate()

siren.active()

True while the alarm is sounding.

Gives: bool, or an error. Errors: device.type, device.unavailable, device.unknown, host.denied. Capability: alarm.write. Cost: 4 operations.

on, err = siren.active()

siren.configure(sound, volume, seconds)

Set sound (bell, pling, chime or bass), volume (10–100) and duration in seconds (1–60). Applies from the next activation or sound.

Parameters: sound: enum or string, volume: number, seconds: number. Gives: bool, or an error. Errors: argument.range, device.type, device.unavailable, device.unknown, host.denied. Capability: alarm.write. Cost: 16 operations.

ok, err = siren.configure("bell", 80, 20)

siren.deactivate()

Silence the alarm.

Gives: bool, or an error. Errors: device.type, device.unavailable, device.unknown, host.denied. Capability: alarm.write. Cost: 16 operations.

ok, err = siren.deactivate()

siren.settings()

Read sound, volume, seconds, active and remaining seconds.

Gives: dict, or an error. Errors: device.type, device.unavailable, device.unknown, host.denied. Capability: alarm.write. Cost: 8 operations.

info, err = siren.settings()
EventWhen it runs
activatedRuns when the alarm starts sounding.
deactivatedRuns when the alarm is silenced.
finishedRuns when the alarm stops after its configured duration.
connectedRuns when the device becomes reachable, for example after its area loads.
disconnectedRuns when the device stops being reachable: unloaded, unlinked or removed.
programStartedRuns when the device's own program starts.
programStoppedRuns when the device's own program stops.
programFailed(message)Runs when the device's own program stops on an error.
  • Activating an alarm that is already sounding restarts its time.
  • An alarm stops when its time ends, when it is silenced, when its area unloads or when it is broken. It does not resume after a restart.
  • A server lets at most 64 alarms sound at once; more fail with alarm.limit.
const siren = alarms.named("siren")
on startup {
siren.configure(Sound.CHIME, 80, 5)
}
on siren.finished {
print("The alarm went quiet")
}