|
@ -102,7 +102,8 @@ var is_group = [ |
|
|
"ssid", "pass", "gw", "mask", "ip", "dns", |
|
|
"ssid", "pass", "gw", "mask", "ip", "dns", |
|
|
"relayBoot", "relayPulse", "relayTime", |
|
|
"relayBoot", "relayPulse", "relayTime", |
|
|
"mqttGroup", "mqttGroupInv", |
|
|
"mqttGroup", "mqttGroupInv", |
|
|
"dczRelayIdx", |
|
|
|
|
|
|
|
|
"dczRelayIdx", "dczMagnitude", |
|
|
|
|
|
"tspkRelay", "tspkMagnitude", |
|
|
"ledMode", |
|
|
"ledMode", |
|
|
"adminPass" |
|
|
"adminPass" |
|
|
]; |
|
|
]; |
|
@ -394,36 +395,36 @@ function toggleMenu() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
// -----------------------------------------------------------------------------
|
|
|
// Domoticz
|
|
|
|
|
|
|
|
|
// Relays & magnitudes mapping
|
|
|
// -----------------------------------------------------------------------------
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
function createRelayIdxs(data) { |
|
|
|
|
|
|
|
|
function createRelayList(data, container, template) { |
|
|
|
|
|
|
|
|
var current = $("#domoticzRelays > div").length; |
|
|
|
|
|
|
|
|
var current = $("#" + container + " > div").length; |
|
|
if (current > 0) return; |
|
|
if (current > 0) return; |
|
|
|
|
|
|
|
|
var template = $("#relayIdxTemplate .pure-g")[0]; |
|
|
|
|
|
|
|
|
var template = $("#" + template + " .pure-g")[0]; |
|
|
for (var i=0; i<data.length; i++) { |
|
|
for (var i=0; i<data.length; i++) { |
|
|
var line = $(template).clone(); |
|
|
var line = $(template).clone(); |
|
|
$("label", line).html("Switch #" + i); |
|
|
$("label", line).html("Switch #" + i); |
|
|
$("input", line).attr("name", "dczRelayIdx" + i).attr("tabindex", 40 + i).val(data[i]); |
|
|
|
|
|
line.appendTo("#domoticzRelays"); |
|
|
|
|
|
|
|
|
$("input", line).attr("tabindex", 40 + i).val(data[i]); |
|
|
|
|
|
line.appendTo("#" + container); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function createMagnitudeIdxs(data) { |
|
|
|
|
|
|
|
|
function createMagnitudeList(data, container, template) { |
|
|
|
|
|
|
|
|
var current = $("#domoticzMagnitudes > div").length; |
|
|
|
|
|
|
|
|
var current = $("#" + container + " > div").length; |
|
|
if (current > 0) return; |
|
|
if (current > 0) return; |
|
|
|
|
|
|
|
|
var template = $("#magnitudeIdxTemplate .pure-g")[0]; |
|
|
|
|
|
|
|
|
var template = $("#" + template + " .pure-g")[0]; |
|
|
for (var i=0; i<data.length; i++) { |
|
|
for (var i=0; i<data.length; i++) { |
|
|
var line = $(template).clone(); |
|
|
var line = $(template).clone(); |
|
|
$("label", line).html(magnitudeType(data[i].type) + " #" + parseInt(data[i].index)); |
|
|
$("label", line).html(magnitudeType(data[i].type) + " #" + parseInt(data[i].index)); |
|
|
$("div.hint", line).html(data[i].name); |
|
|
$("div.hint", line).html(data[i].name); |
|
|
$("input", line).attr("name", "dczMagnitude" + i).attr("tabindex", 40 + i).val(data[i].idx); |
|
|
|
|
|
line.appendTo("#domoticzMagnitudes"); |
|
|
|
|
|
|
|
|
$("input", line).attr("tabindex", 40 + i).val(data[i].idx); |
|
|
|
|
|
line.appendTo("#" + container); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
@ -842,14 +843,30 @@ function processData(data) { |
|
|
// ---------------------------------------------------------------------
|
|
|
// ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
// Domoticz - Relays
|
|
|
// Domoticz - Relays
|
|
|
if (key == "dczRelayIdx") { |
|
|
|
|
|
createRelayIdxs(data[key]); |
|
|
|
|
|
|
|
|
if (key == "dczRelays") { |
|
|
|
|
|
createRelayList(data[key], "dczRelays", "dczRelayTemplate"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Domoticz - Magnitudes
|
|
|
// Domoticz - Magnitudes
|
|
|
if (key == "dczMagnitudes") { |
|
|
if (key == "dczMagnitudes") { |
|
|
createMagnitudeIdxs(data[key]); |
|
|
|
|
|
|
|
|
createMagnitudeList(data[key], "dczMagnitudes", "dczMagnitudeTemplate"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
|
|
|
// Thingspeak
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
// Thingspeak - Relays
|
|
|
|
|
|
if (key == "tspkRelays") { |
|
|
|
|
|
createRelayList(data[key], "tspkRelays", "tspkRelayTemplate"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Thingspeak - Magnitudes
|
|
|
|
|
|
if (key == "tspkMagnitudes") { |
|
|
|
|
|
createMagnitudeList(data[key], "tspkMagnitudes", "tspkMagnitudeTemplate"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|