This flow listens for dahua_event_recived
. The funcion node manipulates event data:
- Creates payload for snapshot call.
- Covers all supported event types. see here
- Numbers snapshot (allows multiple snapshots per message type before rewrite).
- Stores snapshot in different folders according to trigger type.
- Creates payload for text including snapshot file location.
- Creates payload for separate tts message.
- Bounces duplicate and stop messages.
- Rate limit by event and camera number.
- Retrieve phone state, bounce tts message if on phone.
- Create multiple zone triggers per camera. (See below)
- Alternating outputs for faster snapshot storage
Dahua cameras allow the naming of ivs rules. These names are sent with the event. The Dahua intgration (https://github.com/rroller/dahua) combines all ivs rules from a single camera together.
In the camera/dvr/nvr/xvr channel settings, create rules and name them. You will use theses names to identify triggers.
If you turn on show ivs rule in Dahua's smart pss app. (https://dahuawiki.com/SmartPSS_Lite) You can see the two ivs zones and their respective names.
When one of the rules are triggered there is the rule name value
in payload.event.data.Name
.
Using a conditinal statement (see rule 1 in camerafunc.js) allows us to target specific keywords found in the event data.
Dahua cameras offer other information in the event data. Target location and direction of travel among other things. Multiple sample JSON included in flow file.