Alarm events pushed by the camera (cmd 33).

The camera pushes its alarm state for each channel whenever it changes:

<body>
  <AlarmEventList>
    <AlarmEvent>
      <channelId>0</channelId>
      <status>MD,visitor</status>
      <AItype>people</AItype>
    </AlarmEvent>
  </AlarmEventList>
</body>

Each push is state, not a happening: visitor stays true for as long as the camera reports the doorbell as active. Turning a false to true flip into a "pressed" signal is up to the consumer.

Examples

Parse a doorbell press

import { assertEquals } from "@std/assert";
import { parseAlarmEvents } from "@hertzg/reolink-api/protocol/event";

const events = parseAlarmEvents(
  "<body><AlarmEventList><AlarmEvent>" +
    "<channelId>0</channelId><status>visitor</status><AItype>none</AItype>" +
    "</AlarmEvent></AlarmEventList></body>",
);

assertEquals(events, [
  { channel: 0, motion: false, visitor: true, tamper: false, ai: [] },
]);

Functions

f
parseAlarmEvents(xml: string): AlarmEvent[]

Reads every <AlarmEvent> from a decrypted cmd 33 push.

Type Aliases

T
AlarmEvent = { channel: number; motion: boolean; visitor: boolean; tamper: boolean; ai: string[]; }

The alarm state of one channel, as the camera pushed it.