# Device rules and video overlay (https://docs.cochl.ai/docs/acoustic-security/axis/device-rules-and-overlay)



Everything here runs on the device, with no VMS involved. The event topics themselves are described
in [Events and integration](https://docs.cochl.ai/docs/acoustic-security/axis/events-and-integration).

## Action rules on the device [#action-rules-on-the-device]

The device's own action rules respond without any server involved: under **System → Events**,
create a rule whose condition is one of the application's topics. On a device with a speaker, or paired with an
AXIS network speaker, a detection can trigger a spoken message from the place where the sound was
heard.

## Showing a detection on the video [#showing-a-detection-on-the-video]

A detection can be written onto the video itself, so an operator watching a live view or a
recording sees what was heard and when. This uses the device's own overlay and rule, with no VMS
involved.

1. **Add a text overlay.** Under **Video → Overlays**, add a text overlay and set its text to
   `#D1`. The text an action writes appears in place of `#D1`; with no action running the overlay
   is empty. Choose its position, size and colors here.
2. **Create the rule.** Under **System → Events → Rules**, add a rule:
   * **Condition**: one of the application's topics, for example `cochlsense_official Glass_break`. Leave
     *Use this condition as a trigger* off, so the rule is active for as long as the tag is.
   * **Action**: **Use overlay text**, with the text to show (for example `GLASS BREAK`), the video
     channel, the text index `1`, and *While the rule is active*.
3. **Test it** with **Send test event** in the console. The text appears within about a second and
   clears when the detection hold ends. A test event is sent even if the tag is off or outside its
   schedule, so also check the tag's mode in the console.

<Callout type="warn" title="The text index must match the modifier">
  Text index `1` writes to `#D1`. An overlay whose text is a bare `#D` stays empty: the rule runs,
  the device's log shows it starting and stopping the action, but nothing is drawn.
</Callout>

To show every tag, add one rule per tag with its own text, all writing to `#D1`. To keep a
detection on screen for a fixed time rather than while it is active, use the `any` topic as a
trigger and give the action a duration.
