LordGrey 4f1b95ec83
Add Home Assistant Lights support (#1763)
* New HomeAssistant LEDDevice

* Fix typos

* Ping Qt for Windows to 6.7 until aqtinstaller is fixed

* Fix HA default port handling

* HA - Update default latchtime and range

* Add HA Wizard and light selection

* Naming consistency

* Fix "Selected Hyperion instance is not running"

* CodeQL findings

* HA - allow to overwrite brightness by HA yes or no

* HA - Support switch off on black

* HA - Add transition time
2024-08-25 17:34:27 +02:00

83 lines
2.4 KiB
JavaScript
Executable File

//clear priority and other tasks if people reload the page or lost connection while a wizard was active
$(window.hyperion).one("ready", function (event) {
if (getStorage("wizardactive") === 'true') {
requestPriorityClear();
setStorage("wizardactive", false);
}
});
$("#btn_wizard_colorcalibration").click(async function () {
const { colorCalibrationKodiWizard } = await import('./wizards/colorCalibrationKodiWizard.js');
colorCalibrationKodiWizard.start();
});
$('#btn_wizard_byteorder').on('click', async () => {
const { rgbByteOrderWizard } = await import('./wizards/rgbByteOrderWizard.js');
rgbByteOrderWizard.start();
});
function resetWizard(reload) {
$("#wizard_modal").modal('hide');
requestPriorityClear();
setStorage("wizardactive", false);
$('#wizp1').toggle(true);
$('#wizp2').toggle(false);
$('#wizp3').toggle(false);
if (!reload) {
location.reload();
}
}
function createLedDeviceWizards(ledType) {
let data = {};
let title;
$('#btn_wiz_holder').html("");
$('#btn_led_device_wiz').off();
if (ledType == "philipshue") {
$('#btn_wiz_holder').show();
wizardName = ledType;
data = { wizardName };
title = 'wiz_hue_title';
}
else if (ledType == "nanoleaf") {
$('#btn_wiz_holder').hide();
wizardName = ledType;
data = { wizardName };
title = 'wiz_nanoleaf_user_auth_title';
}
else if (ledType == "homeassistant") {
$('#btn_wiz_holder').hide();
wizardName = "layoutLedPositions";
data = { wizardName, ledType };
title = 'wiz_layout_led_positions_title';
}
else if (ledType == "atmoorb") {
$('#btn_wiz_holder').show();
wizardName = ledType;
data = { wizardName };
title = 'wiz_atmoorb_title';
}
else if (ledType == "yeelight") {
$('#btn_wiz_holder').show();
wizardName = ledType;
data = { wizardName };
title = 'wiz_yeelight_title';
}
if (Object.keys(data).length !== 0) {
startLedDeviceWizard(data, title, wizardName + "Wizard");
}
}
function startLedDeviceWizard(data, hint, wizardName) {
$('#btn_wiz_holder').html("")
createHint("wizard", $.i18n(hint), "btn_wiz_holder", "btn_led_device_wiz");
$('#btn_led_device_wiz').off();
$('#btn_led_device_wiz').on('click', async (e) => {
const { [wizardName]: winzardObject } = await import('./wizards/LedDevice_' + data.wizardName + '.js');
winzardObject.start(e, data);
});
}