mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-20 06:27:01 +01:00
4.3.3.3 - Update NsPanelTs.ts
v4.3.3.3 if setOption = false, do not create automatically Alias (Functional/Servicemenu) and Datapoints
This commit is contained in:
@@ -795,6 +795,7 @@ let timeoutPower: any;
|
||||
let bgColorScrSaver: number = 0;
|
||||
let globalTracklist: any;
|
||||
let weatherAdapterInstanceNumber: number = 0;
|
||||
let isSetOptionActive: boolean = false;
|
||||
|
||||
let scheduleInitDimModeDay: any;
|
||||
let scheduleInitDimModeNight: any;
|
||||
@@ -809,13 +810,78 @@ onStop (function scriptStop () {
|
||||
if (scheduleInitDimModeNight!=null) clearSchedule(scheduleInitDimModeNight);
|
||||
}, 1000);
|
||||
|
||||
async function CheckConfigParameters() {
|
||||
try {
|
||||
if (existsObject(config.panelRecvTopic) == false) {
|
||||
console.error('Config-Parameter: << config.panelRecvTopic - ' + config.panelRecvTopic + ' >> is not reachable. Please Check Parameters!');
|
||||
}
|
||||
if (existsObject(config.panelSendTopic) == false) {
|
||||
console.error('Config-Parameter: << config.panelSendTopic - ' + config.panelSendTopic + ' >> is not reachable. Please Check Parameters!');
|
||||
}
|
||||
if (weatherAdapterInstance.substring(0, weatherAdapterInstance.length - 3) == 'daswetter') {
|
||||
if (existsObject(weatherAdapterInstance + 'NextHours.Location_1.Day_1.current.symbol_value') == false) {
|
||||
console.error('Wetter-Adapter: << weatherAdapterInstance - ' + weatherAdapterInstance + ' >> is not installed. Please Check Adapter!');
|
||||
}
|
||||
}
|
||||
if (weatherAdapterInstance.substring(0, weatherAdapterInstance.length - 3) == 'accuweather') {
|
||||
if (existsObject(weatherAdapterInstance + 'Current.WeatherIcon') == false) {
|
||||
console.error('Wetter-Adapter: << weatherAdapterInstance - ' + weatherAdapterInstance + ' >> is not installed. Please Check Adapter!');
|
||||
}
|
||||
}
|
||||
|
||||
let weatherAdapterInstanceArray: any = weatherAdapterInstance.split(".");
|
||||
weatherAdapterInstanceNumber = weatherAdapterInstanceArray[1];
|
||||
if (Debug) console.log('Number of weatherAdapterInstance: ' + weatherAdapterInstanceNumber);
|
||||
|
||||
const adapterList = $('system.adapter.*.alive');
|
||||
adapterList.each(function(id, i) {
|
||||
id = id.substring(0, id.lastIndexOf('.'));
|
||||
if(existsObject(id)) {
|
||||
let common = getObject(id).common;
|
||||
if (common.name == 'javascript') {
|
||||
let jsVersion = common.version.split('.');
|
||||
let jsV = 10*parseInt(jsVersion[0]) + parseInt(jsVersion[1]);
|
||||
if (jsV<61) console.error('JS-Adapter: ' + common.name + ' must be at least v6.1.3. Currently: v' + common.version);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const hostList = $('system.host.*.nodeCurrent');
|
||||
hostList.each(function(id, i) {
|
||||
let nodeJSVersion = (getState(id).val).split('.');
|
||||
if (parseInt(nodeJSVersion[0]) < 18) {
|
||||
console.warn('nodeJS must be at least v18.X.X. Currently: v' + getState(id).val + '! Please Update your System! --> iob nodejs-update 18');
|
||||
}
|
||||
if (parseInt(nodeJSVersion[0])%2 != 0) {
|
||||
console.warn('nodeJS does not have an even version number. An odd version number is a developer version. Please correct nodeJS version');
|
||||
}
|
||||
});
|
||||
if (existsObject(config.mrIcon1ScreensaverEntity.ScreensaverEntity) == false && config.mrIcon1ScreensaverEntity.ScreensaverEntity != null) {
|
||||
console.warn('mrIcon1ScreensaverEntity data point in the config not available - please adjust');
|
||||
}
|
||||
if (existsObject(config.mrIcon2ScreensaverEntity.ScreensaverEntity) == false && config.mrIcon2ScreensaverEntity.ScreensaverEntity != null) {
|
||||
console.warn('mrIcon2ScreensaverEntity data point in the config not available - please adjust');
|
||||
}
|
||||
if (CheckEnableSetObject) {
|
||||
console.log('setObjects enabled - create Alias Channels possible');
|
||||
isSetOptionActive = true;
|
||||
} else {
|
||||
console.warn('setObjects disabled - Please enable setObjects in JS-Adapter Instance - create Alias Channels not possible');
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('error at function CheckConfigParameters: ' + err.message);
|
||||
}
|
||||
}
|
||||
CheckConfigParameters();
|
||||
|
||||
async function CheckDebugMode() {
|
||||
try {
|
||||
|
||||
if (isSetOptionActive) {
|
||||
await createStateAsync(NSPanel_Path + 'Config.ScripgtDebugStatus', false, { type: 'boolean' });
|
||||
setObject(AliasPath + 'Config.ScripgtDebugStatus', {type: 'channel', common: {role: 'socket', name:'ScripgtDebugStatus'}, native: {}});
|
||||
await createAliasAsync(AliasPath + 'Config.ScripgtDebugStatus.ACTUAL', NSPanel_Path + 'Config.ScripgtDebugStatus', true, <iobJS.StateCommon>{ type: 'boolean', role: 'switch', name: 'ACTUAL' });
|
||||
await createAliasAsync(AliasPath + 'Config.ScripgtDebugStatus.SET', NSPanel_Path + 'Config.ScripgtDebugStatus', true, <iobJS.StateCommon>{ type: 'boolean', role: 'switch', name: 'SET' });
|
||||
}
|
||||
|
||||
if(getState(NSPanel_Path + 'Config.ScripgtDebugStatus').val){
|
||||
Debug = true;
|
||||
@@ -835,10 +901,12 @@ async function CheckMQTTPorts() {
|
||||
try {
|
||||
let instanceName: string = config.panelRecvTopic.substring(0,6);
|
||||
|
||||
if (isSetOptionActive) {
|
||||
await createStateAsync(NSPanel_Path + 'Config.MQTT.portCheck', true, { type: 'boolean' });
|
||||
setObject(AliasPath + 'Config.MQTT.portCheck', {type: 'channel', common: {role: 'socket', name:'mqttPortCheck'}, native: {}});
|
||||
await createAliasAsync(AliasPath + 'Config.MQTT.portCheck.ACTUAL', NSPanel_Path + 'Config.MQTT.portCheck', true, <iobJS.StateCommon>{ type: 'boolean', role: 'switch', name: 'ACTUAL' });
|
||||
await createAliasAsync(AliasPath + 'Config.MQTT.portCheck.SET', NSPanel_Path + 'Config.MQTT.portCheck', true, <iobJS.StateCommon>{ type: 'boolean', role: 'switch', name: 'SET' });
|
||||
}
|
||||
|
||||
if (getState(NSPanel_Path + 'Config.MQTT.portCheck').val) {
|
||||
let adapterArray: any = [];
|
||||
@@ -908,12 +976,14 @@ async function Init_Release() {
|
||||
//Create Long Term
|
||||
if (existsObject(NSPanel_Path + 'Display_Firmware.TFT.desiredVersion') == false) {
|
||||
//Create TFT DP's
|
||||
if (isSetOptionActive) {
|
||||
await createStateAsync(NSPanel_Path + 'Display_Firmware.TFT.currentVersion', currentFW + ' / v' + FWRelease[findFWIndex], { type: 'string' });
|
||||
await createStateAsync(NSPanel_Path + 'Display_Firmware.TFT.desiredVersion', desired_display_firmware_version, { type: 'string' });
|
||||
setObject(AliasPath + 'Display_Firmware.TFT.currentVersion', {type: 'channel', common: {role: 'info', name:'current TFT-Version'}, native: {}});
|
||||
setObject(AliasPath + 'Display_Firmware.TFT.desiredVersion', {type: 'channel', common: {role: 'info', name:'desired TFT-Version'}, native: {}});
|
||||
await createAliasAsync(AliasPath + 'Display_Firmware.TFT.currentVersion.ACTUAL', NSPanel_Path + 'Display_Firmware.TFT.currentVersion', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
|
||||
await createAliasAsync(AliasPath + 'Display_Firmware.TFT.desiredVersion.ACTUAL', NSPanel_Path + 'Display_Firmware.TFT.desiredVersion', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
|
||||
}
|
||||
} else {
|
||||
//Create TFT DP's
|
||||
await setStateAsync(NSPanel_Path + 'Display_Firmware.TFT.currentVersion', currentFW + ' / v' + FWRelease[findFWIndex]);
|
||||
@@ -927,6 +997,7 @@ Init_Release();
|
||||
|
||||
async function InitConfigParameters() {
|
||||
try {
|
||||
if (isSetOptionActive) {
|
||||
// alternativeScreensaverLayout (socket)
|
||||
await createStateAsync(NSPanel_Path + 'Config.Screensaver.alternativeScreensaverLayout', false, { type: 'boolean' });
|
||||
setObject(AliasPath + 'Config.Screensaver.alternativeScreensaverLayout', {type: 'channel', common: {role: 'socket', name:'alternativeScreensaverLayout'}, native: {}});
|
||||
@@ -979,6 +1050,7 @@ async function InitConfigParameters() {
|
||||
setObject(AliasPath + 'Config.temperatureUnitNumber', {type: 'channel', common: {role: 'buttonSensor', name:'temperatureUnitNumber'}, native: {}});
|
||||
await createAliasAsync(AliasPath + 'Config.temperatureUnitNumber.VALUE', NSPanel_Path + 'Config.temperatureUnitNumber', true, <iobJS.StateCommon>{ type: 'number', role: 'state', name: 'VALUE' });
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('error at function InitConfigParameters: ' + err.message);
|
||||
}
|
||||
@@ -1013,69 +1085,6 @@ on({id: [].concat(NSPanel_Path + 'Config.localeNumber')
|
||||
}
|
||||
});
|
||||
|
||||
async function CheckConfigParameters() {
|
||||
try {
|
||||
if (existsObject(config.panelRecvTopic) == false) {
|
||||
console.error('Config-Parameter: << config.panelRecvTopic - ' + config.panelRecvTopic + ' >> is not reachable. Please Check Parameters!');
|
||||
}
|
||||
if (existsObject(config.panelSendTopic) == false) {
|
||||
console.error('Config-Parameter: << config.panelSendTopic - ' + config.panelSendTopic + ' >> is not reachable. Please Check Parameters!');
|
||||
}
|
||||
if (weatherAdapterInstance.substring(0, weatherAdapterInstance.length - 3) == 'daswetter') {
|
||||
if (existsObject(weatherAdapterInstance + 'NextHours.Location_1.Day_1.current.symbol_value') == false) {
|
||||
console.error('Wetter-Adapter: << weatherAdapterInstance - ' + weatherAdapterInstance + ' >> is not installed. Please Check Adapter!');
|
||||
}
|
||||
}
|
||||
if (weatherAdapterInstance.substring(0, weatherAdapterInstance.length - 3) == 'accuweather') {
|
||||
if (existsObject(weatherAdapterInstance + 'Current.WeatherIcon') == false) {
|
||||
console.error('Wetter-Adapter: << weatherAdapterInstance - ' + weatherAdapterInstance + ' >> is not installed. Please Check Adapter!');
|
||||
}
|
||||
}
|
||||
|
||||
let weatherAdapterInstanceArray: any = weatherAdapterInstance.split(".");
|
||||
weatherAdapterInstanceNumber = weatherAdapterInstanceArray[1];
|
||||
if (Debug) console.log('Number of weatherAdapterInstance: ' + weatherAdapterInstanceNumber);
|
||||
|
||||
const adapterList = $('system.adapter.*.alive');
|
||||
adapterList.each(function(id, i) {
|
||||
id = id.substring(0, id.lastIndexOf('.'));
|
||||
if(existsObject(id)) {
|
||||
let common = getObject(id).common;
|
||||
if (common.name == 'javascript') {
|
||||
let jsVersion = common.version.split('.');
|
||||
let jsV = 10*parseInt(jsVersion[0]) + parseInt(jsVersion[1]);
|
||||
if (jsV<61) console.error('JS-Adapter: ' + common.name + ' must be at least v6.1.3. Currently: v' + common.version);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const hostList = $('system.host.*.nodeCurrent');
|
||||
hostList.each(function(id, i) {
|
||||
let nodeJSVersion = (getState(id).val).split('.');
|
||||
if (parseInt(nodeJSVersion[0]) < 18) {
|
||||
console.warn('nodeJS must be at least v18.X.X. Currently: v' + getState(id).val + '! Please Update your System! --> iob nodejs-update 18');
|
||||
}
|
||||
if (parseInt(nodeJSVersion[0])%2 != 0) {
|
||||
console.warn('nodeJS does not have an even version number. An odd version number is a developer version. Please correct nodeJS version');
|
||||
}
|
||||
});
|
||||
if (existsObject(config.mrIcon1ScreensaverEntity.ScreensaverEntity) == false && config.mrIcon1ScreensaverEntity.ScreensaverEntity != null) {
|
||||
console.warn('mrIcon1ScreensaverEntity data point in the config not available - please adjust');
|
||||
}
|
||||
if (existsObject(config.mrIcon2ScreensaverEntity.ScreensaverEntity) == false && config.mrIcon2ScreensaverEntity.ScreensaverEntity != null) {
|
||||
console.warn('mrIcon2ScreensaverEntity data point in the config not available - please adjust');
|
||||
}
|
||||
if (CheckEnableSetObject) {
|
||||
console.log('setObjects enabled - create Alias Channels possible');
|
||||
} else {
|
||||
console.warn('setObjects disabled - Please enable setObjects in JS-Adapter Instance - create Alias Channels not possible');
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('error at function CheckConfigParameters: ' + err.message);
|
||||
}
|
||||
}
|
||||
CheckConfigParameters();
|
||||
|
||||
//switch for Screensaver 1 and Screensaver 2
|
||||
async function Init_ScreensaverAdvanced() {
|
||||
try {
|
||||
@@ -1180,6 +1189,7 @@ Init_Dimmode_Trigger();
|
||||
|
||||
async function InitActiveBrightness() {
|
||||
try {
|
||||
if (isSetOptionActive) {
|
||||
if (existsState(NSPanel_Path + 'ScreensaverInfo.activeBrightness') == false ||
|
||||
existsState(NSPanel_Path + 'ScreensaverInfo.activeDimmodeBrightness') == false) {
|
||||
await createStateAsync(NSPanel_Path + 'ScreensaverInfo.activeBrightness', 100, { type: 'number' });
|
||||
@@ -1189,6 +1199,7 @@ async function InitActiveBrightness() {
|
||||
setObject(AliasPath + 'ScreensaverInfo.activeBrightness', {type: 'channel', common: {role: 'slider', name:'activeBrightness'}, native: {}});
|
||||
await createAliasAsync(AliasPath + 'ScreensaverInfo.activeBrightness.ACTUAL', NSPanel_Path + 'ScreensaverInfo.activeBrightness', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ACTUAL' });
|
||||
await createAliasAsync(AliasPath + 'ScreensaverInfo.activeBrightness.SET', NSPanel_Path + 'ScreensaverInfo.activeBrightness', true, <iobJS.StateCommon>{ type: 'number', role: 'level', name: 'SET' });
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('error at function InitActiveBrightness: ' + err.message);
|
||||
}
|
||||
@@ -1264,6 +1275,7 @@ on({id: AliasPath + 'Config.rebootNSPanel.SET', change: "any"}, async function (
|
||||
async function InitUpdateDatapoints() {
|
||||
try {
|
||||
if (existsState(NSPanel_Path + 'Config.Update.UpdateTasmota') == false) {
|
||||
if (isSetOptionActive) {
|
||||
await createStateAsync(NSPanel_Path + 'Config.Update.UpdateTasmota', false, { type: 'boolean' });
|
||||
await createStateAsync(NSPanel_Path + 'Config.Update.UpdateBerry', false, { type: 'boolean' });
|
||||
await createStateAsync(NSPanel_Path + 'Config.Update.UpdateNextion', false, { type: 'boolean' });
|
||||
@@ -1274,6 +1286,7 @@ async function InitUpdateDatapoints() {
|
||||
await createAliasAsync(AliasPath + 'Config.Update.UpdateBerry.SET', NSPanel_Path + 'Config.Update.UpdateBerry', true, <iobJS.StateCommon>{ type: 'boolean', role: 'state', name: 'SET' });
|
||||
await createAliasAsync(AliasPath + 'Config.Update.UpdateNextion.SET', NSPanel_Path + 'Config.Update.UpdateNextion', true, <iobJS.StateCommon>{ type: 'boolean', role: 'state', name: 'SET' });
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('function InitUpdateDatapoints: ' + err.message);
|
||||
}
|
||||
@@ -1306,6 +1319,7 @@ on({id: [].concat(NSPanel_Path + 'Config.Update.UpdateTasmota')
|
||||
//switch Relays 1 + 2 with DP's
|
||||
async function Init_Relays() {
|
||||
try {
|
||||
if (isSetOptionActive) {
|
||||
if (existsState(NSPanel_Path + 'Relay.1') == false ||
|
||||
existsState(NSPanel_Path + 'Relay.2') == false) {
|
||||
await createStateAsync(NSPanel_Path + 'Relay.1', true, { type: 'boolean' });
|
||||
@@ -1318,6 +1332,7 @@ async function Init_Relays() {
|
||||
setObject(AliasPath + 'Relay.2', {type: 'channel', common: {role: 'socket', name:'Relay.2'}, native: {}});
|
||||
await createAliasAsync(AliasPath + 'Relay.2.ACTUAL', NSPanel_Path + 'Relay.2', true, <iobJS.StateCommon>{ type: 'boolean', role: 'switch', name: 'ACTUAL' });
|
||||
await createAliasAsync(AliasPath + 'Relay.2.SET', NSPanel_Path + 'Relay.2', true, <iobJS.StateCommon>{ type: 'boolean', role: 'switch', name: 'SET' });
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('error at function Init_Relays: ' + err.message);
|
||||
}
|
||||
@@ -1327,6 +1342,7 @@ Init_Relays();
|
||||
//Change MRIconsFont small/large
|
||||
async function InitAlternateMRIconsSize() {
|
||||
try {
|
||||
if (isSetOptionActive) {
|
||||
if (existsState(NSPanel_Path + 'Config.MRIcons.alternateMRIconSize.1') == false ||
|
||||
existsState(NSPanel_Path + 'Config.MRIcons.alternateMRIconSize.2') == false) {
|
||||
await createStateAsync(NSPanel_Path + 'Config.MRIcons.alternateMRIconSize.1', false, { type: 'boolean' });
|
||||
@@ -1340,6 +1356,7 @@ async function InitAlternateMRIconsSize() {
|
||||
setObject(AliasPath + 'Config.MRIcons.alternateMRIconSize.2', {type: 'channel', common: {role: 'socket', name:'alternateMRIconSize.2'}, native: {}});
|
||||
await createAliasAsync(AliasPath + 'Config.MRIcons.alternateMRIconSize.2.ACTUAL', NSPanel_Path + 'Config.MRIcons.alternateMRIconSize.2', true, <iobJS.StateCommon>{ type: 'boolean', role: 'switch', name: 'ACTUAL' });
|
||||
await createAliasAsync(AliasPath + 'Config.MRIcons.alternateMRIconSize.2.SET', NSPanel_Path + 'Config.MRIcons.alternateMRIconSize.2', true, <iobJS.StateCommon>{ type: 'boolean', role: 'switch', name: 'SET' });
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('error at function InitAlternateMRIconsSize: ' + err.message);
|
||||
}
|
||||
@@ -1349,6 +1366,7 @@ InitAlternateMRIconsSize();
|
||||
//DateString short/long
|
||||
async function InitDateformat() {
|
||||
try {
|
||||
if (isSetOptionActive) {
|
||||
if (existsState(NSPanel_Path + 'Config.Dateformat.weekday') == false ||
|
||||
existsState(NSPanel_Path + 'Config.Dateformat.month') == false) {
|
||||
await createStateAsync(NSPanel_Path + 'Config.Dateformat.weekday', 'long', { type: 'string' });
|
||||
@@ -1365,6 +1383,7 @@ async function InitDateformat() {
|
||||
await createAliasAsync(AliasPath + 'Config.Dateformat.Switch.month.ACTUAL', NSPanel_Path + 'Config.Dateformat.Switch.month', true, <iobJS.StateCommon>{ type: 'boolean', role: 'switch', name: 'ACTUAL' });
|
||||
await createAliasAsync(AliasPath + 'Config.Dateformat.Switch.month.SET', NSPanel_Path + 'Config.Dateformat.Switch.month', true, <iobJS.StateCommon>{ type: 'boolean', role: 'switch', name: 'SET' });
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('error at function InitDateformat: ' + err.message);
|
||||
}
|
||||
@@ -1441,6 +1460,7 @@ async function CreateWeatherAlias () {
|
||||
if (autoCreateAlias) {
|
||||
if (weatherAdapterInstance == 'daswetter.' + weatherAdapterInstanceNumber + '.') {
|
||||
try {
|
||||
if (isSetOptionActive) {
|
||||
if (!existsState(config.weatherEntity + '.ICON') && existsState('daswetter.' + weatherAdapterInstanceNumber + '.NextHours.Location_1.Day_1.current.symbol_value')) {
|
||||
console.log('Weather alias for daswetter.' + weatherAdapterInstanceNumber + '. does not exist yet, will be created now');
|
||||
setObject(config.weatherEntity, {_id: config.weatherEntity, type: 'channel', common: {role: 'weatherCurrent', name:'media'}, native: {}});
|
||||
@@ -1451,11 +1471,13 @@ async function CreateWeatherAlias () {
|
||||
} else {
|
||||
console.log('weather alias for daswetter.' + weatherAdapterInstanceNumber + '. already exists');
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('error at function CreateWeatherAlias daswetter.' + weatherAdapterInstanceNumber + '. : ' + err.message);
|
||||
}
|
||||
} else if (weatherAdapterInstance == 'accuweather.' + weatherAdapterInstanceNumber + '.') {
|
||||
try {
|
||||
if (isSetOptionActive) {
|
||||
if (!existsState(config.weatherEntity + '.ICON') && existsState('accuweather.' + weatherAdapterInstanceNumber + '.Current.WeatherIcon')) {
|
||||
console.log('Weather alias for accuweather.' + weatherAdapterInstanceNumber + '. does not exist yet, will be created now');
|
||||
setObject(config.weatherEntity, {_id: config.weatherEntity, type: 'channel', common: {role: 'weatherCurrent', name:'media'}, native: {}});
|
||||
@@ -1466,6 +1488,7 @@ async function CreateWeatherAlias () {
|
||||
} else {
|
||||
console.log('weather alias for accuweather.' + weatherAdapterInstanceNumber + '. already exists');
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('error at function CreateWeatherAlias accuweather.' + weatherAdapterInstanceNumber + '.: ' + err.message);
|
||||
}
|
||||
@@ -1539,6 +1562,7 @@ function ScreensaverDimmode(timeDimMode: DimMode) {
|
||||
|
||||
async function InitWeatherForecast() {
|
||||
try {
|
||||
if (isSetOptionActive) {
|
||||
//----Möglichkeit, im Screensaver zwischen Accu-Weather Forecast oder selbstdefinierten Werten zu wählen---------------------------------
|
||||
if (existsState(NSPanel_Path + "ScreensaverInfo.weatherForecast") == false ||
|
||||
existsState(NSPanel_Path + "ScreensaverInfo.weatherForecastTimer") == false ||
|
||||
@@ -1559,6 +1583,7 @@ async function InitWeatherForecast() {
|
||||
setObject(AliasPath + 'ScreensaverInfo.entityChangeTime', {type: 'channel', common: {role: 'slider', name:'entityChangeTime'}, native: {}});
|
||||
await createAliasAsync(AliasPath + 'ScreensaverInfo.entityChangeTime.ACTUAL', NSPanel_Path + 'ScreensaverInfo.entityChangeTime', true, <iobJS.StateCommon>{ type: 'number', role: 'value', name: 'ACTUAL' });
|
||||
await createAliasAsync(AliasPath + 'ScreensaverInfo.entityChangeTime.SET', NSPanel_Path + 'ScreensaverInfo.entityChangeTime', true, <iobJS.StateCommon>{ type: 'number', role: 'level', name: 'SET' });
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('error at function InitWeatherForecast: ' + err.message);
|
||||
}
|
||||
@@ -1567,7 +1592,7 @@ InitWeatherForecast();
|
||||
|
||||
async function InitDimmode() {
|
||||
try {
|
||||
|
||||
if (isSetOptionActive) {
|
||||
// Screensaver nachts auf dunkel ("brightnessNight: z.B. 2") oder aus ("brightnessNight:0")
|
||||
if (!existsState(NSPanel_Path + 'NSPanel_Dimmode_brightnessDay')) {
|
||||
await createStateAsync(NSPanel_Path + 'NSPanel_Dimmode_brightnessDay', <iobJS.StateCommon>{ type: 'number' });
|
||||
@@ -1627,7 +1652,7 @@ async function InitDimmode() {
|
||||
} else {
|
||||
ScreensaverDimmode(timeDimMode);
|
||||
}
|
||||
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('error at function InitDimmode: ' + err.message);
|
||||
}
|
||||
@@ -2030,6 +2055,7 @@ on({ id: NSPanel_Path + 'popupNotify.popupNotifyAction', change: 'any' }, async
|
||||
|
||||
async function get_panel_update_data() {
|
||||
try {
|
||||
if (isSetOptionActive) {
|
||||
await createStateAsync(NSPanel_Path + 'NSPanel_autoUpdate', false, <iobJS.StateCommon>{ read: true, write: true, name: 'Auto-Update', type: 'boolean', def: false });
|
||||
if (autoCreateAlias) {
|
||||
setObject(AliasPath + 'autoUpdate', {type: 'channel', common: {role: 'socket', name:'AutoUpdate'}, native: {}});
|
||||
@@ -2047,6 +2073,7 @@ async function get_panel_update_data() {
|
||||
get_online_berry_driver_version();
|
||||
check_version_tft_firmware();
|
||||
check_online_display_firmware();
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('error at function get_panel_update_data: ' + err.message);
|
||||
}
|
||||
@@ -2079,6 +2106,7 @@ function get_online_tasmota_firmware_version() {
|
||||
}
|
||||
}, async (error, response, result) => {
|
||||
try {
|
||||
if (isSetOptionActive) {
|
||||
const Tasmota_JSON = JSON.parse(result); // JSON Resultat in Variable Schreiben
|
||||
const TasmotaTagName = Tasmota_JSON.tag_name; // JSON nach "tag_name" filtern und in Variable schreiben
|
||||
const TasmotaVersionOnline = TasmotaTagName.replace(/v/i, ''); // Aus Variable überflüssiges "v" filtern und in Release-Variable schreiben
|
||||
@@ -2088,6 +2116,7 @@ function get_online_tasmota_firmware_version() {
|
||||
await createAliasAsync(AliasPath + 'Tasmota_Firmware.onlineVersion.ACTUAL', NSPanel_Path + 'Tasmota_Firmware.onlineVersion', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
|
||||
await setStateAsync(NSPanel_Path + 'Tasmota_Firmware.onlineVersion', <iobJS.State>{ val: TasmotaVersionOnline, ack: true });
|
||||
if (Debug) console.log('online tasmota firmware version => ' + TasmotaVersionOnline);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('error result in function get_online_tasmota_firmware_version: ' + err.message);
|
||||
}
|
||||
@@ -2116,6 +2145,7 @@ function get_current_berry_driver_version() {
|
||||
}
|
||||
}, async (error, response, result) => {
|
||||
try {
|
||||
if (isSetOptionActive) {
|
||||
const BerryDriverVersionCurrent: string = JSON.parse(result).nlui_driver_version;
|
||||
await createStateAsync(NSPanel_Path + 'Berry_Driver.currentVersion', <iobJS.StateCommon>{ type: 'string' });
|
||||
await setStateAsync(NSPanel_Path + 'Berry_Driver.currentVersion', <iobJS.State>{ val: JSON.parse(result).nlui_driver_version, ack: true });
|
||||
@@ -2124,6 +2154,7 @@ function get_current_berry_driver_version() {
|
||||
await createAliasAsync(AliasPath + 'Display.BerryDriver.ACTUAL', NSPanel_Path + 'Berry_Driver.currentVersion', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
|
||||
}
|
||||
if (Debug) console.log('current berry driver version => ' + BerryDriverVersionCurrent);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('error result in function get_current_berry_driver_version: ' + err.message);
|
||||
}
|
||||
@@ -2150,6 +2181,7 @@ function get_tasmota_status0() {
|
||||
'User-Agent': 'ioBroker'
|
||||
}
|
||||
}, async (error, response, result) => {
|
||||
if (isSetOptionActive) {
|
||||
await createStateAsync(NSPanel_Path + 'Tasmota_Firmware.currentVersion', <iobJS.StateCommon>{ type: 'string' });
|
||||
await createStateAsync(NSPanel_Path + 'Tasmota.Uptime', <iobJS.StateCommon>{ type: 'string' });
|
||||
await createStateAsync(NSPanel_Path + 'Tasmota.Version', <iobJS.StateCommon>{ type: 'string' });
|
||||
@@ -2208,6 +2240,7 @@ function get_tasmota_status0() {
|
||||
await createAliasAsync(AliasPath + 'Tasmota.Wifi.Signal.ACTUAL', NSPanel_Path + 'Tasmota.Wifi.Signal', true, <iobJS.StateCommon>{ type: 'number', role: 'state', name: 'ACTUAL' });
|
||||
await createAliasAsync(AliasPath + 'Tasmota.Product.ACTUAL', NSPanel_Path + 'Tasmota.Product', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.warn('error requesting firmware in function get_tasmota_status0: ' + err.message);
|
||||
@@ -2228,12 +2261,14 @@ function get_online_berry_driver_version() {
|
||||
}, async (error, response, result) => {
|
||||
if (result) {
|
||||
try {
|
||||
if (isSetOptionActive) {
|
||||
const BerryDriverVersionOnline = result.substring((result.indexOf('version_of_this_script = ') + 24), result.indexOf('version_of_this_script = ') + 27).replace(/\s+/g, '');
|
||||
await createStateAsync(NSPanel_Path + 'Berry_Driver.onlineVersion', <iobJS.StateCommon>{ type: 'string' });
|
||||
setObject(AliasPath + 'Berry_Driver.onlineVersion', {type: 'channel', common: {role: 'info', name:'onlineVersion'}, native: {}});
|
||||
await createAliasAsync(AliasPath + 'Berry_Driver.onlineVersion.ACTUAL', NSPanel_Path + 'Berry_Driver.onlineVersion', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
|
||||
await setStateAsync(NSPanel_Path + 'Berry_Driver.onlineVersion', <iobJS.State>{ val: BerryDriverVersionOnline, ack: true });
|
||||
if (Debug) console.log('online berry driver version => ' + BerryDriverVersionOnline);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('error result in function get_online_berry_driver_version' + err.message);
|
||||
}
|
||||
@@ -2306,6 +2341,7 @@ function check_online_display_firmware() {
|
||||
on({ id: config.panelRecvTopic }, async (obj) => {
|
||||
if (obj.state.val.startsWith('\{"CustomRecv":')) {
|
||||
try {
|
||||
if (isSetOptionActive) {
|
||||
let json = JSON.parse(obj.state.val);
|
||||
let split = json.CustomRecv.split(',');
|
||||
if (split[0] == 'event' && split[1] == 'startup') {
|
||||
@@ -2322,6 +2358,7 @@ on({ id: config.panelRecvTopic }, async (obj) => {
|
||||
await createAliasAsync(AliasPath + 'Display.Model.ACTUAL', NSPanel_Path + 'NSPanel_Version', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('error at trigger rceiving CustomRecv: ' + err.message);
|
||||
}
|
||||
@@ -4016,7 +4053,7 @@ function subscribeMediaSubscriptions(id: string): void {
|
||||
|
||||
async function createAutoMediaAlias(id: string, mediaDevice: string, adapterPlayerInstance: string) {
|
||||
if (autoCreateAlias) {
|
||||
|
||||
if (isSetOptionActive) {
|
||||
if (adapterPlayerInstance == 'alexa2.0.') {
|
||||
if (existsObject(id) == false){
|
||||
console.log('Alexa Alias ' + id + ' does not exist - will be created now');
|
||||
@@ -4150,7 +4187,7 @@ async function createAutoMediaAlias(id: string, mediaDevice: string, adapterPlay
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4645,6 +4682,7 @@ function GenerateAlarmPage(page: PageAlarm): Payload[] {
|
||||
|
||||
async function createAutoUnlockAlias(id: string, dpPath: string) {
|
||||
if (autoCreateAlias) {
|
||||
if (isSetOptionActive) {
|
||||
if (existsState(dpPath + 'UnlockPin') == false) {
|
||||
createState(dpPath + 'UnlockPin', '0000', { type: 'string' }, function () { setState(dpPath + 'UnlockPin', '0000') });
|
||||
}
|
||||
@@ -4656,6 +4694,7 @@ async function createAutoUnlockAlias(id: string, dpPath: string) {
|
||||
await createAliasAsync(id + '.PIN', dpPath + 'UnlockPin', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'PIN'});
|
||||
await createAliasAsync(id + '.ACTUAL', dpPath + 'Access', true, <iobJS.StateCommon>{ type: 'boolean', role: 'sensor.fire.alarm', name: 'ACTUAL'});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function GenerateUnlockPage(page: PageUnlock): Payload[] {
|
||||
|
||||
Reference in New Issue
Block a user