OnlyCat provides a code view for developers to define advanced Door Policies, which govern how the cat flap responds to events.
We’re publishing the JSON Schema for Door Policies below, with further examples and documentation to follow in due course.
At their core, Door Policies consist of an array of rules – much like firewall rules. Each rule has a criteria, and possible actions.
How it works
On every frame, the current state of the cat flap is matched against the defined rules. If a rule matches (eg. a specific cat is attempting to enter), the associated actions will execute (eg. let the cat in and play a sound).
Rule priority
For as long as a rule is matching, the rules below it will not be evaluated – so the actions that are invoked are the ones associated with the first matched rule. For example, if a rule is defined to block entry with contraband, rules below which allow entry for a specific cat will not run, unless contraband is no longer being detected.
Wait State
Some criteria, eg. rfidCode or eventClassification will cause rule execution to be suspended until the relevant information is available, for example if rfidCode is specified the cat flap will await a microchip to be scanned, before a decision can be made whether to run the rule’s actions or proceed to matching rules below it.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Transit Policy Schema",
"type": "object",
"properties": {
"transitPolicy": {
"type": "object",
"properties": {
"idleLock": {
"type": "boolean",
"description": "Indicates if the device should be locked when idle."
},
"rules": {
"type": "array",
"description": "List of rules to evaluate transit events.",
"items": {
"type": "object",
"properties": {
"criteria": {
"type": "object",
"properties": {
"eventTriggerSource": {
"description": "Event trigger source(s) to match.",
"anyOf": [
{
"type": "integer",
"enum": [0, 1, 2, 3],
"description": "Possible values: 0 (MANUAL), 1 (REMOTE), 2 (INDOOR_MOTION), 3 (OUTDOOR_MOTION)."
},
{
"type": "array",
"items": {
"type": "integer",
"enum": [0, 1, 2, 3]
},
"description": "Array of event trigger sources."
}
]
},
"eventClassification": {
"description": "Event classification(s) to match.",
"anyOf": [
{
"type": "integer",
"enum": [0, 1, 2, 3, 4, 10],
"description": "Possible values: 0 (UNKNOWN), 1 (CLEAR), 2 (SUSPICIOUS), 3 (CONTRABAND), 4 (HUMAN_ACTIVITY), 10 (REMOTE_UNLOCK)."
},
{
"type": "array",
"items": {
"type": "integer",
"enum": [0, 1, 2, 3, 4, 10]
},
"description": "Array of event classifications."
}
]
},
"rfidCode": {
"description": "RFID code(s) to match.",
"anyOf": [
{ "type": "string" },
{ "type": "array", "items": { "type": "string" } }
]
},
"rfidTimeout": {
"type": "integer",
"description": "Timeout in milliseconds to wait for an RFID code."
},
"timeRange": {
"description": "Time range(s) during which the rule is active (e.g., '08:00-18:00').",
"anyOf": [
{ "type": "string" },
{ "type": "array", "items": { "type": "string" } }
]
}
},
"additionalProperties": false
},
"action": {
"type": "object",
"properties": {
"lock": {
"type": "boolean",
"description": "Determines whether to lock (true) or unlock (false) the device."
},
"sound": {
"type": "string",
"description": "Sound to play when the rule matches."
},
"lockoutDuration": {
"type": "integer",
"description": "If provided, the flap locks for this many milliseconds, and no further rules are evaluated until the timeout expires."
}
},
"additionalProperties": false
}
},
"required": ["criteria", "action"],
"additionalProperties": false
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
Sound Action
The following sounds are available for use with the “sound” action.
Sound | Description |
---|---|
affirm |
Affirmative cue, potential alternative entry chime. |
alarm | Alarm sound, can be used to alert of prey or intruders. |
angry-meow | Good for deterring intruder cats. |
bell | Simple bell tone, used for default entry chime. |
choir | Harmonic vocal-like. Can be a spiritual entry chime! |
coin | Coin sound, can be a fun entry chime! |
deny | Short negative cue, can be used to signal entry rejection. |
fanfare | Celebratory fanfare, suitable for an entry sound. |
success | Positive cue indicating success, can be an alternative entry chime. |
Power users may experiment with using different entry chimes for individual cats, or playing various sounds in specific situations, such as when transit is denied.
Don’t miss our future updates! Get Subscribed Today!
© VirtualV Trading Ltd t/a OnlyCat. All Rights Reserved.
Enter your email below to keep up to date with all the latest news on our:
Plus more content from our feline friends!