Cool. We should coordinate!
Here’s the beginnings of my version 2, supporting variables, regex and math expressions.
It also supports overrides. We should probably put into a repository instead of clogging up this channel.
- Predefined Capabilities (very basic so far):
[
{
"capability": "switch",
"name": "power",
"description": "Power",
"actions": {
"onoff": {
"command": "",
"arguments": [
{
"name": "setPower",
"type": "enum",
"enum": ["on", "off"]
}
],
"valueMap": [
{ "value": "on", "deviceValue": 1 },
{ "value": "off", "deviceValue": 0 }
]
},
"status": { "command": "", "arguments": [] },
"toggle": { "command": "", "arguments": [] }
},
"allowedValues": ["on", "off"],
"displayFormat": ""
},
{
"capability": "audioVolume",
"name": "volume",
"description": "Volume Control",
"actions": {
"volume": {
"command": "",
"arguments": [
{
"name": "setVolume",
"type": "integer",
"minimum": 0,
"maximum": 100
}
]
},
"volumeUp": { "command": "", "arguments": [] },
"volumeDown": { "command": "", "arguments": [] },
"status": { "command": "", "arguments": [] }
}
},
{
"capability": "mediaInput",
"name": "input",
"description": "Media Source Control",
"actions": {
"input": {
"command": "",
"arguments": [
{
"name": "setInput",
"type": "enum",
"enum": ["Input 1", "Input 2", "Input 3", "Input 4", "Input 5", "Input 6", "Input 7", "Input 8"]
}
]
}
}
},
{
"capability": "audioMute",
"name": "mute",
"description": "Audio Mute",
"actions": {
"onoff": {
"command": "",
"arguments": [
{
"name": "setMute",
"type": "enum",
"enum": ["on", "off"]
}
]
},
"status": { "command": "", "arguments": [] },
"toggle": { "command": "", "arguments": [] }
},
"allowedValues": ["on", "off"],
"displayFormat": ""
}
]```
2. Beginnings of a revised Matrix controller.
```{
"id": "i5TTEWeL",
"name": "MultiZoneAmp",
"description": "Xantech Matrix Switcher",
"version": "1.0.0",
"type": "Amplifier",
"category": "AV",
"need a name": "matrix switch",
"license": "MIT",
"author": "Suresh Kavan",
"supportedModels": ["a", "b"],
"protocol": {
"interface": "tcp",
"port": 4999,
"delimiterOut": "",
"delimiterIn": "+\r",
"substitutionCharacter": "$",
"responseParser": "regex",
"messageDelay": 250,
"messageTimeout": 1000
},
"preProcessorCommand": "{%pp}",
"variablePlaceholder": "%",
// first we have a device. (matrix001)
// then we have a component (main)
// then we have a capability (switch, audioVolume, mediaInput, audioMute)
// capabilities have one or more properties,
// that are defined by the capability statement
// i.e. power, volume, volumePct, volumedB, mute, input
// matrix001/main/switch/power
// matrix001/main/audioVolume/volume
// matrix001/main/audioVolume/volumedB
// matrix001/main/audioVolume/volumePct
// matrix001/main/audioMute/mute
// matrix001/main/mediaInput/input
// commands, components, feedbacks, variables can by of type "array"
"components": [
{
"component": "main",
"name": "main",
"description": "Master Controls",
// pull in the capabilty and override here
"capabilities": [
{
"capability": "switch",
"name": "power",
"description": "All Zones Power"
},
{
"capability": "audioVolume",
"description": "All Zones Volume"
},
{
"capability": "mediaInput",
"description": "All Zones Source"
},
{
"capability": "audioMute",
"description": "All Zones Mute"
}
],
"actions": {
"switch": {
"onoff": {
"command": ["!1PR{%1}+", "!2PR{%1}+"]
},
"status": {
"command": ["?1PR+", "?2PR+"]
},
"toggle": {
"command": ["!1PT+", "!2PT+"]
}
},
"audioVolume": {
"volume": {
"command": ["!1VO${%1}+", "!2VO${%1}+"],
"arguments": [
{
"name": "setVolume",
"type": "integer",
"minimum": 0,
"maximum": 38
}
]
},
"volumeUp": {
"command": ["!1VI$1+", "!2VI$1+"],
"arguments": []
},
"volumeDown": {
"command": ["!1VD$1-", "!2VD$1-"],
"arguments": []
}
}
}
},
{
"component": "zone{%pp}",
// doesn't have to be integers, could be text too.
"type": {"array": [1, 2, 3]} ,
"name": "Zone{%pp}",
"description": "Zone {%pp} Controls",
"capabilities": [
{
"capability": "switch",
"name": "power",
"description": "Zone {%pp} Power"
},
{
"capability": "audioVolume",
"description": "Zone {%pp} Volume"
},
{
"capability": "mediaInput",
"description": "Zones {%pp} Source"
},
{
"capability": "audioMute",
"description": "Zone {%1} Mute"
}
],
"actions": {
"switch": {
"onoff": {
"command": "!{%pp}PR{%1}+"
},
"status": {
"command": "?{%pp}PR+"
},
"toggle": {
"command": "!{%pp}PT+"
}
},
"audioVolume": {
"volume": {
"command": "!{%pp}VO{%1}+",
"arguments": [
{
"name": "setVolume",
"type": "integer",
"minimum": 0,
"maximum": 38
}
]
},
"volumeUp": {
"command": "!{%pp}VI+",
"arguments": []
},
"volumeDown": {
"command": "!{%pp}VD+",
"arguments": []
}
}
}
}
],
"feedbacks": [
{"name": "Power", "match": "\\?(\\d)PO(\\d)\\+", "component": "zone{%1}", "capability": "switch", "value": "{%2}", "variables": ["zonePower"]},
{"name": "Volume", "match": "\\?(\\d)VO(\\d{1,3})\\+", "component": "zone{%1}", "capability": "audioVolume", "value": "{%2}", "variables": ["zoneVolume"]}
],
"variables":[
{"name":"masterPower", "formula": "${zone1.switch}} + ${zone2.switch}} + ${zone3.switch} > 0", "type":"boolean"},
],
// these override predefined capabilities
"capabilities": [
{
"capability": "mediaInput",
"name": "input",
"description": "Media Source Control",
"actions": {
"input": {
"command": "",
"arguments": [
{
"name": "setInput",
"type": "enum",
"enum": ["Sonos", "Input 2", "Input 3", "Input 4", "Input 5", "Input 6", "Input 7", "Input 8"]
}
]
}
}
}
]
}