node-red-contrib-musiccast
Version:
A Node-RED collection for monitoring and controlling a Yamaha Musiccast network.
1,824 lines (1,713 loc) • 68.7 kB
JavaScript
/*
Apache-2.0
Copyright (c) 2023 Vahdettin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
*/
let mcIsLoaded = false;
class MCUI {
constructor(base, mc, RED) {
let ui = this;
this.debug = true;
this.base = base;
this.opts = {
b: base,
mc: mc
}
this.RED = RED || null;
this.mc_data = new MCData();
this.Fields = {
mc: $("#node-input-mc"),
d: $("#node-input-device"),
i: $("#node-input-inp"),
c: $("#node-input-command"),
p: $("#node-input-payload"),
z: $("#node-input-zone"),
address: ".node-input-device-address-value",
name: ".node-input-device-name-value",
model: ".node-input-device-model-value",
serial: ".node-input-device-serial-value",
udn: ".node-input-device-udn-value",
uuid: ".node-input-device-uuid-value",
zone_list: ".node-input-device-zone_list-value",
input_list: ".node-input-device-input_list-value",
main: $("#node-config-input-main"),
zone_2: $("#node-config-input-zone_2"),
zone_3: $("#node-config-input-zone_3"),
zone_4: $("#node-config-input-zone_4"),
};
this.TypeFields = {
d: $("#node-input-type_device"),
i: $("#node-input-type_inp"),
c: $("#node-input-type_command"),
p: $("#node-input-type_payload"),
z: $("#node-input-type_zone")
};
this.commands = this.mc_data.commands;
this.zone_list =this.mc_data.zone_list;
this.input_list = this.mc_data.inputs;
this.models = this.mc_data.models;
this.device_list = {};
if (mc && mc.device_list) {
ui.device_list = mc.device_list;
}
if (mc && mc.zone_list) {
ui.zone_list = mc.zone_list;
}
}
get cFields() {
return this.Fields;
}
/*
General function to get data from admin backend
*/
getData(resource, opts = {}, callback) {
let ui = this;
if (resource) {
ui.d("getData:" + resource + " opts: " + JSON.stringify(opts));
try {
$.ajax({
url: "musiccast/" + resource,
method: 'GET',
timeout: 1000,
data: opts
})
.done(function (response) {
if (response && JSON.parse(response)) {
callback(null, response);
} else {
callback("Expected data not returned.");
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
callback(textStatus || "Unknown.");
});
} catch (err) {
callback("API call error. Undefined.");
}
} else {
callback("Incorrect params supplied.");
}
};
/*
Load and pop devices
*/
popDevices(opts, callback) {
let ui = this;
const el = this.Fields.d;
if (!opts) opts = {t: "", v: ""};
ui.d("popDevices: " + JSON.stringify(opts))
let deviceTypes = [{
value: "flow",
label: "flow.musiccast_device",
icon: "fa fa-arrows-alt",
hasValue: false
},
{
value: "global",
label: "global.musiccast_device",
icon: "fa fa-globe",
hasValue: false
},
{
value: "msg",
label: "msg.device",
icon: "fa fa-envelope",
hasValue: false
},
];
let selOpts = [];
let deviceTypeDefault = "msg";
for (const d in ui.device_list) {
if (ui.device_list.hasOwnProperty(d)) {
let device = ui.device_list[d];
if (
(opts.t === "zone" && device.zone_list && JSON.parse(device.zone_list) && JSON.parse(device.zone_list)[opts.v])
|| opts.t !== "zone"
) {
try {
selOpts.push(
{
value: ui.device_list[d].uuid,
label: ui.device_list[d].name
}
)
} catch (err) {
console.warn(err);
}
}
}
}
if (selOpts) {
deviceTypes.push({
value: "device",
label: "Select...",
icon: "fa fa-list",
options: selOpts
});
deviceTypeDefault = "device"
}
try {
el.typedInput('types', deviceTypes);
} catch (err) {
el.typedInput({
default: deviceTypeDefault,
typeField: ui.TypeFields.d,
types: deviceTypes
});
}
callback(null, {
v: el.typedInput("value"),
t: el.typedInput("type")
});
}
popZones(opts, callback) {
let ui = this;
const el = this.Fields.z;
let selOpts = [];
if (!opts) opts = {t: "", v: ""};
ui.d("popZones: " + JSON.stringify(opts))
for (const z in ui.zone_list) {
if (ui.zone_list.hasOwnProperty(z)) {
try {
selOpts.push(
{
value: ui.zone_list[z].id,
label: ui.zone_list[z].label
}
)
} catch (err) {
console.warn(err);
}
}
}
selOpts = selOpts.sort(ui.compare);
let zoneTypes = [
{
value: "zone",
label: "Select...",
icon: "fa fa-list",
options: selOpts
},
{
value: "flow",
label: "flow.musiccast_zone",
icon: "fa fa-arrows-alt",
hasValue: false
},
{
value: "global",
label: "global.musiccast_zone",
icon: "fa fa-globe",
hasValue: false
},
{
value: "msg",
label: 'msg.zone',
icon: "fa fa-envelope",
hasValue: false
}];
try {
el.typedInput('types', zoneTypes);
} catch (err) {
el.typedInput({
default: "zone",
typeField: ui.TypeFields.z,
types: zoneTypes
});
}
callback(null, {
v: el.typedInput("value"),
t: el.typedInput("type")
});
};
popInputs(opts, callback) {
let ui = this;
const el = this.Fields.i;
if (!opts) opts = {t: "", v: "", play_info_type: "all"};
ui.d("popInputs: " + JSON.stringify(opts))
let inputTypes = [{
value: "flow",
label: "flow.musiccast_input",
icon: "fa fa-arrows-alt",
hasValue: false
},
{
value: "global",
label: "global.musiccast_input",
icon: "fa fa-globe",
hasValue: false
},
{
value: "msg",
label: "msg.input",
icon: "fa fa-envelope",
hasValue: false
}];
let baseInputs = ui.input_list;
if (opts.t === "device") {
let device = ui.device_list[opts.v];
baseInputs = {};
if (device && device.input_list && JSON.parse(device.input_list)) {
let dInputs = JSON.parse(device.input_list);
for (const i in dInputs) {
try {
if (ui.input_list[i]) {
baseInputs[i] = ui.input_list[i]
}
} catch(err){
console.warn(err)
}
}
}
}
let selOpts = [];
for (const i in baseInputs) {
if (baseInputs.hasOwnProperty(i)) {
let input = baseInputs[i];
//if ((input.play_info_type && input.play_info_type === opts.play_info_type)) {
try {
selOpts.push(
{
value: input.id,
label: input.label
}
)
} catch (err) {
console.warn(err);
}
//}
}
}
let inputTypeDefault = "msg";
if (selOpts) {
selOpts = selOpts.sort(ui.compare);
inputTypes.push({
value: "input",
label: "Select...",
icon: "fa fa-list",
options: selOpts
});
inputTypeDefault = "input";
}
try {
el.typedInput('types', inputTypes);
} catch (err) {
el.typedInput({
default: inputTypeDefault,
typeField: ui.TypeFields.i,
types: inputTypes
});
}
callback(null, {
v: el.typedInput("value"),
t: el.typedInput("type")
});
}
;
popCommands(opts, callback) {
let ui = this;
const el = this.Fields.c;
if (!opts) opts = {t: "", v: ""};
ui.d("popCommands: " + JSON.stringify(opts))
let commandTypeDefault = 'msg';
let commandTypes = [{
value: "msg",
label: "msg.command",
icon: "fa fa-envelope",
hasValue: false
}];
let selOpts = [];
for (const c in ui.commands) {
if (ui.commands.hasOwnProperty(c)) {
let commandTypes = ui.commands[c];
if (commandTypes.type === ui.base) {
for (const cbt in commandTypes) {
if (commandTypes.hasOwnProperty(cbt)) {
let command = commandTypes[cbt];
if (ui.base !== "input" && ui.base === commandTypes.type ||
(ui.base === "input" && opts.v && ui.input_list[opts.v] && ui.input_list[opts.v].play_info_type
&& (command.play_info_type
&& Array.isArray(command.play_info_type)
&& command.play_info_type.indexOf(ui.input_list[opts.v].play_info_type) > -1)
|| !command.play_info_type || opts.t === "flow" || opts.t === "global" || opts.t === "msg")
) {
if (command.disabled !== true) {
try {
selOpts.push(
{
value: command.name,
label: command.name
}
);
} catch(err){
console.warn(err)
}
}
}
}
}
}
}
}
if (selOpts) {
selOpts = selOpts.sort(ui.compare);
commandTypes.push({
value: "command",
label: "Select...",
icon: "fa fa-list",
options: selOpts
});
commandTypeDefault = "command";
}
try {
el.typedInput('types', commandTypes);
} catch (err) {
el.typedInput({
default: commandTypeDefault,
typeField: ui.TypeFields.c,
types: commandTypes
});
}
callback(null, {
v: el.typedInput("value"),
t: el.typedInput("type")
});
}
;
getCommand(id,callback){
let ui = this;
let res = null;
ui.d("getCommand: " + id)
for(const t in ui.commands){
if(ui.commands.hasOwnProperty(t) && t === ui.base){
if(ui.commands[t].hasOwnProperty(id)){
res = ui.commands[t][id];
}
}
}
callback(null,res)
}
loadCommand(opts, callback) {
let ui = this;
if(!opts) opts = {t:"",v:""};
ui.d("loadCommand: " + JSON.stringify(opts))
if (opts.t === 'str' || opts.t === 'command') {
$("#lookup-command").removeClass('disabled');
ui.getCommand(opts.v,function(err,command){
if (command.attributes) {
$(".musiccast-form-row-cmd-addt").show();
$("#set-attribute-default").removeClass('disabled');
$('.musiccast-form-row-payload').show();
} else {
$(".musiccast-form-row-cmd-addt").hide();
$("#set-attribute-default").addClass('disabled');
$('.musiccast-form-row-payload').hide();
}
if (command.status_f) {
$(".musiccast-form-row-cmd-addt").show();
} else {
$(".musiccast-form-row-cmd-addt").hide();
}
callback(null, command);
})
} else {
$("#lookup-command").addClass('disabled');
$("#set-attribute-default").addClass('disabled');
$(".musiccast-form-row-cmd-addt").hide();
$('.musiccast-form-row-payload').show();
callback(null,null);
}
};
popExampleAttributes(opts, callback) {
let ui = this;
let Fields = ui.Fields;
if(!opts) opts = {t:"",v:""};
if (opts.t === 'str' || opts.t === 'command') {
ui.getCommand(opts.v,function(err,command){
if (command && command.attributes) {
Fields.p.typedInput("value", JSON.stringify(command.attributes));
} else if (command) {
Fields.p.typedInput("value", JSON.stringify({}));
}
callback(null, command);
})
} else {
callback(null,null);
}
}
popAttributes() {
let ui = this;
const el = this.Fields.p;
ui.d("popAttributes")
el.typedInput({
default: "json",
typeField: ui.TypeFields.p,
types: [
{
value: "json",
label: "{}",
expand: function () {
var that = this;
var value = this.value();
try {
value = JSON.stringify(JSON.parse(value), null, 4);
} catch (err) {
}
RED.editor.editJSON({
value: value,
complete: function (v) {
var value = v;
try {
value = JSON.stringify(JSON.parse(v));
} catch (err) {
}
that.value(value);
}
})
}
},
{
value: "msg",
label: "msg.attributes",
icon: "fa fa-envelope",
hasValue: false
}
]
});
if (el.typedInput('type') !== 'json') {
$("#set-attribute-default").addClass('disabled');
} else {
$("#set-attribute-default").removeClass('disabled');
}
} ;
popModels(modelField, callback) {
const ui = this;
for (const m in ui.models) {
if (ui.models.hasOwnProperty(m)) {
try {
modelField.append($("<option></option>").val(m).text(ui.models[m].label));
} catch(err){
console.warn(err)
}
}
}
callback(null, true);
};
popLangs() {
const ui = this;
let langKeys = Object.keys(ui.sort(ui.mc_data.langs));
$('#node-config-input-list_language').typedInput({
default: "str",
types: [
{
value: "str",
label: "Select...",
icon: "fa fa-language",
options: langKeys
}
]
});
};
refresh(theNode, done) {
let ui = this;
ui.d("refresh")
try {
if (theNode.zone_list) ui.zone_list = theNode.zone_list
if (theNode.device_list) ui.device_list = theNode.device_list
} catch(err){
console.warn(err)
}
done(null,true)
}
popAttributeBuilder(attributes = {
"input": ['juke', 'tidal', 'server'],
"mode": ['autoplay_disabled']
}) {
let ui = this;
const elBuilder = $("#node-input-builder-container");
for (const a in attributes) {
if (attributes.hasOwnProperty(a)) {
elBuilder.editableList('addItem', {
attribute: a,
values: attributes[a]
});
}
}
}
drawAttributeBuilder(callback) {
let ui = this;
const elBuilder = $("#node-input-builder-container");
elBuilder.css('min-height', '250px').css('min-width', '200px').editableList({
header: $("<div>").append($.parseHTML("<div style='width:calc(32% - 25px); margin-left: 5px; text-align: left; display: inline-grid'>Attribute</div><div style='width:calc(32% - 25px); margin-left: 5px; text-align: left; display: inline-grid'>Values</div>")),
addItem: function (container, i, opt) {
container.css({
overflow: 'hidden',
whiteSpace: 'nowrap'
});
let row = $('<div/>').appendTo(container);
let nameClass = "musiccast-config-input node-input-attribute_name-value";
let nameField = $('<input/>', {
class: nameClass,
type: "text",
style: "margin-left:5px; width:calc(32% - 25px);",
value: opt.attribute
}).appendTo(row);
;
let valueField = $('<select/>', {
class: "musiccast-config-input node-input-attribute_value-value",
style: "margin-left:5px; width:calc(32% - 25px);",
}).appendTo(row);
let buttonPushField = $('<a/>', {
class: "red-ui-button",
style: "margin-left:5px; width:calc(8% - 10px);"
}).appendTo(row);
let buttonLabelField = $('<i/>', {
class: "fa fa-arrow-up",
}).appendTo(buttonPushField);
for (const v in opt.values) {
valueField.append($("<option></option>").val(opt.values[v]).text(opt.values[v]));
}
},
addButton: false
});
callback(null, true);
}
finish() {
//common
if (!mcIsLoaded) {
mcIsLoaded = true;
}
}
;
/*
Show the sidebar help panel from config dialog link
*/
showSidebarHelpPanel(opts) {
let ui = this;
if(!opts) opts = {t:"",v:""};
if (opts.t === 'str' || opts.t === 'command' && opts.v) {
ui.d("showSidebarHelpPanel: " + opts.v)
RED.sidebar.help.show();// >= V1.1.0
$("#musiccast-command-info-" + opts.v.toLowerCase()).get(0).scrollIntoView();
}
}
compare(a, b) {
if (a.label < b.label) {
return -1;
}
if (a.label > b.label) {
return 1;
}
return 0;
}
sort(obj) {
return Object.keys(obj).sort().reduce(function (result, key) {
result[key] = obj[key];
return result;
}, {});
}
uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
destroy() {
}
d(msg){
try {
if (this.debug) console.log(msg);
} catch(err){
console.warn(err)
}
}
}
class MCData {
constructor() {
this.commands = {
"system":{
"type":"system",
"getSettings":{
"name": "getSettings",
"help": "Retrieve clock settings. Details on the output of this command are complex and the included API doc should be consulted.",
"device_command_type": "clock",
"type": "system"
},
"setAutoSync":{
"name": "setAutoSync",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "true"
},
"help": "For setting clock time auto sync.",
"device_command_type": "clock",
"type": "system"
},
"setDateAndTime":{
"name": "setDateAndTime",
"attributes": {
"date_time": "YYMMDDhhmmss"
},
"help": "Set the date and time manually. All characters in [date_time] attribute are integers.",
"device_command_type": "clock",
"type": "system"
},
"setClockFormat":{
"name": "setClockFormat",
"attributes": {
"format": "12h|24h"
},
"attributes_example": {
"format": "24h"
},
"help": "Set the clock format to 12 hour or 24 hour display.",
"device_command_type": "clock",
"type": "system"
},
"setAlarmSettings":{
"name": "setAlarmSettings",
"attributes": {
"alarm_on": "true|false",
"volume": "0|1|2|...",
"fade_interval": "1|...|90",
"fade_type": "1|2|3|...",
"mode": "true|false",
"repeat": "true|false",
"detail": {
"day": "oneday|sunday|monday|...",
"enable": "true|false",
"time": "hhmm",
"beep": "true|false",
"playback_type": "resume|preset",
"preset": {
"type": "netusb",
"num": "1|2|3|..."
},
"resume": {
"type": "<input>>"
}
}
},
"help": "Set an alarm to play a preset or resume playback. Configuration of the attributes are complex and the included API doc should be consulted.",
"device_command_type": "clock",
"type": "system"
},
"getInternalConfig":{
"name": "getInternalConfig",
"help": "Show the known configuration of a device that is stored in Node-RED. This is not a Musiccast function.",
"type": "system"
},
"getDeviceInfo":{
"name": "getDeviceInfo",
"help": "Get detailed information about a a device. Optionally, the model and software versions of the device can be displayed on the palette.",
"help_status_f": "Model | System version | API version",
"status_f": true,
"type": "system"
},
"requestNetworkReboot":{
"name": "requestNetworkReboot",
"help": "Request a network reboot.",
"type": "system"
},
"requestSystemReboot":{
"name": "requestSystemReboot",
"help": "Request a system reboot.",
"type": "system"
},
"getAdvancedFeatures":{
"name": "getAdvancedFeatures",
"help": "Get additional information about the functions installed in the device.",
"type": "system"
},
"getRemoteInfo":{
"name": "getRemoteInfo",
"help": "Retrieve remote monitor information.",
"type": "system"
},
"getStereoPairInfo":{
"name": "getStereoPairInfo",
"help": "Get the status of paired wireless speakers.",
"type": "system"
},
"setAutoPlay":{
"name": "setAutoPlay",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "true"
},
"help": "Set auto play for a device.",
"type": "system"
},
"setSpeakerPattern":{
"name": "setSpeakerPattern",
"attributes": {
"num": "1|2|3|..."
},
"attributes_example": {
"num": "1"
},
"help": "Set speaker pattern for a device.",
"func_dep": "system/getFeatures/speaker_pattern",
"type": "system"
},
"setPartyMode":{
"name": "setPartyMode",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "true"
},
"help": "Set party mode on a device.",
"func_dep": "system/getFeatures/party_mode",
"type": "system"
},
"getFuncStatus":{
"name": "getFuncStatus",
"help": "Get status of device functions.",
"type": "system"
},
"getNetworkStatus":{
"name": "getNetworkStatus",
"help": "Get network status of a device. Optionally, the IP address and connection type of the device can be displayed on the palette.",
"help_status_f": "IP address | Connection type",
"status_f": true,
"type": "system"
},
"getFeatures":{
"name": "getFeatures",
"help": "Get available features for a device. Useful to determine exactly what commands can be called for a device and input.",
"type": "system"
},
"getLocationInfo":{
"name": "getLocationInfo",
"help": "Show which zones a device is a member of. Optionally, the location name can be displayed on the palette..",
"help_status_f": "System name",
"status_f": true,
"type": "system"
},
"sendIrCode":{
"name": "sendIrCode",
"attributes": {
"code": "xxxxxxxx"
},
"help": "Send a specific remote IR code. Code attribute must be an 8-character hex value.",
"type": "system"
},
"setAutoPowerStandby":{
"name": "setAutoPowerStandby",
"attributes_example": {
"enable": "true"
},
"attributes": {
"enable": "true|false"
},
"help": "Change the auto power standby setting for the system.",
"type": "system"
},
"getNameText":{
"name": "getNameText",
"attributes_example": {
"id": "munich"
},
"attributes": {
"id": "main|munich|av1|..."
},
"help": "Get the display names for system elements. Send empty id value to show all.",
"type": "system"
},
"setNameText":{
"name": "setNameText",
"type": "system",
"attributes_example": {
"id": "main",
"text": "New name"
},
"attributes": {
"id": "main|munich|av1|...",
"text": "abcd..."
},
"help": "Change the display name of a system element."
},
"setWiredLan":{
"name": "setWiredLan",
"attributes_example": {
"dhcp": "false",
"ip_address": "192.168.1.2",
"subnet_mask": "255.255.255.0",
"default_gateway": "192.168.1.1",
"dns_server_1": "208.67.222.222",
"dns_server_2": "208.67.220.220"
},
"attributes": {
"dhcp": "true|false",
"ip_address": "n.n.n.n",
"subnet_mask": "n.n.n.n",
"default_gateway": "n.n.n.n",
"dns_server_1": "n.n.n.n",
"dns_server_2": "n.n.n.n"
},
"type": "system",
"help": "Change the settings for the wired LAN port. If attributes are valid, the command will change the device's connection to the LAN port."
},
"setWirelessLan":{
"name": "setWirelessLan",
"type": "system",
"attributes_example": {
"ssid": "MyWifiSSID",
"type": "wpa2-psk(aes)",
"key": "MyPassword",
"dhcp": "true"
},
"attributes": {
"ssid": "AP1-2.4GHz",
"type": "wpa2-psk(aes)|...",
"key": "abcd...",
"dhcp": "true|false",
"ip_address": "n.n.n.n",
"subnet_mask": "n.n.n.n",
"default_gateway": "n.n.n.n",
"dns_server_1": "n.n.n.n",
"dns_server_2": "n.n.n.n"
},
"help": "Change the settings for the Wifi port. If attributes are valid, the command will change the device's connection to Wifi."
},
"setWirelessDirect":{
"name": "setWirelessDirect",
"type": "system",
"attributes_example": {
"type": "wpa2-psk(aes)",
"key": "MyPassword"
},
"attributes": {
"type": "wpa2-psk(aes)|...",
"key": "abcd..."
},
"help": "Configure settings for Wireless Direct feature. If attributes are valid, the command will change the device's connection to Wireless Direct."
},
"setIpSettings":{
"name": "setIpSettings",
"type": "system",
"attributes_example": {
"dhcp": "false",
"ip_address": "192.168.0.5",
"subnet_mask": "255.255.255.0",
"default_gateway": "192.168.0.1",
"dns_server_1": "208.67.222.222",
"dns_server_2": "208.67.220.220"
},
"attributes": {
"dhcp": "true|false",
"ip_address": "n.n.n.n",
"subnet_mask": "n.n.n.n",
"default_gateway": "n.n.n.n",
"dns_server_1": "n.n.n.n",
"dns_server_2": "n.n.n.n"
},
"help": "Changes the IP settings only for the currently active network connection."
},
"setNetworkName":{
"name": "setNetworkName",
"type": "system",
"attributes_example": {
"name": "My device network name"
},
"attributes": {
"name": "Living room|Office|..."
},
"help": "Set the device's name to a value that should appear on the local network."
},
"setAirPlayPin":{
"name": "setAirPlayPin",
"type": "system",
"attributes_example": {
"enable": "nnnnnnnn"
},
"attributes": {
"pin": "abc123..."
},
"help": "Set the PIN needed for an AirPlay connection."
},
"getMacAddressFilter":{
"name": "getMacAddressFilter",
"help": "Get the current list of MAC addresses that are being filtered.",
"type": "system"
},
"setMacAddressFilter":{
"name": "setMacAddressFilter",
"type": "system",
"attributes_example": {
"filter": "true",
"address_1": "00A0DE1BFFFA",
"address_2": "00A0DE1BFFFB"
},
"attributes": {
"filter": "true|false",
"address_1": "xxxxxxxxxxxx",
"address_2": "xxxxxxxxxxxx",
"address_3": "xxxxxxxxxxxx",
"address_10": "xxxxxxxxxxxx"
},
"help": "Add MAC addresses to the filter and/or enable and disable the filter."
},
"getNetworkStandby":{
"name": "getNetworkStandby",
"help": "Retrieve current setting for the network standby option.",
"type": "system"
},
"setNetworkStandby":{
"name": "setNetworkStandby",
"attributes": {
"standby": "on|off|auto"
},
"help": "Change network standby option.",
"type": "system"
},
"getBluetoothInfo":{
"name": "getBluetoothInfo",
"help": "Retrieve Bluetooth information.",
"type": "system"
},
"setBluetoothStandby":{
"name": "setBluetoothStandby",
"attributes": {
"enable": "true|false"
},
"help": "Set Bluetooth standby.",
"attributes_example": {
"enable": "true"
},
"type": "system"
},
"setBluetoothTxSetting":{
"name": "setBluetoothTxSetting",
"attributes": {
"enable": "true|false"
},
"help": "Enable or disable Bluetooth transmission.",
"attributes_example": {
"enable": "true"
},
"type": "system"
},
"getBluetoothDeviceList":{
"name": "getBluetoothDeviceList",
"help": "Change",
"type": "system"
},
"updateBluetoothDeviceList":{
"name": "updateBluetoothDeviceList",
"help": "Refresh list of detected Bluetooth devices.",
"type": "system"
},
"connectBluetoothDevice":{
"name": "connectBluetoothDevice",
"attributes": {
"address": "xxxxxxxxxx"
},
"attributes_example": {
"address": "xxxxxxxxxx"
},
"help": "Connect a Bluetooth device given its MAC address.",
"type": "system"
},
"disconnectBluetoothDevice":{
"name": "disconnectBluetoothDevice",
"help": "Disconnect the Bluetooth device.",
"type": "system"
},
"setIrSensor":{
"name": "setIrSensor",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "true"
},
"help": "Enable or disable remote control IR sensor.",
"type": "system"
},
"setSpeakerA":{
"name": "setSpeakerA",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "false"
},
"help": "Change Speaker A configuration.",
"type": "system"
},
"setSpeakerB":{
"name": "setSpeakerB",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "true"
},
"help": "Change Speaker B configuration.",
"type": "system"
},
"setDimmer":{
"name": "setDimmer",
"attributes": {
"value": "0|1|2|...|-1"
},
"attributes_example": {
"value": "4"
},
"help": "Set the dimmer level. Set value of '-1' for auto.",
"type": "system"
},
"setZoneBVolumeSync":{
"name": "setZoneBVolumeSync",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "true"
},
"help": "Enable or disable Zone B volume sync.",
"type": "system"
},
"setHdmiOut1":{
"name": "setHdmiOut1",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "true"
},
"help": "Turn HDMI 1 output on or off.",
"type": "system"
},
"setHdmiOut2":{
"name": "setHdmiOut2",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "true"
},
"help": "Turn HDMI 2 output on or off.",
"type": "system"
},
"setHdmiOut3":{
"name": "setHdmiOut3",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "true"
},
"help": "Turn HDMI 3 output on or off.",
"type": "system"
},
}, "link":{
"type":"link",
"getDistributionInfo":{
"name": "getDistributionInfo",
"help": "Get current distribution information.",
"status_f": true,
"help_status_f": "Group name ( role }",
"type": "link"
},
"setGroupName":{
"type": "link",
"name": "setGroupName",
"attributes": {
"name": "xxxxxxxxx"
},
"attributes_example": {
"name": "DISTGROUPNAME"
},
"help": "Set the friendly name for a group on a device. Leave name empty to set to default. The default is assigned when setting up a group so this command is typically not required."
},
"setClientInfo":{
"name": "setClientInfo",
"type": "link",
"attributes": {
"group_id": "00000000000000000000000000000000",
"zone": "main|zone1|...",
"server_ip_address": "x.x.x.x"
},
"attributes_example": {
"group_id": "00000000000000000000000000000000",
"zone": "main",
"server_ip_address": "127.0.5.6"
},
"help": "Set a device as a distribution client. Set group_id to an empty string to remove a device from a group."
},
"setServerInfo":{
"name": "setServerInfo",
"type": "link",
"attributes": {
"group_id": "00000000000000000000000000000000",
"type": "add|remove",
"zone": "main|zone1|...",
"client_list": [
"x.x.x.x"
]
},
"attributes_example": {
"group_id": "00000000000000000000000000000000",
"type": "add",
"zone": "main",
"client_list": [
"192.168.1.5",
"192.168.1.6"
]
},
"help": "Configure a device's role as a distribution server. Set group_id to a value of an empty string to stop the device from being a server."
},
"startDistribution":{
"name": "startDistribution",
"attributes": {
"num": "0|1|..."
},
"attributes_example": {
"num": 1
},
"help": "Send command to start distribution for a device that is configured as a server.",
"type": "link"
},
"stopDistribution":{
"name": "stopDistribution",
"help": "Command a device to stop distribution.",
"type": "link"
},
}, "zone":{
"type":"zone",
"getConfig":{
"disabled": true,
"name": "getConfig",
"help": "Get zone config. This is not a Musiccast function.",
"type": "zone",
"att_f": true
},
"getBasicStatus":{
"disabled": true,
"name": "getBasicStatus",
"help": "Get basic zone status. This is not a Musiccast function.",
"type": "zone",
"att_f": true
},
"sceneLoad":{
"disabled": true,
"name": "sceneLoad",
"attributes": {
"Scene": "1|2|..."
},
"attributes_example": {
"Scene": "1"
},
"help": "Load a scene by its number. This is not a Musiccast function.",
"type": "zone",
"att_f": true
},
"setPower":{
"name": "setPower",
"attributes": {
"power": "on|off|toggle|standby"
},
"attributes_example": {
"power": "toggle"
},
"help": "Change the power state of a zone.",
"response_example": {},
"type": "zone"
},
"setLinkAudioQuality":{
"name": "setLinkAudioQuality",
"attributes": {
"mode": "compressed"
},
"attributes_example": {
"mode": "compressed"
},
"help": "For setting Link Audio Quality in a zone.",
"response_example": {},
"type": "zone"
},
"setLinkControl":{
"name": "setLinkControl",
"attributes": {
"control": "normal"
},
"help": "For setting Link Control in a zone.",
"response_example": {},
"type": "zone"
},
"setLinkAudioDelay":{
"name": "setLinkAudioDelay",
"attributes": {
"delay": "lip_sync"
},
"help": "For setting Link Audio Delay in a zone. This setting is invalid when Link Control setting is \" Stability Boost \".",
"type": "zone"
},
"setAutoPowerStandby":{
"name": "setAutoPowerStandby",
"attributes": {
"enable": "true|false"
},
"help": "Change the auto power standby setting for a zone.",
"type": "zone"
},
"setVolume":{
"name": "setVolume",
"attributes": {
"volume": "up|down|1|2|...",
"step": "1|...|5"
},
"attributes_example": {
"volume": "up",
"step": "3"
},
"help": "Change the volume of a zone in steps or to a specific value.",
"type": "zone"
},
"setMute":{
"name": "setMute",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "true|false"
},
"help": "Set or unset zone mute.",
"type": "zone"
},
"getStatus":{
"name": "getStatus",
"help": "Get current status information about a zone. Optionally, the current power and active input can be displayed on the palette.",
"help_status_f": "Power | Volume",
"status_f": true,
"type": "zone"
},
"getSignalInfo":{
"name": "getSignalInfo",
"help": "Get details on the format of the currently playing media. Optionally, the audio format and rate of media can be displayed on the palette.",
"help_status_f": "Format | Bitrate",
"status_f": true,
"type": "zone"
},
"getSoundProgramList":{
"name": "getSoundProgramList",
"help": "Get a list of sound programs available to device in its assigned zone.",
"type": "zone"
},
"setSoundProgram":{
"name": "setSoundProgram",
"attributes": {
"program": "munich|vienna|..."
},
"attributes_example": {
"program": "vienna"
},
"help": "Set a sound program for a zone.",
"selectors": [
{
"program": {
"source": "zone:zone_list"
}
}
],
"type": "zone"
},
"setInput":{
"name": "setInput",
"attributes": {
"input": "juke|tidal|qobuz|deezer|server|bluetooth|airplay|mc_link|usb",
"mode": "autoplay_disabled"
},
"attributes_example": {
"input": "server",
"mode": "autoplay_disabled"
},
"status_f": true,
"help": "Change to the designated playback source for a zone. Autoplay can be enabled or disabled.",
"type": "zone"
},
"setSleep":{
"name": "setSleep",
"attributes": {
"sleep": "0|...|180"
},
"attributes_example": {
"sleep": "60"
},
"help": "Set the sleep timer in minutes. Set [sleep] attributes parameter to '0' to cancel an existing timer.",
"type": "zone"
},
"prepareInputChange":{
"name": "prepareInputChange",
"attributes": {
"input": "juke|tidal|qobuz|deezer|server|bluetooth|airplay|mc_link|usb"
},
"attributes_example": {
"input": "usb"
},
"help": "Let a device do necessary process before changing input in a specific zone. This is valid only when 'prepare_input_change' exists in “func_list” found in /system/getFuncStatus.",
"type": "zone"
},
"recallScene":{
"name": "recallScene",
"attributes": {
"num": "1|2|3..."
},
"attributes_example": {
"num": "3"
},
"help": "Load a pre-defined scene.",
"func_dep": "system/getFeatures/scene",
"type": "zone"
},
"setActualVolume":{
"name": "setActualVolume",
"attributes": {
"mode": "up|down|1|2|...",
"value": "1|2|3|..."
},
"attributes_example": {
"mode": "down",
"value": "3"
},
"help": "Calculated from minimum value, maximum value, step value of volume gotten via /system/getFeatures. Attribute [mode] also comes from /system/getFeatures",
"func_dep": "system/getFeatures/actual_volume",
"type": "zone"
},
"setContentsDisplay":{
"name": "setContentsDisplay",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "true"
},
"help": "Load a pre-defined scene.",
"func_dep": "system/getFeatures/contents_display",
"type": "zone"
},
"setAudioSelect":{
"name": "setAudioSelect",
"attributes": {
"type": "auto|hdmi|coax_opt|..."
},
"attributes_example": {
"enable": "hdmi"
},
"help": "Audio_decoder_list gotten via /system/getFeatures.",
"func_dep": "system/getFeatures/Audio_decoder_list",
"type": "zone"
},
"controlCursor":{
"name": "controlCursor",
"attributes": {
"cursor": "up|down|left|right|select|return"
},
"attributes_example": {
"cursor": "select"
},
"help": "Simulate operation of the cursor keys on the remote control.",
"func_dep": "system/getFeatures/cursor",
"type": "zone"
},
"controlMenu":{
"name": "controlMenu",
"attributes": {
"menu": "on_screen|top_menu|menu|option|display|red|green|yellow|blue"
},
"attributes_example": {
"menu": "top_menu"
},
"help": "Simulate operation of the menu keys on the remote control.",
"func_dep": "system/getFeatures/menu_list",
"type": "zone"
},
"setSurroundDecoderType":{
"name": "setSurroundDecoderType",
"attributes": {
"type": "auto|toggle|dolby_surround|dts_neural_x|dts_neo6_cinema|dts_neo6_music"
},
"attributes_example": {
"type": "dts_neural_x"
},
"help": "List of types available via System - getFeatures",
"type": "zone"
},
"set3dSurround":{
"name": "set3dSurround",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "true"
},
"help": "Enable or disable 3D Surround.",
"type": "zone"
},
"setDirect":{
"name": "setDirect",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "true"
},
"help": "Enable or disable direct.",
"type": "zone"
},
"setPureDirect":{
"name": "setPureDirect",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "true"
},
"help": "Enable or disable Pure Direct.",
"type": "zone"
},
"setEnhancer":{
"name": "setEnhancer",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "true"
},
"help": "Enable or disable the enhancer.",
"response_example": {},
"type": "zone"
},
"setToneControl":{
"name": "setToneControl",
"attributes": {
"mode": "manual",
"bass": "1|2|3|...",
"treble": "1|2|3|..."
},
"attributes_example": {
"mode": "manual",
"bass": "3",
"treble": "2"
},
"help": "Set specific values for tone or set to auto.",
"type": "zone"
},
"setEqualizer":{
"name": "setEqualizer",
"attributes": {
"mode": "manual",
"low": "1|2|3|...",
"mid": "1|2|3|...",
"high": "1|2|3|..."
},
"attributes_example": {
"mode": "manual",
"low": "2",
"mid": "4",
"high": "3"
},
"help": "Set specific values for the equalizer or set to auto.",
"type": "zone"
},
"setBalance":{
"name": "setBalance",
"attributes": {
"value": "-1|01|2|3|..."
},
"attributes_example": {
"value": "3"
},
"help": "Set the balance between right and left speakers. Negative values are for left side, positive values are for right side balance.",
"type": "zone"
},
"setDialogueLevel":{
"name": "setDialogueLevel",
"attributes": {
"value": "1|2|3|..."
},
"attributes_example": {
"value": "3"
},
"help": "Set the Dialog volume.",
"type": "zone"
},
"setClearVoice":{
"name": "setClearVoice",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "false"
},
"help": "Set clear voice for a zone.",
"type": "zone"
},
"setDialogueLift":{
"name": "setDialogueLift",
"attributes": {
"value": "1|2|3|..."
},
"attributes_example": {
"value": "3"
},
"help": "Set the Dialog Lift volume.",
"type": "zone"
},
"setSubwooferVolume":{
"name": "setSubwooferVolume",
"attributes": {
"volume": "1|2|3|..."
},
"attributes_example": {
"volume": "3"
},
"help": "Set the subwoofer volume for a zone.",
"type": "zone"
},
"setBassExtension":{
"name": "setBassExtension",
"attributes": {
"enable": "true|false"
},
"attributes_example": {
"enable": "false"
},
"help": "Enable or disable the bass extension.",
"type": "zone"
},
}, "input":{
"type":"input",
"toggleRepeat":{
"name": "toggleRepeat",
"help": "Enable or disable repeat for the specified network source or CD player.",
"play_info_type": [
"netusb",
"cd"
],
"type": "input"
},
"getRecentInfo":{
"name": "getRecentInfo",
"help": "Enable list of recently played items.",
"play_info_type": [
"netusb"
],
"type": "input"
},
"toggleShuffle":{
"name": "toggleShuffle",
"help": "Enable or disable shuffle for the specified network source or CD player.",
"play_info_type": [
"netusb",
"cd"
],
"type": "input"
},
"setPlayback":{
"name": "setPlayback",
"attributes": {
"playback": "stop|pause|play|previous|next|fast_reverse_start|fast_reverse_end|fast_forward_start|fast_forward_end|track_select",
"num": "1|...|512"
},
"help": "Various options to alter the playback state of the input.",
"play_info_type": [
"netusb"
],
"type": "input"
},
"setPlayback_cd":{
"name": "setPlayback",
"label": " (CD)",
"attributes": {
"playback": "stop|pause|play|previous|next|fast_reverse_start|fast_reverse_end|fast_forward_start|fast_forward_end|track_select",
"num": "1|...|512"
},
"help": "Various options to alter the playback state of the input. Attribute [num] is only used when [playback] is 'track_select'.",
"play_info_type": [
"cd"
],
"type": "input"
},
"setPlayPosition":{
"name": "setPlayPosition",
"attributes": {
"position": "1|3|65|..."
},
"help": "For setting track play position. This command is available only when input is set to Server",
"type": "input"
},
"getPlayInfo":{
"name": "getPlayInfo",
"help": "Get information on currently playing media of the active network service. Optionally, the returned playback state can be displayed on the palette.<p>Note: Value of [Input] is redundant for this command.</p",
"help_status_f": "Current input | Playback state",
"status_f": true,
"type": "input"
},
"getPresetInfo":{
"name": "getPresetInfo",
"help": "Get preset information of the network sources or tuner.",
"attributes": {
"band": "common|am|fm|dab"
},
"play_info_type": [
"netusb",
"tuner"
],
"type": "input"
},
"getSettings":{
"name": "getSettings",
"help": "Retrieve netusb settings.",
"play_info_type": [
"netusb"
],
"type": "input"
},
"recallPreset":{
"name": "recallPreset",
"attributes": {
"zone": "main|zone1|...",
"num": "1|2|3|..."
},
"help": "Recalls presets for the MusicCast system. Use zone name from [getLocationInfo]. Command will cause an input change if applicable.",
"play_info_type": [
"netusb",
"tuner"
],
"type": "input"
},
"movePreset":{
"name": "movePreset",
"attributes": {
"from": "1|2|3|...",
"to": "1|2|3|..."
},
"help": "Move preset from one location to the other.",
"play_info_type": [
"netusb",
"tuner"
],
"type": "input"
},
"storePreset":{
"name": "storePreset",
"attributes": {
"num": "1|2|3|..."
},
"help": "Store the currently playing media as a pre