mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
mDNS Support (#1452)
* Allow build, if no grabbers are enabled * Align available functions to right Qt version * Update to next development version * Align available functions to right Qt version * fix workflows (apt/nightly) * Disable QNetworkConfigurationManager deprecation warnings * Initial go on Smart Pointers * Add Deallocation * Correct QT_WARNING_DISABLE_DEPRECATED (available since 5.9) * Cluster Build Variables * Hyperion Light * Address build warnings * Hyperion Light - UI * Update Protobuf to latest master * Removed compiler warnings * Added restart ability to systray * Correct Protobuf * Ignore 'no-return' warning on protobuf build * hyperion-remote: Fix auto discovery of hyperion server * Fix Qt version override * Update changelog * Remove Grabber Components, if no Grabber exists * Standalone Grabber - Fix fps default * Remote Control - Have Source Selction accrosswhole screen * Enable Blackborder detection only, if relevant input sources available * Enable Blackborder detection only, if relevant input sources available * Remote UI - rearrange containers * Checkout * Fix compilation on windows * Re-added qmdnsengine template cmake * chrono added for linux * Removed existing AVAHI/Bonjour, allow to enable/disable mDNS * hyperiond macos typo fix * Fix macOS Bundle build * Fix macOS bundle info details * Correct CMake files * Removed existing AVAHI/Bonjour (2) * Share hyperion's services via mDNS * Add mDNS Browser and mDNS for LED-Devices * Support mDNS discovery for standalone grabbers * Remove ZLib Dependency & Cleanup * mDNS - hanle 2.local2 an ".local." domains equally * Hue - Link discovery to bridge class, workaround port 443 for mDNS discovery * Fix save button state when switching between devices * Removed sessions (of other hyperions) * mDNS Publisher - Simplify service naming * mDNS refactoring & Forwarder discovery * mDNS Updates to use device service name * Consistency of standalone grabbers with mDNS Service Registry * Merge branch 'hyperion-project:master' into mDNS * Start JSON and WebServers only after Instance 0 is available * Remove bespoke qDebug Output again * MDNS updates and refactor Forwarder * Minor updates * Upgrade to CMake 3.1 * typo * macOS fix * Correct merge * - Remove dynamic linker flag from standalone dispmanX Grabber - Added ability to use system qmdns libs * Cec handler library will load at runtime * typo fix * protobuf changes * mDNS changes for Windows/macOS * test window build qmdnsengine * absolute path to protobuf cmake dir * Rework Hue Wizard supporting mDNS * LED-Devices - Retry support + Refactoring (excl. Hue) * LED-Devices - Refactoring/Retry support Hue + additional alignments * Address LGTM findings * Fix CI-Build, revert test changes * Build Windows in Release mode to avoid python problem * Correct that WebServerObject is available earlier * Ensure that instance name in logs for one instance are presented * Update content LEDs * Rework mDNS Address lookup * Fix LED UI * Fix for non mDNS Services (ignore default port) * Disbale device when now input is available * Revert back some updates, ensure last color is updated when switched on * Handle reopening case and changed IP, port for API-calls * Add UPD-DDP Device * WLED support for DDP * Fix printout * LEDDevice - Allow more retries, udapte defaults * LED-Net Devices - Select Custom device, if configured Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com> Co-authored-by: Paulchen Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
@@ -88,6 +88,16 @@
|
||||
"conf_leds_layout_cl_leftbottom": "Left 50% - 100% Bottom",
|
||||
"conf_leds_layout_cl_leftmiddle": "Left 25% - 75% Middle",
|
||||
"conf_leds_layout_cl_lefttop": "Left 0% - 50% Top",
|
||||
"conf_leds_layout_cl_lightPosBottomLeft14": "Bottom: 0 - 25% from Left",
|
||||
"conf_leds_layout_cl_lightPosBottomLeft12": "Bottom: 25 - 50% from Left",
|
||||
"conf_leds_layout_cl_lightPosBottomLeft34": "Bottom: 50 - 75% from Left",
|
||||
"conf_leds_layout_cl_lightPosBottomLeft11": "Bottom: 75 - 100% from Left",
|
||||
"conf_leds_layout_cl_lightPosBottomLeft112": "Bottom: 0 - 50% from Left",
|
||||
"conf_leds_layout_cl_lightPosBottomLeft121": "Bottom: 50 - 100% from Left",
|
||||
"conf_leds_layout_cl_lightPosBottomLeftNewMid": "Bottom: 25 - 75% from Left",
|
||||
"conf_leds_layout_cl_lightPosTopLeft112": "Top: 0 - 50% from Left",
|
||||
"conf_leds_layout_cl_lightPosTopLeft121": "Top: 50 - 100% from Left",
|
||||
"conf_leds_layout_cl_lightPosTopLeftNewMid": "Top: 25 - 75% from Left",
|
||||
"conf_leds_layout_cl_overlap": "Overlap",
|
||||
"conf_leds_layout_cl_reversdir": "Reverse direction",
|
||||
"conf_leds_layout_cl_right": "Right",
|
||||
@@ -329,6 +339,8 @@
|
||||
"edt_conf_enum_top_down": "Top down",
|
||||
"edt_conf_enum_transeffect_smooth": "Smooth",
|
||||
"edt_conf_enum_transeffect_sudden": "Sudden",
|
||||
"edt_conf_enum_udp_ddp": "DDP",
|
||||
"edt_conf_enum_udp_raw": "RAW",
|
||||
"edt_conf_enum_unicolor_mean": "Unicolor",
|
||||
"edt_conf_fbs_heading_title": "Flatbuffers Server",
|
||||
"edt_conf_fbs_timeout_expl": "If no data is received for the given period, the component will be (soft) disabled.",
|
||||
@@ -355,13 +367,20 @@
|
||||
"edt_conf_fge_heading_title": "Boot Effect/Color",
|
||||
"edt_conf_fge_type_expl": "Choose between a color or effect.",
|
||||
"edt_conf_fge_type_title": "Type",
|
||||
"edt_conf_fw_flat_expl": "One flatbuffer target per line. Contains IP:PORT (Example: 127.0.0.1:19401)",
|
||||
"edt_conf_fw_flat_expl": "One flatbuffer target per configuration item",
|
||||
"edt_conf_fw_flat_itemtitle": "flatbuffer target",
|
||||
"edt_conf_fw_flat_services_discovered_expl": "Hyperion servers discovered providing flatbuffer services",
|
||||
"edt_conf_fw_flat_services_discovered_title": "Flatbuffer targets discoverded",
|
||||
"edt_conf_fw_flat_title": "List of flatbuffer targets",
|
||||
"edt_conf_fw_heading_title": "Forwarder",
|
||||
"edt_conf_fw_json_expl": "One json target per line. Contains IP:PORT (Example: 127.0.0.1:19446)",
|
||||
"edt_conf_fw_json_itemtitle": "Json target",
|
||||
"edt_conf_fw_json_title": "List of json targets",
|
||||
"edt_conf_fw_json_expl": "One JSON target per configuration item",
|
||||
"edt_conf_fw_json_itemtitle": "JSON target",
|
||||
"edt_conf_fw_json_services_discovered_expl": "Hyperion servers discovered providing JSON-API services",
|
||||
"edt_conf_fw_json_services_discovered_title": "JSON targets discoverded",
|
||||
"edt_conf_fw_json_title": "List of JSON targets",
|
||||
"edt_conf_fw_remote_service_discovered_none": "No remote services discovered",
|
||||
"edt_conf_fw_service_name_expl": "Name of the service provider",
|
||||
"edt_conf_fw_service_name_title": "Service name",
|
||||
"edt_conf_gen_configVersion_title": "Configuration version",
|
||||
"edt_conf_gen_heading_title": "General Settings",
|
||||
"edt_conf_gen_name_expl": "A user defined name which is used to detect Hyperion. (Helpful with more than one Hyperion instance)",
|
||||
@@ -510,6 +529,10 @@
|
||||
"edt_dev_general_autostart_title_info": "The LED device is switched-on during startup or not",
|
||||
"edt_dev_general_colorOrder_title": "RGB byte order",
|
||||
"edt_dev_general_colorOrder_title_info": "The device's color order",
|
||||
"edt_dev_general_enableAttempts_title": "Connection attempts",
|
||||
"edt_dev_general_enableAttempts_title_info": "Number of attempts connecting a device before it goes into an error state.",
|
||||
"edt_dev_general_enableAttemptsInterval_title": "Retry interval",
|
||||
"edt_dev_general_enableAttemptsInterval_title_info": "Intervall between two connection attempts.",
|
||||
"edt_dev_general_hardwareLedCount_title": "Hardware LED count",
|
||||
"edt_dev_general_hardwareLedCount_title_info": "The number of physical LEDs availabe for the given device",
|
||||
"edt_dev_general_heading_title": "General Settings",
|
||||
@@ -523,17 +546,15 @@
|
||||
"edt_dev_spec_baudrate_title": "Baudrate",
|
||||
"edt_dev_spec_blackLightsTimeout_title": "Signal detection timeout on black",
|
||||
"edt_dev_spec_brightnessFactor_title": "Brightness factor",
|
||||
"edt_dev_spec_brightnessMax_title": "Brightness maximum",
|
||||
"edt_dev_spec_brightnessMin_title": "Brightness minimum",
|
||||
"edt_dev_spec_brightnessOverwrite_title": "Overwrite brightness",
|
||||
"edt_dev_spec_brightnessThreshold_title": "Signal detection brightness minimum",
|
||||
"edt_dev_spec_brightness_title": "Brightness",
|
||||
"edt_dev_spec_candyGamma_title" : "'Candy' mode (double gamma correction)",
|
||||
"edt_dev_spec_chanperfixture_title": "Channels per Fixture",
|
||||
"edt_dev_spec_cid_title": "CID",
|
||||
"edt_dev_spec_clientKey_title": "Clientkey",
|
||||
"edt_dev_spec_colorComponent_title": "Colour component",
|
||||
"edt_dev_spec_debugLevel_title": "Debug Level",
|
||||
"edt_dev_spec_debugStreamer_title": "Streamer Debug",
|
||||
"edt_dev_spec_delayAfterConnect_title": "Delay after connect",
|
||||
"edt_dev_spec_devices_discovered_none": "No Devices Discovered",
|
||||
"edt_dev_spec_devices_discovered_title": "Devices Discovered",
|
||||
@@ -568,6 +589,8 @@
|
||||
"edt_dev_spec_networkDeviceName_title": "Network devicename",
|
||||
"edt_dev_spec_networkDevicePort_title": "Port",
|
||||
"edt_dev_spec_numberOfLeds_title": "Number of LEDs",
|
||||
"edt_dev_spec_onBlackTimeToPowerOff": "Time to power off the lamp if the black level is triggered",
|
||||
"edt_dev_spec_onBlackTimeToPowerOn": "Time to power on the lamp if the signal is restored",
|
||||
"edt_dev_spec_orbIds_title": "Orb ID(s)",
|
||||
"edt_dev_spec_order_left_right_title": "2.",
|
||||
"edt_dev_spec_order_top_down_title": "1.",
|
||||
@@ -575,8 +598,10 @@
|
||||
"edt_dev_spec_panel_start_position": "Start panel [0-max panels]",
|
||||
"edt_dev_spec_panelorganisation_title": "Panel numbering sequence",
|
||||
"edt_dev_spec_pid_title": "PID",
|
||||
"edt_dev_spec_port_expl": "Service Port [1-65535]",
|
||||
"edt_dev_spec_port_title": "Port",
|
||||
"edt_dev_spec_printTimeStamp_title": "Add timestamp",
|
||||
"edt_dev_spec_stream_protocol_title": "Streaming protocol",
|
||||
"edt_dev_spec_pwmChannel_title": "PWM channel",
|
||||
"edt_dev_spec_razer_device_title": "Razer Chroma Device",
|
||||
"edt_dev_spec_restoreOriginalState_title": "Restore lights' state",
|
||||
@@ -585,10 +610,10 @@
|
||||
"edt_dev_spec_spipath_title": "SPI Device",
|
||||
"edt_dev_spec_sslHSTimeoutMax_title": "Streamer handshake timeout maximum",
|
||||
"edt_dev_spec_sslHSTimeoutMin_title": "Streamer handshake timeout minimum",
|
||||
"edt_dev_spec_sslReadTimeout_title": "Streamer read timeout",
|
||||
"edt_dev_spec_switchOffOnBlack_title": "Switch off on black",
|
||||
"edt_dev_spec_switchOffOnbelowMinBrightness_title": "Switch-off, below minimum",
|
||||
"edt_dev_spec_syncOverwrite_title": "Disable synchronisation",
|
||||
"edt_dev_spec_targetIpHost_expl": "Hostname (DNS/mDNS) or IP-address (IPv4 orIPv6)",
|
||||
"edt_dev_spec_targetIpHost_title": "Hostname/IP-address",
|
||||
"edt_dev_spec_targetIpHost_title_info": "The device's hostname or IP-address",
|
||||
"edt_dev_spec_targetIp_title": "IP-address",
|
||||
|
@@ -1,5 +1,5 @@
|
||||
$(document).ready(function () {
|
||||
var darkModeOverwrite = getStorage("darkModeOverwrite", true);
|
||||
var darkModeOverwrite = getStorage("darkModeOverwrite");
|
||||
|
||||
if (darkModeOverwrite == "false" || darkModeOverwrite == null) {
|
||||
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
@@ -7,11 +7,11 @@ $(document).ready(function () {
|
||||
}
|
||||
|
||||
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) {
|
||||
setStorage("darkMode", "off", false);
|
||||
setStorage("darkMode", "off");
|
||||
}
|
||||
}
|
||||
|
||||
if (getStorage("darkMode", false) == "on") {
|
||||
if (getStorage("darkMode") == "on") {
|
||||
handleDarkMode();
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ $(document).ready(function () {
|
||||
$('#btn_hypinstanceswitch').toggle(true)
|
||||
else
|
||||
$('#btn_hypinstanceswitch').toggle(false)
|
||||
updateSessions();
|
||||
}); // end cmd-serverinfo
|
||||
|
||||
// Update language selection
|
||||
@@ -73,11 +72,6 @@ $(document).ready(function () {
|
||||
|
||||
//End language selection
|
||||
|
||||
$(window.hyperion).on("cmd-sessions-update", function (event) {
|
||||
window.serverInfo.sessions = event.response.data;
|
||||
updateSessions();
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-authorize-tokenRequest cmd-authorize-getPendingTokenRequests", function (event) {
|
||||
var val = event.response.info;
|
||||
if (Array.isArray(event.response.info)) {
|
||||
@@ -121,7 +115,7 @@ $(document).ready(function () {
|
||||
requestGetPendingTokenRequests();
|
||||
|
||||
//Switch to last selected instance and load related config
|
||||
var lastSelectedInstance = getStorage('lastSelectedInstance', false);
|
||||
var lastSelectedInstance = getStorage('lastSelectedInstance');
|
||||
if (lastSelectedInstance == null || window.serverInfo.instance && !window.serverInfo.instance[lastSelectedInstance]) {
|
||||
lastSelectedInstance = 0;
|
||||
}
|
||||
@@ -157,7 +151,7 @@ $(document).ready(function () {
|
||||
$("#btn_lock_ui").removeAttr('style')
|
||||
|
||||
if (event.response.hasOwnProperty('info'))
|
||||
setStorage("loginToken", event.response.info.token, true);
|
||||
setStorage("loginToken", event.response.info.token);
|
||||
|
||||
requestServerConfigSchema();
|
||||
});
|
||||
@@ -171,7 +165,7 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
$(window.hyperion).on("cmd-authorize-newPasswordRequired", function (event) {
|
||||
var loginToken = getStorage("loginToken", true)
|
||||
var loginToken = getStorage("loginToken")
|
||||
|
||||
if (event.response.info.newPasswordRequired == true) {
|
||||
window.defaultPasswordIsSet = true;
|
||||
@@ -204,8 +198,8 @@ $(document).ready(function () {
|
||||
$(window.hyperion).on("error", function (event) {
|
||||
//If we are getting an error "No Authorization" back with a set loginToken we will forward to new Login (Token is expired.
|
||||
//e.g.: hyperiond was started new in the meantime)
|
||||
if (event.reason == "No Authorization" && getStorage("loginToken", true)) {
|
||||
removeStorage("loginToken", true);
|
||||
if (event.reason == "No Authorization" && getStorage("loginToken")) {
|
||||
removeStorage("loginToken");
|
||||
requestRequiresAdminAuth();
|
||||
}
|
||||
else if (event.reason == "Selected Hyperion instance isn't running") {
|
||||
@@ -281,8 +275,8 @@ $(document).ready(function () {
|
||||
|
||||
if (!isInData) {
|
||||
//Delete Storage information about the last used but now stopped instance
|
||||
if (getStorage('lastSelectedInstance', false))
|
||||
removeStorage('lastSelectedInstance', false)
|
||||
if (getStorage('lastSelectedInstance'))
|
||||
removeStorage('lastSelectedInstance')
|
||||
|
||||
currentHyperionInstance = 0;
|
||||
currentHyperionInstanceName = getInstanceNameByIndex(0);
|
||||
@@ -341,7 +335,7 @@ function suppressDefaultPwWarning() {
|
||||
|
||||
$(function () {
|
||||
var sidebar = $('#side-menu'); // cache sidebar to a variable for performance
|
||||
sidebar.on("click", 'a.inactive' , function () {
|
||||
sidebar.on("click", 'a.inactive', function () {
|
||||
sidebar.find('.active').toggleClass('active inactive');
|
||||
$(this).toggleClass('active inactive');
|
||||
});
|
||||
@@ -354,13 +348,13 @@ $(document.body).on('hide.bs.modal,hidden.bs.modal', function () {
|
||||
|
||||
//Dark Mode
|
||||
$("#btn_darkmode").off().on("click", function (e) {
|
||||
if (getStorage("darkMode", false) != "on") {
|
||||
if (getStorage("darkMode") != "on") {
|
||||
handleDarkMode();
|
||||
setStorage("darkModeOverwrite", true, true);
|
||||
setStorage("darkModeOverwrite", true);
|
||||
}
|
||||
else {
|
||||
setStorage("darkMode", "off", false);
|
||||
setStorage("darkModeOverwrite", true, true);
|
||||
setStorage("darkMode", "off",);
|
||||
setStorage("darkModeOverwrite", true);
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
@@ -392,3 +386,4 @@ function SwitchToMenuItem(target, item) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@@ -21,7 +21,7 @@ var toggleKeystoneCorrectionArea = false;
|
||||
var devRPiSPI = ['apa102', 'apa104', 'ws2801', 'lpd6803', 'lpd8806', 'p9813', 'sk6812spi', 'sk6822spi', 'sk9822', 'ws2812spi'];
|
||||
var devRPiPWM = ['ws281x'];
|
||||
var devRPiGPIO = ['piblaster'];
|
||||
var devNET = ['atmoorb', 'cololight', 'fadecandy', 'philipshue', 'nanoleaf', 'razer', 'tinkerforge', 'tpm2net', 'udpe131', 'udpartnet', 'udph801', 'udpraw', 'wled', 'yeelight'];
|
||||
var devNET = ['atmoorb', 'cololight', 'fadecandy', 'philipshue', 'nanoleaf', 'razer', 'tinkerforge', 'tpm2net', 'udpe131', 'udpartnet', 'udpddp', 'udph801', 'udpraw', 'wled', 'yeelight'];
|
||||
var devSerial = ['adalight', 'dmx', 'atmo', 'sedu', 'tpm2', 'karate'];
|
||||
var devHID = ['hyperionusbasp', 'lightpack', 'paintpack', 'rawhid'];
|
||||
|
||||
@@ -1075,6 +1075,7 @@ $(document).ready(function () {
|
||||
conf_editor.on('ready', function () {
|
||||
var hwLedCountDefault = 1;
|
||||
var colorOrderDefault = "rgb";
|
||||
var filter = {};
|
||||
|
||||
$('#btn_test_controller').hide();
|
||||
|
||||
@@ -1083,13 +1084,7 @@ $(document).ready(function () {
|
||||
case "wled":
|
||||
case "nanoleaf":
|
||||
showAllDeviceInputOptions("hostList", false);
|
||||
case "adalight":
|
||||
case "atmo":
|
||||
case "dmx":
|
||||
case "karate":
|
||||
case "sedu":
|
||||
case "tpm2":
|
||||
case "apa102":
|
||||
case "apa102":
|
||||
case "apa104":
|
||||
case "ws2801":
|
||||
case "lpd6803":
|
||||
@@ -1101,7 +1096,18 @@ $(document).ready(function () {
|
||||
case "ws2812spi":
|
||||
case "piblaster":
|
||||
case "ws281x":
|
||||
discover_device(ledType);
|
||||
|
||||
//Serial devices
|
||||
case "adalight":
|
||||
case "atmo":
|
||||
case "dmx":
|
||||
case "karate":
|
||||
case "sedu":
|
||||
case "tpm2":
|
||||
if (storedAccess === 'expert') {
|
||||
filter.discoverAll = true;
|
||||
}
|
||||
discover_device(ledType, filter);
|
||||
hwLedCountDefault = 1;
|
||||
colorOrderDefault = "rgb";
|
||||
break;
|
||||
@@ -1172,6 +1178,7 @@ $(document).ready(function () {
|
||||
case "tpm2net":
|
||||
case "udpe131":
|
||||
case "udpartnet":
|
||||
case "udpddp":
|
||||
case "udph801":
|
||||
case "udpraw":
|
||||
var host = conf_editor.getEditor("root.specificOptions.host").getValue();
|
||||
@@ -1255,33 +1262,43 @@ $(document).ready(function () {
|
||||
var hostList = conf_editor.getEditor("root.specificOptions.hostList");
|
||||
if (hostList) {
|
||||
var val = hostList.getValue();
|
||||
var host = conf_editor.getEditor("root.specificOptions.host");
|
||||
var showOptions = true;
|
||||
|
||||
|
||||
switch (val) {
|
||||
case 'CUSTOM':
|
||||
case '':
|
||||
conf_editor.getEditor(specOptPath + "host").enable();
|
||||
conf_editor.getEditor(specOptPath + "host").setValue("");
|
||||
host.enable();
|
||||
//Populate existing host for current custom config
|
||||
if (ledType === window.serverConfig.device.type) {
|
||||
host.setValue(window.serverConfig.device.host);
|
||||
} else {
|
||||
host.setValue("");
|
||||
}
|
||||
break;
|
||||
case 'NONE':
|
||||
conf_editor.getEditor(specOptPath + "host").enable();
|
||||
host.enable();
|
||||
//Trigger getProperties via host value
|
||||
conf_editor.notifyWatchers(specOptPath + "host");
|
||||
break;
|
||||
case 'SELECT':
|
||||
conf_editor.getEditor(specOptPath + "host").setValue("");
|
||||
conf_editor.getEditor(specOptPath + "host").disable();
|
||||
host.setValue("");
|
||||
host.disable();
|
||||
showOptions = false;
|
||||
break;
|
||||
default:
|
||||
conf_editor.getEditor(specOptPath + "host").disable();
|
||||
conf_editor.getEditor(specOptPath + "host").setValue(val);
|
||||
host.disable();
|
||||
host.setValue(val);
|
||||
//Trigger getProperties via host value
|
||||
conf_editor.notifyWatchers(specOptPath + "host");
|
||||
break;
|
||||
}
|
||||
|
||||
showAllDeviceInputOptions("hostList", showOptions);
|
||||
|
||||
if (!host.isEnabled() && host.getValue().endsWith("._tcp.local")) {
|
||||
showInputOptionForItem(conf_editor, 'specificOptions', 'host', false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1749,44 +1766,34 @@ var updateSelectList = function (ledType, discoveryInfo) {
|
||||
var name;
|
||||
var host;
|
||||
|
||||
switch (ledType) {
|
||||
case "nanoleaf":
|
||||
if (discoveryMethod === "ssdp") {
|
||||
name = device.other["nl-devicename"];
|
||||
}
|
||||
else {
|
||||
name = device.name;
|
||||
}
|
||||
break;
|
||||
case "cololight":
|
||||
if (discoveryMethod === "ssdp") {
|
||||
name = device.hostname;
|
||||
}
|
||||
else {
|
||||
name = device.name;
|
||||
}
|
||||
break;
|
||||
case "wled":
|
||||
name = device.name;
|
||||
break;
|
||||
default:
|
||||
name = device.name;
|
||||
}
|
||||
|
||||
if (discoveryMethod === "ssdp") {
|
||||
host = device.ip;
|
||||
}
|
||||
else {
|
||||
host = device.name;
|
||||
host = device.service;
|
||||
}
|
||||
|
||||
switch (ledType) {
|
||||
case "nanoleaf":
|
||||
if (discoveryMethod === "ssdp") {
|
||||
name = device.other["nl-devicename"] + " (" + host + ")";
|
||||
}
|
||||
else {
|
||||
name = device.name;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (discoveryMethod === "ssdp") {
|
||||
name = device.hostname + " (" + host + ")";
|
||||
}
|
||||
else {
|
||||
name = device.name;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
enumVals.push(host);
|
||||
if (host !== name) {
|
||||
enumTitelVals.push(name + " (" + host + ")");
|
||||
}
|
||||
else {
|
||||
enumTitelVals.push(host);
|
||||
}
|
||||
enumTitelVals.push(name);
|
||||
}
|
||||
|
||||
//Always allow to add custom configuration
|
||||
@@ -1794,8 +1801,14 @@ var updateSelectList = function (ledType, discoveryInfo) {
|
||||
// Select configured device
|
||||
var configuredDeviceType = window.serverConfig.device.type;
|
||||
var configuredHost = window.serverConfig.device.hostList;
|
||||
if (ledType === configuredDeviceType && $.inArray(configuredHost, enumVals) != -1) {
|
||||
enumDefaultVal = configuredHost;
|
||||
if (ledType === configuredDeviceType) {
|
||||
if ($.inArray(configuredHost, enumVals) != -1) {
|
||||
enumDefaultVal = configuredHost;
|
||||
} else if (configuredHost === "CUSTOM") {
|
||||
enumDefaultVal = "CUSTOM";
|
||||
} else {
|
||||
addSelect = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
addSelect = true;
|
||||
@@ -1928,6 +1941,7 @@ async function discover_device(ledType, params) {
|
||||
}
|
||||
|
||||
async function getProperties_device(ledType, key, params) {
|
||||
var disabled = $('#btn_submit_controller').is(':disabled');
|
||||
// Take care that connfig cannot be saved during background processing
|
||||
$('#btn_submit_controller').prop('disabled', true);
|
||||
|
||||
@@ -1946,7 +1960,7 @@ async function getProperties_device(ledType, key, params) {
|
||||
devicesProperties[ledType][key] = ledDeviceProperties;
|
||||
|
||||
if (!window.readOnlyMode) {
|
||||
$('#btn_submit_controller').prop('disabled', false);
|
||||
$('#btn_submit_controller').prop('disabled', disabled);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1961,6 +1975,7 @@ async function getProperties_device(ledType, key, params) {
|
||||
}
|
||||
|
||||
async function identify_device(type, params) {
|
||||
var disabled = $('#btn_submit_controller').is(':disabled');
|
||||
// Take care that connfig cannot be saved and identification cannot be retriggerred during background processing
|
||||
$('#btn_submit_controller').prop('disabled', true);
|
||||
$('#btn_test_controller').prop('disabled', true);
|
||||
@@ -1969,7 +1984,7 @@ async function identify_device(type, params) {
|
||||
|
||||
$('#btn_test_controller').prop('disabled', false);
|
||||
if (!window.readOnlyMode) {
|
||||
$('#btn_submit_controller').prop('disabled', false);
|
||||
$('#btn_submit_controller').prop('disabled', disabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1988,12 +2003,18 @@ function updateElements(ledType, key) {
|
||||
case "wled":
|
||||
var ledProperties = devicesProperties[ledType][key];
|
||||
|
||||
if (ledProperties && ledProperties.leds && ledProperties.maxLedCount) {
|
||||
if (ledProperties && ledProperties.leds) {
|
||||
hardwareLedCount = ledProperties.leds.count;
|
||||
var maxLedCount = ledProperties.maxLedCount;
|
||||
if (hardwareLedCount > maxLedCount) {
|
||||
showInfoDialog('warning', $.i18n("conf_leds_config_warning"), $.i18n('conf_leds_error_hwled_gt_maxled', hardwareLedCount, maxLedCount, maxLedCount));
|
||||
hardwareLedCount = maxLedCount;
|
||||
if (ledProperties.maxLedCount) {
|
||||
var maxLedCount = ledProperties.maxLedCount;
|
||||
if (hardwareLedCount > maxLedCount) {
|
||||
showInfoDialog('warning', $.i18n("conf_leds_config_warning"), $.i18n('conf_leds_error_hwled_gt_maxled', hardwareLedCount, maxLedCount, maxLedCount));
|
||||
hardwareLedCount = maxLedCount;
|
||||
conf_editor.getEditor("root.specificOptions.streamProtocol").setValue("RAW");
|
||||
//Workaround, as value seems to getting updated property when a 'getEditor("root.specificOptions").getValue()' is done during save
|
||||
var editor = conf_editor.getEditor("root.specificOptions");
|
||||
editor.value["streamProtocol"] = "RAW";
|
||||
}
|
||||
}
|
||||
}
|
||||
conf_editor.getEditor("root.generalOptions.hardwareLedCount").setValue(hardwareLedCount);
|
||||
@@ -2060,6 +2081,15 @@ function updateElements(ledType, key) {
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
if (!conf_editor.validate().length) {
|
||||
if (!window.readOnlyMode) {
|
||||
$('#btn_submit_controller').attr('disabled', false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$('#btn_submit_controller').attr('disabled', true);
|
||||
}
|
||||
}
|
||||
|
||||
function showAllDeviceInputOptions(showForKey, state) {
|
||||
@@ -2068,6 +2098,6 @@ function showAllDeviceInputOptions(showForKey, state) {
|
||||
}
|
||||
|
||||
function disableAutoResolvedGeneralOptions() {
|
||||
conf_editor.getEditor("root.generalOptions.hardwareLedCount").disable();
|
||||
conf_editor.getEditor("root.generalOptions.colorOrder").disable();
|
||||
conf_editor.getEditor("root.generalOptions.hardwareLedCount").disable();
|
||||
conf_editor.getEditor("root.generalOptions.colorOrder").disable();
|
||||
}
|
||||
|
@@ -137,7 +137,7 @@ $(document).ready(function () {
|
||||
|
||||
var date = new Date(parseInt(utime));
|
||||
var subComponent = "";
|
||||
if (window.serverInfo.instance.length > 1) {
|
||||
if (window.serverInfo.instance.length >= 1) {
|
||||
if (logger_subname.startsWith("I")) {
|
||||
var instanceNum = logger_subname.substring(1);
|
||||
if (window.serverInfo.instance[instanceNum]) {
|
||||
|
@@ -11,6 +11,9 @@ $(document).ready(function () {
|
||||
var conf_editor_fbs = null;
|
||||
var conf_editor_forw = null;
|
||||
|
||||
// Service properties , 2-dimensional array of [servicetype][id]
|
||||
discoveredRemoteServices = {};
|
||||
|
||||
addJsonEditorHostValidation();
|
||||
|
||||
if (window.showOptHelp) {
|
||||
@@ -142,10 +145,21 @@ $(document).ready(function () {
|
||||
forwarder: window.schema.forwarder
|
||||
}, true, true);
|
||||
|
||||
conf_editor_forw.on('ready', function () {
|
||||
|
||||
updateServiceCacheForwarderConfiguredItems("jsonapi");
|
||||
updateServiceCacheForwarderConfiguredItems("flatbuffer");
|
||||
|
||||
var forwarderEnable = conf_editor_forw.getEditor("root.forwarder.enable").getValue();
|
||||
if (forwarderEnable) {
|
||||
discoverRemoteHyperionServices("jsonapi");
|
||||
discoverRemoteHyperionServices("flatbuffer");
|
||||
}
|
||||
});
|
||||
|
||||
conf_editor_forw.on('change', function () {
|
||||
var forwarderEnable = conf_editor_forw.getEditor("root.forwarder.enable").getValue();
|
||||
if (forwarderEnable) {
|
||||
showInputOptionsForKey(conf_editor_forw, "forwarder", "enable", true);
|
||||
$('#forwarderHelpPanelId').show();
|
||||
} else {
|
||||
showInputOptionsForKey(conf_editor_forw, "forwarder", "enable", false);
|
||||
@@ -154,6 +168,23 @@ $(document).ready(function () {
|
||||
conf_editor_forw.validate().length || window.readOnlyMode ? $('#btn_submit_forwarder').prop('disabled', true) : $('#btn_submit_forwarder').prop('disabled', false);
|
||||
});
|
||||
|
||||
conf_editor_forw.watch('root.forwarder.jsonapiselect', () => {
|
||||
updateForwarderServiceSections("jsonapi");
|
||||
});
|
||||
|
||||
conf_editor_forw.watch('root.forwarder.flatbufferselect', () => {
|
||||
updateForwarderServiceSections("flatbuffer");
|
||||
});
|
||||
|
||||
conf_editor_forw.watch('root.forwarder.enable', () => {
|
||||
|
||||
var forwarderEnable = conf_editor_forw.getEditor("root.forwarder.enable").getValue();
|
||||
if (forwarderEnable) {
|
||||
discoverRemoteHyperionServices("jsonapi");
|
||||
discoverRemoteHyperionServices("flatbuffer");
|
||||
}
|
||||
});
|
||||
|
||||
$('#btn_submit_forwarder').off().on('click', function () {
|
||||
requestWriteConfig(conf_editor_forw.getValue());
|
||||
});
|
||||
@@ -238,5 +269,143 @@ $(document).ready(function () {
|
||||
checkApiTokenState(window.serverConfig.network.apiAuth);
|
||||
|
||||
removeOverlay();
|
||||
|
||||
function updateForwarderServiceSections(type) {
|
||||
|
||||
var editorPath = "root.forwarder." + type
|
||||
var selectedServices = conf_editor_forw.getEditor(editorPath + "select").getValue();
|
||||
|
||||
if (jQuery.isEmptyObject(selectedServices) || selectedServices[0] === "NONE") {
|
||||
conf_editor_forw.getEditor(editorPath).setValue([]);
|
||||
showInputOptionForItem(conf_editor_forw, "forwarder", type, false);
|
||||
} else {
|
||||
|
||||
var newServices = [];
|
||||
for (var i = 0; i < selectedServices.length; ++i) {
|
||||
|
||||
var service = discoveredRemoteServices[type][selectedServices[i]];
|
||||
var newrecord = {};
|
||||
|
||||
newrecord.name = service.name;
|
||||
newrecord.host = service.host;
|
||||
newrecord.port = service.port;
|
||||
|
||||
newServices.push(newrecord);
|
||||
}
|
||||
conf_editor_forw.getEditor(editorPath).setValue(newServices);
|
||||
|
||||
showInputOptionForItem(conf_editor_forw, "forwarder", type, true);
|
||||
conf_editor_forw.getEditor(editorPath).disable();
|
||||
}
|
||||
}
|
||||
|
||||
function updateForwarderSelectList(type) {
|
||||
|
||||
var selectionElement = type + "select"
|
||||
|
||||
var enumVals = [];
|
||||
var enumTitelVals = [];
|
||||
var enumDefaultVals = [];
|
||||
|
||||
for (var key in discoveredRemoteServices[type]) {
|
||||
|
||||
var service = discoveredRemoteServices[type][key];
|
||||
enumVals.push(service.host);
|
||||
enumTitelVals.push(service.name);
|
||||
|
||||
if (service.inConfig == true) {
|
||||
enumDefaultVals.push(service.host);
|
||||
}
|
||||
}
|
||||
|
||||
let addSchemaElements = {
|
||||
"uniqueItems": true
|
||||
};
|
||||
|
||||
if (jQuery.isEmptyObject(enumVals)) {
|
||||
enumVals.push("NONE");
|
||||
enumTitelVals.push($.i18n('edt_conf_fw_remote_service_discovered_none'));
|
||||
}
|
||||
|
||||
updateJsonEditorMultiSelection(conf_editor_forw, 'root.forwarder', selectionElement, addSchemaElements, enumVals, enumTitelVals, enumDefaultVals);
|
||||
};
|
||||
|
||||
function updateServiceCacheForwarderConfiguredItems(serviceType) {
|
||||
|
||||
var editor = conf_editor_forw.getEditor("root.forwarder." + serviceType);
|
||||
|
||||
if (editor) {
|
||||
if (!discoveredRemoteServices[serviceType]) {
|
||||
discoveredRemoteServices[serviceType] = {};
|
||||
}
|
||||
|
||||
var configuredServices = JSON.parse(JSON.stringify(editor.getValue('items')));
|
||||
for (const service of configuredServices) {
|
||||
|
||||
//Handle not named sceanrios
|
||||
if (!service.name) {
|
||||
service.name = service.host;
|
||||
}
|
||||
|
||||
service.inConfig = true;
|
||||
|
||||
discoveredRemoteServices[serviceType][service.host] = service;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateRemoteServiceCache(discoveryInfo) {
|
||||
|
||||
for (var serviceType in discoveryInfo) {
|
||||
|
||||
if (!discoveredRemoteServices[serviceType]) {
|
||||
discoveredRemoteServices[serviceType] = {};
|
||||
}
|
||||
|
||||
var discoveredServices = discoveryInfo[serviceType];
|
||||
for (const service of discoveredServices) {
|
||||
|
||||
if (!service.sameHost)
|
||||
{
|
||||
//Handle non mDNS sceanrios
|
||||
if (!service.name) {
|
||||
service.name = service.host;
|
||||
} else {
|
||||
service.host = service.service;
|
||||
}
|
||||
|
||||
if (discoveredRemoteServices[serviceType][service.host]) {
|
||||
service.inConfig = true;
|
||||
}
|
||||
|
||||
discoveredRemoteServices[serviceType][service.host] = service;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
async function discoverRemoteHyperionServices(type, params) {
|
||||
|
||||
const result = await requestServiceDiscovery(type, params);
|
||||
|
||||
var discoveryResult;
|
||||
if (result && !result.error) {
|
||||
discoveryResult = result.info;
|
||||
}
|
||||
else {
|
||||
discoveryResult = {
|
||||
"services": []
|
||||
};
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case "jsonapi":
|
||||
case "flatbuffer":
|
||||
updateRemoteServiceCache(discoveryResult.services);
|
||||
updateForwarderSelectList(type);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
|
@@ -26,7 +26,6 @@ window.loggingStreamActive = false;
|
||||
window.loggingHandlerInstalled = false;
|
||||
window.watchdog = 0;
|
||||
window.debugMessagesActive = true;
|
||||
window.wSess = [];
|
||||
window.currentHyperionInstance = 0;
|
||||
window.currentHyperionInstanceName = "?";
|
||||
window.comps = [];
|
||||
@@ -136,7 +135,11 @@ function initWebSocket()
|
||||
// skip tan -1 error handling
|
||||
if(tan != -1){
|
||||
var error = response.hasOwnProperty("error")? response.error : "unknown";
|
||||
$(window.hyperion).trigger({type:"error",reason:error});
|
||||
if (error == "Service Unavailable") {
|
||||
window.location.reload();
|
||||
} else {
|
||||
$(window.hyperion).trigger({type:"error",reason:error});
|
||||
}
|
||||
console.log("[window.websocket::onmessage] ",error)
|
||||
}
|
||||
}
|
||||
@@ -307,7 +310,7 @@ function requestInstanceSwitch(inst)
|
||||
|
||||
function requestServerInfo()
|
||||
{
|
||||
sendToHyperion("serverinfo","",'"subscribe":["components-update","sessions-update","priorities-update", "imageToLedMapping-update", "adjustment-update", "videomode-update", "effects-update", "settings-update", "instance-update"]');
|
||||
sendToHyperion("serverinfo","",'"subscribe":["components-update", "priorities-update", "imageToLedMapping-update", "adjustment-update", "videomode-update", "effects-update", "settings-update", "instance-update"]');
|
||||
}
|
||||
|
||||
function requestSysInfo()
|
||||
@@ -485,9 +488,21 @@ function requestLedDeviceIdentification(type, params)
|
||||
return sendAsyncToHyperion("leddevice", "identify", data, Math.floor(Math.random() * 1000));
|
||||
}
|
||||
|
||||
async function requestLedDeviceAddAuthorization(type, params) {
|
||||
let data = { ledDeviceType: type, params: params };
|
||||
|
||||
return sendAsyncToHyperion("leddevice", "addAuthorization", data, Math.floor(Math.random() * 1000));
|
||||
}
|
||||
|
||||
async function requestInputSourcesDiscovery(type, params) {
|
||||
let data = { sourceType: type, params: params };
|
||||
|
||||
return sendAsyncToHyperion("inputsource", "discover", data, Math.floor(Math.random() * 1000));
|
||||
}
|
||||
|
||||
async function requestServiceDiscovery(type, params) {
|
||||
let data = { serviceType: type, params: params };
|
||||
|
||||
return sendAsyncToHyperion("service", "discover", data, Math.floor(Math.random() * 1000));
|
||||
}
|
||||
|
||||
|
@@ -2,14 +2,14 @@ var availAccess = ['default', 'advanced', 'expert'];
|
||||
var storedAccess;
|
||||
|
||||
//Change Password
|
||||
function changePassword(){
|
||||
function changePassword() {
|
||||
showInfoDialog('changePassword', $.i18n('InfoDialog_changePassword_title'));
|
||||
|
||||
// fill default pw if default is set
|
||||
if(window.defaultPasswordIsSet)
|
||||
if (window.defaultPasswordIsSet)
|
||||
$('#current-password').val('hyperion')
|
||||
|
||||
$('#id_btn_ok').off().on('click',function() {
|
||||
$('#id_btn_ok').off().on('click', function () {
|
||||
var oldPw = $('#current-password').val();
|
||||
var newPw = $('#new-password').val();
|
||||
|
||||
@@ -17,7 +17,7 @@ function changePassword(){
|
||||
history.pushState({}, "New password");
|
||||
});
|
||||
|
||||
$('#new-password, #current-password').off().on('input',function(e) {
|
||||
$('#new-password, #current-password').off().on('input', function (e) {
|
||||
($('#current-password').val().length >= 8 && $('#new-password').val().length >= 8) && !window.readOnlyMode ? $('#id_btn_ok').prop('disabled', false) : $('#id_btn_ok').prop('disabled', true);
|
||||
});
|
||||
}
|
||||
@@ -44,18 +44,17 @@ $(document).ready(function () {
|
||||
$('#btn_setlang').prop("disabled", true);
|
||||
}
|
||||
|
||||
$('#btn_setaccess').off().on('click',function() {
|
||||
$('#btn_setaccess').off().on('click', function () {
|
||||
var newAccess;
|
||||
showInfoDialog('select', $.i18n('InfoDialog_access_title'), $.i18n('InfoDialog_access_text'));
|
||||
|
||||
for (var lcx = 0; lcx<availAccess.length; lcx++)
|
||||
{
|
||||
$('#id_select').append(createSelOpt(availAccess[lcx], $.i18n('general_access_'+availAccess[lcx])));
|
||||
for (var lcx = 0; lcx < availAccess.length; lcx++) {
|
||||
$('#id_select').append(createSelOpt(availAccess[lcx], $.i18n('general_access_' + availAccess[lcx])));
|
||||
}
|
||||
|
||||
$('#id_select').val(storedAccess);
|
||||
|
||||
$('#id_select').off().on('change',function() {
|
||||
$('#id_select').off().on('change', function () {
|
||||
newAccess = $('#id_select').val();
|
||||
if (newAccess == storedAccess)
|
||||
$('#id_btn_saveset').prop('disabled', true);
|
||||
@@ -63,7 +62,7 @@ $(document).ready(function () {
|
||||
$('#id_btn_saveset').prop('disabled', false);
|
||||
});
|
||||
|
||||
$('#id_btn_saveset').off().on('click',function() {
|
||||
$('#id_btn_saveset').off().on('click', function () {
|
||||
setStorage("accesslevel", newAccess);
|
||||
reload();
|
||||
});
|
||||
@@ -72,13 +71,13 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
// change pw btn
|
||||
$('#btn_changePassword').off().on('click',function() {
|
||||
$('#btn_changePassword').off().on('click', function () {
|
||||
changePassword();
|
||||
});
|
||||
|
||||
//Lock Ui
|
||||
$('#btn_lock_ui').off().on('click',function() {
|
||||
removeStorage('loginToken', true);
|
||||
$('#btn_lock_ui').off().on('click', function () {
|
||||
removeStorage('loginToken');
|
||||
location.replace('/');
|
||||
});
|
||||
|
||||
@@ -86,27 +85,5 @@ $(document).ready(function () {
|
||||
if (storedAccess != 'expert')
|
||||
$('#load_webconfig').toggle(false);
|
||||
|
||||
|
||||
// instance switcher
|
||||
$('#btn_instanceswitch').off().on('click',function() {
|
||||
var lsys = window.sysInfo.system.hostName+':'+window.serverConfig.webConfig.port;
|
||||
showInfoDialog('iswitch', $.i18n('InfoDialog_iswitch_title'), $.i18n('InfoDialog_iswitch_text'));
|
||||
|
||||
for (var i = 0; i<window.wSess.length; i++)
|
||||
{
|
||||
if(lsys != window.wSess[i].host+':'+window.wSess[i].port)
|
||||
{
|
||||
var hyperionAddress = window.wSess[i].address;
|
||||
if(hyperionAddress.indexOf(':') > -1 && hyperionAddress.length == 36) hyperionAddress = '['+hyperionAddress+']';
|
||||
hyperionAddress = 'http://'+hyperionAddress+':'+window.wSess[i].port;
|
||||
$('#id_select').append(createSelOpt(hyperionAddress, window.wSess[i].name));
|
||||
}
|
||||
}
|
||||
|
||||
$('#id_btn_saveset').off().on('click',function() {
|
||||
$("#loading_overlay").addClass("overlay");
|
||||
window.location.href = $('#id_select').val();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -14,31 +14,22 @@ function storageComp() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function getStorage(item, session) {
|
||||
function getStorage(item) {
|
||||
if (storageComp()) {
|
||||
if (session === true)
|
||||
return sessionStorage.getItem(item);
|
||||
else
|
||||
return localStorage.getItem(item);
|
||||
return localStorage.getItem(item);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function setStorage(item, value, session) {
|
||||
function setStorage(item, value) {
|
||||
if (storageComp()) {
|
||||
if (session === true)
|
||||
sessionStorage.setItem(item, value);
|
||||
else
|
||||
localStorage.setItem(item, value);
|
||||
localStorage.setItem(item, value);
|
||||
}
|
||||
}
|
||||
|
||||
function removeStorage(item, session) {
|
||||
function removeStorage(item) {
|
||||
if (storageComp()) {
|
||||
if (session === true)
|
||||
sessionStorage.removeItem(item);
|
||||
else
|
||||
localStorage.removeItem(item);
|
||||
localStorage.removeItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,23 +39,6 @@ function debugMessage(msg) {
|
||||
}
|
||||
}
|
||||
|
||||
function updateSessions() {
|
||||
var sess = window.serverInfo.sessions;
|
||||
if (sess && sess.length) {
|
||||
window.wSess = [];
|
||||
for (var i = 0; i < sess.length; i++) {
|
||||
if (sess[i].type == "_http._tcp." || sess[i].type == "_https._tcp." || sess[i].type == "_hyperiond-http._tcp.") {
|
||||
window.wSess.push(sess[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (window.wSess.length > 1)
|
||||
$('#btn_instanceswitch').toggle(true);
|
||||
else
|
||||
$('#btn_instanceswitch').toggle(false);
|
||||
}
|
||||
}
|
||||
|
||||
function validateDuration(d) {
|
||||
if (typeof d === "undefined" || d < 0)
|
||||
return ENDLESS;
|
||||
@@ -73,8 +47,8 @@ function validateDuration(d) {
|
||||
}
|
||||
|
||||
function getHashtag() {
|
||||
if (getStorage('lasthashtag', true) != null)
|
||||
return getStorage('lasthashtag', true);
|
||||
if (getStorage('lasthashtag') != null)
|
||||
return getStorage('lasthashtag');
|
||||
else {
|
||||
var tag = document.URL;
|
||||
tag = tag.substr(tag.indexOf("#") + 1);
|
||||
@@ -87,20 +61,20 @@ function getHashtag() {
|
||||
function loadContent(event, forceRefresh) {
|
||||
var tag;
|
||||
|
||||
var lastSelectedInstance = getStorage('lastSelectedInstance', false);
|
||||
var lastSelectedInstance = getStorage('lastSelectedInstance');
|
||||
|
||||
if (lastSelectedInstance && (lastSelectedInstance != window.currentHyperionInstance)) {
|
||||
if (window.serverInfo.instance[lastSelectedInstance] && window.serverInfo.instance[lastSelectedInstance].running) {
|
||||
instanceSwitch(lastSelectedInstance);
|
||||
} else {
|
||||
removeStorage('lastSelectedInstance', false);
|
||||
removeStorage('lastSelectedInstance');
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof event != "undefined") {
|
||||
tag = event.currentTarget.hash;
|
||||
tag = tag.substr(tag.indexOf("#") + 1);
|
||||
setStorage('lasthashtag', tag, true);
|
||||
setStorage('lasthashtag', tag);
|
||||
}
|
||||
else
|
||||
tag = getHashtag();
|
||||
@@ -112,7 +86,7 @@ function loadContent(event, forceRefresh) {
|
||||
if (status == "error") {
|
||||
tag = 'dashboard';
|
||||
console.log("Could not find page:", prevTag, ", Redirecting to:", tag);
|
||||
setStorage('lasthashtag', tag, true);
|
||||
setStorage('lasthashtag', tag);
|
||||
|
||||
$("#page-content").load("/content/" + tag + ".html", function (response, status, xhr) {
|
||||
if (status == "error") {
|
||||
@@ -215,7 +189,7 @@ function instanceSwitch(inst) {
|
||||
requestInstanceSwitch(inst)
|
||||
window.currentHyperionInstance = inst;
|
||||
window.currentHyperionInstanceName = getInstanceNameByIndex(inst);
|
||||
setStorage('lastSelectedInstance', inst, false)
|
||||
setStorage('lastSelectedInstance', inst)
|
||||
updateHyperionInstanceListing()
|
||||
}
|
||||
|
||||
@@ -332,7 +306,7 @@ function showInfoDialog(type, header, message) {
|
||||
if (type == "select" || type == "iswitch")
|
||||
$('#id_body').append('<select id="id_select" class="form-control" style="margin-top:10px;width:auto;"></select>');
|
||||
|
||||
if (getStorage("darkMode", false) == "on")
|
||||
if (getStorage("darkMode") == "on")
|
||||
$('#id_logo').attr("src", 'img/hyperion/logo_negativ.png');
|
||||
|
||||
$(type == "renInst" || type == "changePassword" ? "#modal_dialog_rename" : "#modal_dialog").modal({
|
||||
@@ -1246,7 +1220,7 @@ function handleDarkMode() {
|
||||
href: "../css/darkMode.css"
|
||||
}).appendTo("head");
|
||||
|
||||
setStorage("darkMode", "on", false);
|
||||
setStorage("darkMode", "on");
|
||||
$('#btn_darkmode_icon').removeClass('fa fa-moon-o');
|
||||
$('#btn_darkmode_icon').addClass('mdi mdi-white-balance-sunny');
|
||||
$('#navbar_brand_logo').attr("src", 'img/hyperion/logo_negativ.png');
|
||||
@@ -1337,7 +1311,16 @@ function isValidIPv6(value) {
|
||||
|
||||
function isValidHostname(value) {
|
||||
if (value.match(
|
||||
'(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{0,62}[a-zA-Z0-9].)+[a-zA-Z]{2,63}$)'
|
||||
'^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[_a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$'
|
||||
))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function isValidServicename(value) {
|
||||
if (value.match(
|
||||
'^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9 \-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[_a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$'
|
||||
))
|
||||
return true;
|
||||
else
|
||||
@@ -1349,6 +1332,5 @@ function isValidHostnameOrIP4(value) {
|
||||
}
|
||||
|
||||
function isValidHostnameOrIP(value) {
|
||||
return (isValidHostnameOrIP4(value) || isValidIPv6(value));
|
||||
return (isValidHostnameOrIP4(value) || isValidIPv6(value) || isValidServicename(value));
|
||||
}
|
||||
|
||||
|
@@ -57,7 +57,7 @@ function startWizardRGB() {
|
||||
$('#wizp2_body').append('<table class="table borderless" style="width:200px"><tbody><tr><td class="ltd"><label>' + $.i18n('wiz_rgb_qrend') + '</label></td><td class="itd"><select id="wiz_r_select" class="form-control wselect"></select></td></tr><tr><td class="ltd"><label>' + $.i18n('wiz_rgb_qgend') + '</label></td><td class="itd"><select id="wiz_g_select" class="form-control wselect"></select></td></tr></tbody></table>');
|
||||
$('#wizp2_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_save"><i class="fa fa-fw fa-save"></i>' + $.i18n('general_btn_save') + '</button><button type="button" class="btn btn-primary" id="btn_wiz_checkok" style="display:none" data-dismiss="modal"><i class="fa fa-fw fa-check"></i>' + $.i18n('general_btn_ok') + '</button><button type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>' + $.i18n('general_btn_cancel') + '</button>');
|
||||
|
||||
if (getStorage("darkMode", false) == "on")
|
||||
if (getStorage("darkMode") == "on")
|
||||
$('#wizard_logo').attr("src", 'img/hyperion/logo_negativ.png');
|
||||
|
||||
//open modal
|
||||
@@ -454,7 +454,7 @@ function startWizardCC() {
|
||||
'<button type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>' + $.i18n('general_btn_cancel') + '</button>'
|
||||
);
|
||||
|
||||
if (getStorage("darkMode", false) == "on")
|
||||
if (getStorage("darkMode") == "on")
|
||||
$('#wizard_logo').prop("src", 'img/hyperion/logo_negativ.png');
|
||||
|
||||
//open modal
|
||||
@@ -591,6 +591,19 @@ var lightPosRightMiddle = { hmin: 0.85, hmax: 1.0, vmin: 0.25, vmax: 0.75 };
|
||||
var lightPosRightBottom = { hmin: 0.85, hmax: 1.0, vmin: 0.5, vmax: 1.0 };
|
||||
var lightPosEntire = { hmin: 0.0, hmax: 1.0, vmin: 0.0, vmax: 1.0 };
|
||||
|
||||
var lightPosBottomLeft14 = { hmin: 0, hmax: 0.25, vmin: 0.85, vmax: 1.0 };
|
||||
var lightPosBottomLeft12 = { hmin: 0.25, hmax: 0.5, vmin: 0.85, vmax: 1.0 };
|
||||
var lightPosBottomLeft34 = { hmin: 0.5, hmax: 0.75, vmin: 0.85, vmax: 1.0 };
|
||||
var lightPosBottomLeft11 = { hmin: 0.75, hmax: 1, vmin: 0.85, vmax: 1.0 };
|
||||
|
||||
var lightPosBottomLeft112 = { hmin: 0, hmax: 0.5, vmin: 0.85, vmax: 1.0 };
|
||||
var lightPosBottomLeft121 = { hmin: 0.5, hmax: 1, vmin: 0.85, vmax: 1.0 };
|
||||
var lightPosBottomLeftNewMid = { hmin: 0.25, hmax: 0.75, vmin: 0.85, vmax: 1.0 };
|
||||
|
||||
var lightPosTopLeft112 = { hmin: 0, hmax: 0.5, vmin: 0, vmax: 0.15 };
|
||||
var lightPosTopLeft121 = { hmin: 0.5, hmax: 1, vmin: 0, vmax: 0.15 };
|
||||
var lightPosTopLeftNewMid = { hmin: 0.25, hmax: 0.75, vmin: 0, vmax: 0.15 };
|
||||
|
||||
function assignLightPos(id, pos, name) {
|
||||
var i = null;
|
||||
|
||||
@@ -622,6 +635,26 @@ function assignLightPos(id, pos, name) {
|
||||
i = lightPosRightMiddle;
|
||||
else if (pos === "rightbottom")
|
||||
i = lightPosRightBottom;
|
||||
else if (pos === "lightPosBottomLeft14")
|
||||
i = lightPosBottomLeft14;
|
||||
else if (pos === "lightPosBottomLeft12")
|
||||
i = lightPosBottomLeft12;
|
||||
else if (pos === "lightPosBottomLeft34")
|
||||
i = lightPosBottomLeft34;
|
||||
else if (pos === "lightPosBottomLeft11")
|
||||
i = lightPosBottomLeft11;
|
||||
else if (pos === "lightPosBottomLeft112")
|
||||
i = lightPosBottomLeft112;
|
||||
else if (pos === "lightPosBottomLeft121")
|
||||
i = lightPosBottomLeft121;
|
||||
else if (pos === "lightPosBottomLeftNewMid")
|
||||
i = lightPosBottomLeftNewMid;
|
||||
else if (pos === "lightPosTopLeft112")
|
||||
i = lightPosTopLeft112;
|
||||
else if (pos === "lightPosTopLeft121")
|
||||
i = lightPosTopLeft121;
|
||||
else if (pos === "lightPosTopLeftNewMid")
|
||||
i = lightPosTopLeftNewMid;
|
||||
else
|
||||
i = lightPosEntire;
|
||||
|
||||
@@ -653,21 +686,22 @@ function getIdInLights(id) {
|
||||
);
|
||||
}
|
||||
|
||||
// External properties properties, 2-dimensional arry of [ledType][key]
|
||||
devicesProperties = {};
|
||||
|
||||
//****************************
|
||||
// Wizard Philips Hue
|
||||
//****************************
|
||||
|
||||
var hueIPs = [];
|
||||
var hueIPsinc = 0;
|
||||
var lightIDs = null;
|
||||
var groupIDs = null;
|
||||
var hueLights = null;
|
||||
var hueGroups = null;
|
||||
var lightLocation = [];
|
||||
var groupLights = [];
|
||||
var groupLightsLocations = [];
|
||||
var hueType = "philipshue";
|
||||
|
||||
let hueUrl = new URL('http://dummy');
|
||||
|
||||
function startWizardPhilipsHue(e) {
|
||||
if (typeof e.data.type != "undefined") hueType = e.data.type;
|
||||
|
||||
@@ -739,7 +773,7 @@ function startWizardPhilipsHue(e) {
|
||||
$('#wizp2_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_save" style="display:none"><i class="fa fa-fw fa-save"></i>' + $.i18n('general_btn_save') + '</button><button type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>' + $.i18n('general_btn_cancel') + '</button>');
|
||||
$('#wizp3_body').html('<span>' + $.i18n('wiz_hue_press_link') + '</span> <br /><br /><center><span id="connectionTime"></span><br /><i class="fa fa-cog fa-spin" style="font-size:100px"></i></center>');
|
||||
|
||||
if (getStorage("darkMode", false) == "on")
|
||||
if (getStorage("darkMode") == "on")
|
||||
$('#wizard_logo').attr("src", 'img/hyperion/logo_negativ.png');
|
||||
|
||||
//open modal
|
||||
@@ -762,43 +796,10 @@ function checkHueBridge(cb, hueUser) {
|
||||
if (usr == 'config') $('#wiz_hue_discovered').html("");
|
||||
|
||||
if (hueIPs[hueIPsinc]) {
|
||||
|
||||
hueUrl.hostname = "dummy";
|
||||
var host = hueIPs[hueIPsinc].host;
|
||||
|
||||
if (isValidIPv6(host)) {
|
||||
hueUrl.hostname = "[" + host + "]";
|
||||
} else {
|
||||
hueUrl.hostname = host;
|
||||
}
|
||||
|
||||
var port = hueIPs[hueIPsinc].port;
|
||||
if (port > 0) {
|
||||
hueUrl.port = port;
|
||||
}
|
||||
|
||||
hueUrl.pathname = '/api/' + usr;
|
||||
$.ajax({
|
||||
url: hueUrl,
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
timeout: 2500
|
||||
})
|
||||
.done(function (json) {
|
||||
if (json.config) {
|
||||
cb(true, usr);
|
||||
} else {
|
||||
if (json.name && json.bridgeid && json.modelid) {
|
||||
$('#wiz_hue_discovered').html("Bridge: " + json.name + ", Modelid: " + json.modelid + ", API-Version: " + json.apiversion);
|
||||
cb(true);
|
||||
} else {
|
||||
cb(false);
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail(function () {
|
||||
cb(false);
|
||||
});
|
||||
getProperties_hue_bridge(cb, decodeURIComponent(host), port, usr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -809,7 +810,6 @@ function checkBridgeResult(reply, usr) {
|
||||
$('#host').val(hueIPs[hueIPsinc].host)
|
||||
$('#port').val(hueIPs[hueIPsinc].port)
|
||||
|
||||
//now check hue user on this bridge
|
||||
$('#usrcont').toggle(true);
|
||||
checkHueBridge(checkUserResult, $('#user').val() ? $('#user').val() : "newdeveloper");
|
||||
}
|
||||
@@ -852,28 +852,10 @@ function checkUserResult(reply, usr) {
|
||||
}
|
||||
};
|
||||
|
||||
function identHueId(id, off, oState) {
|
||||
if (off !== true) {
|
||||
setTimeout(identHueId, 1500, id, true, oState);
|
||||
var put_data = '{"on":true,"bri":254,"hue":47000,"sat":254}';
|
||||
}
|
||||
else {
|
||||
var put_data = '{"on":' + oState.on + ',"bri":' + oState.bri + ',"hue":' + oState.hue + ',"sat":' + oState.sat + '}';
|
||||
}
|
||||
|
||||
hueUrl.pathname = '/api/' + $('#user').val() + '/lights/' + id + '/state',
|
||||
$.ajax({
|
||||
url: hueUrl,
|
||||
type: 'PUT',
|
||||
timeout: 2000,
|
||||
data: put_data
|
||||
})
|
||||
}
|
||||
|
||||
function useGroupId(id) {
|
||||
$('#groupId').val(id);
|
||||
groupLights = groupIDs[id].lights;
|
||||
groupLightsLocations = groupIDs[id].locations;
|
||||
groupLights = hueGroups[id].lights;
|
||||
groupLightsLocations = hueGroups[id].locations;
|
||||
get_hue_lights();
|
||||
}
|
||||
|
||||
@@ -881,9 +863,6 @@ async function discover_hue_bridges() {
|
||||
$('#wiz_hue_ipstate').html($.i18n('edt_dev_spec_devices_discovery_inprogress'));
|
||||
$('#wiz_hue_discovered').html("")
|
||||
const res = await requestLedDeviceDiscovery('philipshue');
|
||||
|
||||
// TODO: error case unhandled
|
||||
// res can be: false (timeout) or res.error (not found)
|
||||
if (res && !res.error) {
|
||||
const r = res.info;
|
||||
|
||||
@@ -896,18 +875,33 @@ async function discover_hue_bridges() {
|
||||
hueIPs = [];
|
||||
hueIPsinc = 0;
|
||||
|
||||
var discoveryMethod = "ssdp";
|
||||
if (res.info.discoveryMethod) {
|
||||
discoveryMethod = res.info.discoveryMethod;
|
||||
}
|
||||
|
||||
for (const device of r.devices) {
|
||||
if (device && device.ip && device.port) {
|
||||
if (device) {
|
||||
var host;
|
||||
var port;
|
||||
if (device.hostname && device.domain) {
|
||||
host = device.hostname + "." + device.domain;
|
||||
port = device.port;
|
||||
if (discoveryMethod === "ssdp") {
|
||||
if (device.hostname && device.domain) {
|
||||
host = device.hostname + "." + device.domain;
|
||||
port = device.port;
|
||||
} else {
|
||||
host = device.ip;
|
||||
port = device.port;
|
||||
}
|
||||
} else {
|
||||
host = device.ip;
|
||||
host = device.service;
|
||||
port = device.port;
|
||||
}
|
||||
|
||||
//Remap https port to http port until Hue-API v2 is supported
|
||||
if (port == 443) {
|
||||
port = 80;
|
||||
}
|
||||
|
||||
if (host) {
|
||||
|
||||
if (!hueIPs.some(item => item.host === host)) {
|
||||
@@ -930,65 +924,71 @@ async function discover_hue_bridges() {
|
||||
}
|
||||
}
|
||||
|
||||
async function getProperties_hue_bridge(hostAddress, port, username, resourceFilter) {
|
||||
async function getProperties_hue_bridge(cb, hostAddress, port, username, resourceFilter) {
|
||||
let params = { host: hostAddress, user: username, filter: resourceFilter };
|
||||
if (port !== 'undefined') {
|
||||
params.port = port;
|
||||
params.port = parseInt(port);
|
||||
}
|
||||
|
||||
const res = await requestLedDeviceProperties('philipshue', params);
|
||||
var ledType = 'philipshue';
|
||||
var key = hostAddress;
|
||||
|
||||
// TODO: error case unhandled
|
||||
// res can be: false (timeout) or res.error (not found)
|
||||
if (res && !res.error) {
|
||||
const r = res.info
|
||||
//Create ledType cache entry
|
||||
if (!devicesProperties[ledType]) {
|
||||
devicesProperties[ledType] = {};
|
||||
}
|
||||
|
||||
// Process properties returned
|
||||
console.log(r);
|
||||
// Use device's properties, if properties in chache
|
||||
if (devicesProperties[ledType][key]) {
|
||||
cb(true, username);
|
||||
} else {
|
||||
const res = await requestLedDeviceProperties(ledType, params);
|
||||
|
||||
|
||||
if (res && !res.error) {
|
||||
var ledDeviceProperties = res.info.properties;
|
||||
if (!jQuery.isEmptyObject(ledDeviceProperties)) {
|
||||
|
||||
if (username === "config") {
|
||||
if (ledDeviceProperties.name && ledDeviceProperties.bridgeid && ledDeviceProperties.modelid) {
|
||||
$('#wiz_hue_discovered').html("Bridge: " + ledDeviceProperties.name + ", Modelid: " + ledDeviceProperties.modelid + ", API-Version: " + ledDeviceProperties.apiversion);
|
||||
cb(true);
|
||||
}
|
||||
} else {
|
||||
devicesProperties[ledType][key] = ledDeviceProperties;
|
||||
cb(true, username);
|
||||
}
|
||||
} else {
|
||||
cb(false, username);
|
||||
}
|
||||
} else {
|
||||
cb(false, username);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function identify_hue_device(hostAddress, port, username, id) {
|
||||
|
||||
var disabled = $('#btn_wiz_save').is(':disabled');
|
||||
// Take care that new record cannot be save during background process
|
||||
$('#btn_wiz_save').prop('disabled', true);
|
||||
|
||||
let params = { host: hostAddress, user: username, lightId: id };
|
||||
let params = { host: decodeURIComponent(hostAddress), user: username, lightId: id };
|
||||
|
||||
if (port !== 'undefined') {
|
||||
params.port = port;
|
||||
params.port = parseInt(port);
|
||||
}
|
||||
|
||||
await requestLedDeviceIdentification('philipshue', params);
|
||||
|
||||
if (!window.readOnlyMode) {
|
||||
$('#btn_wiz_save').prop('disabled', false);
|
||||
$('#btn_wiz_save').prop('disabled', disabled);
|
||||
}
|
||||
}
|
||||
|
||||
function getHueIPs() {
|
||||
$('#wiz_hue_ipstate').html($.i18n('wiz_hue_searchb'));
|
||||
|
||||
$.ajax({
|
||||
url: 'https://discovery.meethue.com',
|
||||
crossDomain: true,
|
||||
type: 'GET',
|
||||
timeout: 3000
|
||||
})
|
||||
.done(function (data, textStatus, jqXHR) {
|
||||
if (data.length == 0) {
|
||||
$('#wiz_hue_ipstate').html($.i18n('wiz_hue_failure_ip'));
|
||||
} else {
|
||||
hueIPs = data;
|
||||
checkHueBridge(checkBridgeResult);
|
||||
}
|
||||
})
|
||||
.fail(function (jqXHR, textStatus) {
|
||||
$('#wiz_hue_ipstate').html($.i18n('wiz_hue_failure_ip'));
|
||||
});
|
||||
};
|
||||
|
||||
//return editor Value
|
||||
function eV(vn) {
|
||||
return (vn) ? conf_editor.getEditor("root.specificOptions." + vn).getValue() : "";
|
||||
function eV(vn, defaultVal = "") {
|
||||
var editor = (vn) ? conf_editor.getEditor("root.specificOptions." + vn) : null;
|
||||
return (editor == null) ? defaultVal : ((defaultVal != "" && !isNaN(defaultVal) && isNaN(editor.getValue())) ? defaultVal : editor.getValue());
|
||||
}
|
||||
|
||||
function beginWizardHue() {
|
||||
@@ -1009,7 +1009,6 @@ function beginWizardHue() {
|
||||
hueIPs = [];
|
||||
hueIPsinc = 0;
|
||||
|
||||
//getHueIPs();
|
||||
discover_hue_bridges();
|
||||
}
|
||||
else {
|
||||
@@ -1068,13 +1067,13 @@ function beginWizardHue() {
|
||||
var finalLightIds = [];
|
||||
|
||||
//create hue led config
|
||||
for (var key in lightIDs) {
|
||||
for (var key in hueLights) {
|
||||
if (hueType == 'philipshueentertainment') {
|
||||
if (groupLights.indexOf(key) == -1) continue;
|
||||
}
|
||||
if ($('#hue_' + key).val() != "disabled") {
|
||||
finalLightIds.push(key);
|
||||
var idx_content = assignLightPos(key, $('#hue_' + key).val(), lightIDs[key].name);
|
||||
var idx_content = assignLightPos(key, $('#hue_' + key).val(), hueLights[key].name);
|
||||
hueLedConfig.push(JSON.parse(JSON.stringify(idx_content)));
|
||||
}
|
||||
}
|
||||
@@ -1100,23 +1099,28 @@ function beginWizardHue() {
|
||||
d.type = 'philipshue';
|
||||
d.colorOrder = 'rgb';
|
||||
d.lightIds = finalLightIds;
|
||||
d.transitiontime = parseInt(eV("transitiontime"));
|
||||
d.restoreOriginalState = (eV("restoreOriginalState") == true);
|
||||
d.switchOffOnBlack = (eV("switchOffOnBlack") == true);
|
||||
d.brightnessFactor = parseFloat(eV("brightnessFactor"));
|
||||
d.transitiontime = parseInt(eV("transitiontime", 1));
|
||||
d.restoreOriginalState = (eV("restoreOriginalState", false) == true);
|
||||
d.switchOffOnBlack = (eV("switchOffOnBlack", false) == true);
|
||||
|
||||
d.blackLevel = parseFloat(eV("blackLevel", 0.009));
|
||||
d.onBlackTimeToPowerOff = parseInt(eV("onBlackTimeToPowerOff", 600));
|
||||
d.onBlackTimeToPowerOn = parseInt(eV("onBlackTimeToPowerOn", 300));
|
||||
d.brightnessFactor = parseFloat(eV("brightnessFactor", 1));
|
||||
|
||||
d.clientkey = $('#clientkey').val();
|
||||
d.groupId = parseInt($('#groupId').val());
|
||||
d.blackLightsTimeout = parseInt(eV("blackLightsTimeout"));
|
||||
d.brightnessMin = parseFloat(eV("brightnessMin"));
|
||||
d.brightnessMax = parseFloat(eV("brightnessMax"));
|
||||
d.brightnessThreshold = parseFloat(eV("brightnessThreshold"));
|
||||
d.sslReadTimeout = parseInt(eV("sslReadTimeout"));
|
||||
d.sslHSTimeoutMin = parseInt(eV("sslHSTimeoutMin"));
|
||||
d.sslHSTimeoutMax = parseInt(eV("sslHSTimeoutMax"));
|
||||
d.blackLightsTimeout = parseInt(eV("blackLightsTimeout", 5000));
|
||||
d.brightnessMin = parseFloat(eV("brightnessMin", 0));
|
||||
d.brightnessMax = parseFloat(eV("brightnessMax", 1));
|
||||
d.brightnessThreshold = parseFloat(eV("brightnessThreshold", 0.0001));
|
||||
d.handshakeTimeoutMin = parseInt(eV("handshakeTimeoutMin", 300));
|
||||
d.handshakeTimeoutMax = parseInt(eV("handshakeTimeoutMax", 1000));
|
||||
d.verbose = (eV("verbose") == true);
|
||||
d.debugStreamer = (eV("debugStreamer") == true);
|
||||
d.debugLevel = (eV("debugLevel"));
|
||||
|
||||
d.autoStart = conf_editor.getEditor("root.generalOptions.autoStart").getValue();
|
||||
d.enableAttempts = parseInt(conf_editor.getEditor("root.generalOptions.enableAttempts").getValue());
|
||||
d.enableAttemptsInterval = parseInt(conf_editor.getEditor("root.generalOptions.enableAttemptsInterval").getValue());
|
||||
|
||||
if (hueType == 'philipshue') {
|
||||
d.useEntertainmentAPI = false;
|
||||
@@ -1129,7 +1133,6 @@ function beginWizardHue() {
|
||||
if (hueType == 'philipshueentertainment') {
|
||||
d.useEntertainmentAPI = true;
|
||||
d.hardwareLedCount = groupLights.length;
|
||||
d.rewriteTime = 20;
|
||||
//smoothing on
|
||||
sc.smoothing.enable = true;
|
||||
}
|
||||
@@ -1144,83 +1147,92 @@ function beginWizardHue() {
|
||||
}
|
||||
|
||||
function createHueUser() {
|
||||
var connectionRetries = 30;
|
||||
var data = { "devicetype": "hyperion#" + Date.now() }
|
||||
if (hueType == 'philipshueentertainment') {
|
||||
data = { "devicetype": "hyperion#" + Date.now(), "generateclientkey": true }
|
||||
|
||||
var host = hueIPs[hueIPsinc].host;
|
||||
var port = hueIPs[hueIPsinc].port;
|
||||
|
||||
let params = { host: host };
|
||||
if (port !== 'undefined') {
|
||||
params.port = parseInt(port);
|
||||
}
|
||||
|
||||
var retryTime = 30;
|
||||
var retryInterval = 2;
|
||||
|
||||
var UserInterval = setInterval(function () {
|
||||
|
||||
hueUrl.pathname = '/api/';
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: hueUrl,
|
||||
processData: false,
|
||||
timeout: 1000,
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify(data)
|
||||
})
|
||||
.done(function (r) {
|
||||
$('#wizp1').toggle(false);
|
||||
$('#wizp2').toggle(false);
|
||||
$('#wizp3').toggle(true);
|
||||
$('#wizp1').toggle(false);
|
||||
$('#wizp2').toggle(false);
|
||||
$('#wizp3').toggle(true);
|
||||
|
||||
connectionRetries--;
|
||||
$("#connectionTime").html(connectionRetries);
|
||||
if (connectionRetries == 0) {
|
||||
abortConnection(UserInterval);
|
||||
}
|
||||
else {
|
||||
if (typeof r[0].error != 'undefined') {
|
||||
console.log(connectionRetries + ": link not pressed");
|
||||
}
|
||||
if (typeof r[0].success != 'undefined') {
|
||||
(async () => {
|
||||
|
||||
retryTime -= retryInterval;
|
||||
$("#connectionTime").html(retryTime);
|
||||
if (retryTime <= 0) {
|
||||
abortConnection(UserInterval);
|
||||
clearInterval(UserInterval);
|
||||
}
|
||||
else {
|
||||
const res = await requestLedDeviceAddAuthorization('philipshue', params);
|
||||
if (res && !res.error) {
|
||||
var response = res.info;
|
||||
|
||||
if (jQuery.isEmptyObject(response)) {
|
||||
debugMessage(retryTime + ": link button not pressed or device not reachable");
|
||||
} else {
|
||||
$('#wizp1').toggle(false);
|
||||
$('#wizp2').toggle(true);
|
||||
$('#wizp3').toggle(false);
|
||||
if (r[0].success.username != 'undefined') {
|
||||
$('#user').val(r[0].success.username);
|
||||
conf_editor.getEditor("root.specificOptions.username").setValue(r[0].success.username);
|
||||
|
||||
var username = response.username;
|
||||
if (username != 'undefined') {
|
||||
$('#user').val(username);
|
||||
conf_editor.getEditor("root.specificOptions.username").setValue(username);
|
||||
conf_editor.getEditor("root.specificOptions.host").setValue(host);
|
||||
conf_editor.getEditor("root.specificOptions.port").setValue(port);
|
||||
}
|
||||
if (hueType == 'philipshueentertainment') {
|
||||
if (r[0].success.clientkey != 'undefined') {
|
||||
$('#clientkey').val(r[0].success.clientkey);
|
||||
conf_editor.getEditor("root.specificOptions.clientkey").setValue(r[0].success.clientkey);
|
||||
var clientkey = response.clientkey;
|
||||
if (clientkey != 'undefined') {
|
||||
$('#clientkey').val(clientkey);
|
||||
conf_editor.getEditor("root.specificOptions.clientkey").setValue(clientkey);
|
||||
}
|
||||
}
|
||||
checkHueBridge(checkUserResult, r[0].success.username);
|
||||
checkHueBridge(checkUserResult, username);
|
||||
clearInterval(UserInterval);
|
||||
}
|
||||
} else {
|
||||
$('#wizp1').toggle(false);
|
||||
$('#wizp2').toggle(true);
|
||||
$('#wizp3').toggle(false);
|
||||
clearInterval(UserInterval);
|
||||
}
|
||||
})
|
||||
.fail(function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
$('#wizp1').toggle(false);
|
||||
$('#wizp2').toggle(true);
|
||||
$('#wizp3').toggle(false);
|
||||
clearInterval(UserInterval);
|
||||
})
|
||||
}, 1000);
|
||||
}
|
||||
})();
|
||||
|
||||
}, retryInterval * 1000);
|
||||
}
|
||||
|
||||
function get_hue_groups() {
|
||||
hueUrl.pathname = '/api/' + $("#user").val() + '/groups';
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: hueUrl,
|
||||
processData: false,
|
||||
contentType: 'application/json'
|
||||
})
|
||||
.done(function (r) {
|
||||
if (Object.keys(r).length > 0) {
|
||||
|
||||
var host = hueIPs[hueIPsinc].host;
|
||||
|
||||
if (devicesProperties['philipshue'][host]) {
|
||||
var ledProperties = devicesProperties['philipshue'][host];
|
||||
|
||||
if (!jQuery.isEmptyObject(ledProperties)) {
|
||||
hueGroups = ledProperties.groups;
|
||||
if (Object.keys(hueGroups).length > 0) {
|
||||
|
||||
$('.lidsb').html("");
|
||||
$('#wh_topcontainer').toggle(false);
|
||||
$('#hue_grp_ids_t').toggle(true);
|
||||
|
||||
groupIDs = r;
|
||||
|
||||
var gC = 0;
|
||||
for (var groupid in r) {
|
||||
if (r[groupid].type == 'Entertainment') {
|
||||
$('.gidsb').append(createTableRow([groupid + ' (' + r[groupid].name + ')', '<button class="btn btn-sm btn-primary" onClick=useGroupId(' + groupid + ')>' + $.i18n('wiz_hue_e_use_groupid', groupid) + '</button>']));
|
||||
for (var groupid in hueGroups) {
|
||||
if (hueGroups[groupid].type == 'Entertainment') {
|
||||
$('.gidsb').append(createTableRow([groupid + ' (' + hueGroups[groupid].name + ')', '<button class="btn btn-sm btn-primary" onClick=useGroupId(' + groupid + ')>' + $.i18n('wiz_hue_e_use_groupid', groupid) + '</button>']));
|
||||
gC++;
|
||||
}
|
||||
}
|
||||
@@ -1228,10 +1240,8 @@ function get_hue_groups() {
|
||||
noAPISupport('wiz_hue_e_noegrpids');
|
||||
}
|
||||
}
|
||||
else {
|
||||
noAPISupport('wiz_hue_e_nogrpids');
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function noAPISupport(txt) {
|
||||
@@ -1247,42 +1257,30 @@ function noAPISupport(txt) {
|
||||
get_hue_lights();
|
||||
}
|
||||
|
||||
function get_light_state(id) {
|
||||
hueUrl.pathname = '/api/' + $("#user").val() + '/lights/' + id;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: hueUrl,
|
||||
processData: false,
|
||||
contentType: 'application/json'
|
||||
})
|
||||
.done(function (r) {
|
||||
if (Object.keys(r).length > 0) {
|
||||
identHueId(id, false, r['state']);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function get_hue_lights() {
|
||||
hueUrl.pathname = '/api/' + $("#user").val() + '/lights';
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: hueUrl,
|
||||
processData: false,
|
||||
contentType: 'application/json'
|
||||
})
|
||||
.done(function (r) {
|
||||
if (Object.keys(r).length > 0) {
|
||||
|
||||
var host = hueIPs[hueIPsinc].host;
|
||||
|
||||
if (devicesProperties['philipshue'][host]) {
|
||||
var ledProperties = devicesProperties['philipshue'][host];
|
||||
|
||||
if (!jQuery.isEmptyObject(ledProperties.lights)) {
|
||||
hueLights = ledProperties.lights;
|
||||
if (Object.keys(hueLights).length > 0) {
|
||||
if (hueType == 'philipshue') {
|
||||
$('#wh_topcontainer').toggle(false);
|
||||
}
|
||||
$('#hue_ids_t, #btn_wiz_save').toggle(true);
|
||||
lightIDs = r;
|
||||
|
||||
var lightOptions = [
|
||||
"top", "topleft", "topright",
|
||||
"bottom", "bottomleft", "bottomright",
|
||||
"left", "lefttop", "leftmiddle", "leftbottom",
|
||||
"right", "righttop", "rightmiddle", "rightbottom",
|
||||
"entire"
|
||||
"entire",
|
||||
"lightPosTopLeft112", "lightPosTopLeftNewMid", "lightPosTopLeft121",
|
||||
"lightPosBottomLeft14", "lightPosBottomLeft12", "lightPosBottomLeft34", "lightPosBottomLeft11",
|
||||
"lightPosBottomLeft112", "lightPosBottomLeftNewMid", "lightPosBottomLeft121"
|
||||
];
|
||||
|
||||
if (hueType == 'philipshue') {
|
||||
@@ -1291,7 +1289,7 @@ function get_hue_lights() {
|
||||
|
||||
$('.lidsb').html("");
|
||||
var pos = "";
|
||||
for (var lightid in r) {
|
||||
for (var lightid in hueLights) {
|
||||
if (hueType == 'philipshueentertainment') {
|
||||
if (groupLights.indexOf(lightid) == -1) continue;
|
||||
|
||||
@@ -1323,15 +1321,15 @@ function get_hue_lights() {
|
||||
if (pos == val) options += ' selected="selected"';
|
||||
options += '>' + $.i18n(txt + val) + '</option>';
|
||||
}
|
||||
$('.lidsb').append(createTableRow([lightid + ' (' + r[lightid].name + ')', '<select id="hue_' + lightid + '" class="hue_sel_watch form-control">'
|
||||
$('.lidsb').append(createTableRow([lightid + ' (' + hueLights[lightid].name + ')', '<select id="hue_' + lightid + '" class="hue_sel_watch form-control">'
|
||||
+ options
|
||||
+ '</select>', '<button class="btn btn-sm btn-primary" onClick=identify_hue_device("' + $("#host").val() + '","' + $("#port").val() + '","' + $("#user").val() + '",' + lightid + ')>' + $.i18n('wiz_hue_blinkblue', lightid) + '</button>']));
|
||||
+ '</select>', '<button class="btn btn-sm btn-primary" onClick=identify_hue_device("' + encodeURIComponent($("#host").val()) + '","' + $('#port').val() + '","' + $("#user").val() + '",' + lightid + ')>' + $.i18n('wiz_hue_blinkblue', lightid) + '</button>']));
|
||||
}
|
||||
|
||||
if (hueType != 'philipshueentertainment') {
|
||||
$('.hue_sel_watch').on("change", function () {
|
||||
var cC = 0;
|
||||
for (var key in lightIDs) {
|
||||
for (var key in hueLights) {
|
||||
if ($('#hue_' + key).val() != "disabled") {
|
||||
cC++;
|
||||
}
|
||||
@@ -1346,7 +1344,8 @@ function get_hue_lights() {
|
||||
var txt = '<p style="font-weight:bold;color:red;">' + $.i18n('wiz_hue_noids') + '</p>';
|
||||
$('#wizp2_body').append(txt);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function abortConnection(UserInterval) {
|
||||
@@ -1386,7 +1385,7 @@ function startWizardYeelight(e) {
|
||||
+ $.i18n('general_btn_save') + '</button><buttowindow.serverConfig.device = d;n type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>'
|
||||
+ $.i18n('general_btn_cancel') + '</button>');
|
||||
|
||||
if (getStorage("darkMode", false) == "on")
|
||||
if (getStorage("darkMode") == "on")
|
||||
$('#wizard_logo').attr("src", 'img/hyperion/logo_negativ.png');
|
||||
|
||||
//open modal
|
||||
@@ -1413,19 +1412,15 @@ function beginWizardYeelight() {
|
||||
//create yeelight led config
|
||||
for (var key in lights) {
|
||||
if ($('#yee_' + key).val() !== "disabled") {
|
||||
//delete lights[key].model;
|
||||
|
||||
var name = lights[key].name;
|
||||
// Set Name to layout-position, if empty
|
||||
if (lights[key].name === "") {
|
||||
lights[key].name = $.i18n('conf_leds_layout_cl_' + $('#yee_' + key).val());
|
||||
if (name === "") {
|
||||
name = lights[key].host;
|
||||
}
|
||||
|
||||
finalLights.push(lights[key]);
|
||||
|
||||
var name = lights[key].host;
|
||||
if (lights[key].name !== "")
|
||||
name += '_' + lights[key].name;
|
||||
|
||||
var idx_content = assignLightPos(key, $('#yee_' + key).val(), name);
|
||||
yeelightLedConfig.push(JSON.parse(JSON.stringify(idx_content)));
|
||||
}
|
||||
@@ -1460,7 +1455,8 @@ function beginWizardYeelight() {
|
||||
window.serverConfig.device = d;
|
||||
|
||||
//smoothing off
|
||||
window.serverConfig.smoothing.enable = false;
|
||||
if (!(window.serverConfig.smoothing == null))
|
||||
window.serverConfig.smoothing.enable = false;
|
||||
|
||||
requestWriteConfig(window.serverConfig, true);
|
||||
resetWizard();
|
||||
@@ -1479,24 +1475,31 @@ async function discover_yeelight_lights() {
|
||||
if (res && !res.error) {
|
||||
const r = res.info;
|
||||
|
||||
var discoveryMethod = "ssdp";
|
||||
if (res.info.discoveryMethod) {
|
||||
discoveryMethod = res.info.discoveryMethod;
|
||||
}
|
||||
|
||||
// Process devices returned by discovery
|
||||
for (const device of r.devices) {
|
||||
if (device.hostname !== "") {
|
||||
if (getHostInLights(device.hostname).length === 0) {
|
||||
var light = {};
|
||||
|
||||
light.host = device.hostname;
|
||||
|
||||
//Create a valid hostname
|
||||
if (device.domain)
|
||||
{
|
||||
light.host += '.' + device.domain;
|
||||
|
||||
if (discoveryMethod === "ssdp") {
|
||||
//Create a valid hostname
|
||||
if (device.domain) {
|
||||
light.host += '.' + device.domain;
|
||||
}
|
||||
} else {
|
||||
light.host = device.service;
|
||||
light.name = device.name;
|
||||
}
|
||||
|
||||
light.port = device.port;
|
||||
|
||||
if (device.txt) {
|
||||
light.name = device.name;
|
||||
light.model = device.txt.md;
|
||||
//Yeelight does not provide correct API port with mDNS response, use default one
|
||||
light.port = 55443;
|
||||
@@ -1547,7 +1550,10 @@ function assign_yeelight_lights() {
|
||||
"bottom", "bottomleft", "bottomright",
|
||||
"left", "lefttop", "leftmiddle", "leftbottom",
|
||||
"right", "righttop", "rightmiddle", "rightbottom",
|
||||
"entire"
|
||||
"entire",
|
||||
"lightPosTopLeft112", "lightPosTopLeftNewMid", "lightPosTopLeft121",
|
||||
"lightPosBottomLeft14", "lightPosBottomLeft12", "lightPosBottomLeft34", "lightPosBottomLeft11",
|
||||
"lightPosBottomLeft112", "lightPosBottomLeftNewMid", "lightPosBottomLeft121"
|
||||
];
|
||||
|
||||
lightOptions.unshift("disabled");
|
||||
@@ -1561,7 +1567,7 @@ function assign_yeelight_lights() {
|
||||
var lightName = lights[lightid].name;
|
||||
|
||||
if (lightName === "")
|
||||
lightName = $.i18n('edt_dev_spec_lights_itemtitle');
|
||||
lightName = $.i18n('edt_dev_spec_lights_itemtitle') + '(' + lightHostname + ')';
|
||||
|
||||
var options = "";
|
||||
for (var opt in lightOptions) {
|
||||
@@ -1578,10 +1584,10 @@ function assign_yeelight_lights() {
|
||||
options = '<option value=disabled>' + $.i18n('wiz_yeelight_unsupported') + '</option>';
|
||||
}
|
||||
|
||||
$('.lidsb').append(createTableRow([(parseInt(lightid, 10) + 1) + '. ' + lightName + '<br>(' + lightHostname + ')', '<select id="yee_' + lightid + '" ' + enabled + ' class="yee_sel_watch form-control">'
|
||||
$('.lidsb').append(createTableRow([(parseInt(lightid, 10) + 1) + '. ' + lightName, '<select id="yee_' + lightid + '" ' + enabled + ' class="yee_sel_watch form-control">'
|
||||
+ options
|
||||
+ '</select>', '<button class="btn btn-sm btn-primary" onClick=identify_yeelight_device("' + lightHostname + '",' + lightPort + ')>'
|
||||
+ $.i18n('wiz_identify_light', lightName) + '</button>']));
|
||||
+ $.i18n('wiz_identify') + '</button>']));
|
||||
}
|
||||
|
||||
$('.yee_sel_watch').on("change", function () {
|
||||
@@ -1605,8 +1611,8 @@ function assign_yeelight_lights() {
|
||||
}
|
||||
}
|
||||
|
||||
async function getProperties_yeelight(hostname, port) {
|
||||
let params = { hostname: hostname, port: port };
|
||||
async function getProperties_yeelight(host, port) {
|
||||
let params = { host: host, port: port };
|
||||
|
||||
const res = await requestLedDeviceProperties('yeelight', params);
|
||||
|
||||
@@ -1614,21 +1620,22 @@ async function getProperties_yeelight(hostname, port) {
|
||||
// res can be: false (timeout) or res.error (not found)
|
||||
if (res && !res.error) {
|
||||
const r = res.info
|
||||
|
||||
// Process properties returned
|
||||
console.log(r);
|
||||
console.log("Yeelight properties: ", r);
|
||||
}
|
||||
}
|
||||
|
||||
async function identify_yeelight_device(hostname, port) {
|
||||
async function identify_yeelight_device(host, port) {
|
||||
|
||||
var disabled = $('#btn_wiz_save').is(':disabled');
|
||||
|
||||
// Take care that new record cannot be save during background process
|
||||
$('#btn_wiz_save').prop('disabled', true);
|
||||
|
||||
let params = { hostname: hostname, port: port };
|
||||
let params = { host: host, port: port };
|
||||
await requestLedDeviceIdentification("yeelight", params);
|
||||
|
||||
if (!window.readOnlyMode) {
|
||||
$('#btn_wiz_save').prop('disabled', false);
|
||||
$('#btn_wiz_save').prop('disabled', disabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1661,7 +1668,7 @@ function startWizardAtmoOrb(e) {
|
||||
+ $.i18n('general_btn_save') + '</button><buttowindow.serverConfig.device = d;n type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>'
|
||||
+ $.i18n('general_btn_cancel') + '</button>');
|
||||
|
||||
if (getStorage("darkMode", false) == "on")
|
||||
if (getStorage("darkMode") == "on")
|
||||
$('#wizard_logo').attr("src", 'img/hyperion/logo_negativ.png');
|
||||
|
||||
//open modal
|
||||
@@ -1802,7 +1809,10 @@ function assign_atmoorb_lights() {
|
||||
"bottom", "bottomleft", "bottomright",
|
||||
"left", "lefttop", "leftmiddle", "leftbottom",
|
||||
"right", "righttop", "rightmiddle", "rightbottom",
|
||||
"entire"
|
||||
"entire",
|
||||
"lightPosTopLeft112", "lightPosTopLeftNewMid", "lightPosTopLeft121",
|
||||
"lightPosBottomLeft14", "lightPosBottomLeft12", "lightPosBottomLeft34", "lightPosBottomLeft11",
|
||||
"lightPosBottomLeft112", "lightPosBottomLeftNewMid", "lightPosBottomLeft121"
|
||||
];
|
||||
|
||||
lightOptions.unshift("disabled");
|
||||
@@ -1865,6 +1875,8 @@ function assign_atmoorb_lights() {
|
||||
}
|
||||
|
||||
async function identify_atmoorb_device(orbId) {
|
||||
var disabled = $('#btn_wiz_save').is(':disabled');
|
||||
|
||||
// Take care that new record cannot be save during background process
|
||||
$('#btn_wiz_save').prop('disabled', true);
|
||||
|
||||
@@ -1872,6 +1884,7 @@ async function identify_atmoorb_device(orbId) {
|
||||
await requestLedDeviceIdentification("atmoorb", params);
|
||||
|
||||
if (!window.readOnlyMode) {
|
||||
$('#btn_wiz_save').prop('disabled', false);
|
||||
$('#btn_wiz_save').prop('disabled', disabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user