mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-23 16:04:25 +01:00
v4.3.1.6 - Update NsPanelTs.ts
- Add more Alias Device-Types to Navigation (createEntity) - Minor Fixes
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*-----------------------------------------------------------------------
|
/*-----------------------------------------------------------------------
|
||||||
TypeScript v4.3.1.5 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @Sternmiere / @Britzelpuf / @ravenS0ne
|
TypeScript v4.3.1.6 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @Sternmiere / @Britzelpuf / @ravenS0ne
|
||||||
- abgestimmt auf TFT 53 / v4.3.1 / BerryDriver 9 / Tasmota 13.1.0
|
- abgestimmt auf TFT 53 / v4.3.1 / BerryDriver 9 / Tasmota 13.1.0
|
||||||
@joBr99 Projekt: https://github.com/joBr99/nspanel-lovelace-ui/tree/main/ioBroker
|
@joBr99 Projekt: https://github.com/joBr99/nspanel-lovelace-ui/tree/main/ioBroker
|
||||||
NsPanelTs.ts (dieses TypeScript in ioBroker) Stable: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroker/NsPanelTs.ts
|
NsPanelTs.ts (dieses TypeScript in ioBroker) Stable: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroker/NsPanelTs.ts
|
||||||
@@ -178,6 +178,7 @@ ReleaseNotes:
|
|||||||
- 03.10.2023 - v4.3.1.4 Removing the examples from the NSPanelTs.ts --> https://github.com/joBr99/nspanel-lovelace-ui/wiki/NSPanel-Page-%E2%80%90-Typen_How-2_Beispiele
|
- 03.10.2023 - v4.3.1.4 Removing the examples from the NSPanelTs.ts --> https://github.com/joBr99/nspanel-lovelace-ui/wiki/NSPanel-Page-%E2%80%90-Typen_How-2_Beispiele
|
||||||
- 03.10.2023 - v4.3.1.4 Delete NsPanelTs_without_Examples.ts
|
- 03.10.2023 - v4.3.1.4 Delete NsPanelTs_without_Examples.ts
|
||||||
- 12.10.2023 - v4.3.1.5 Fix Datapoint for Role timetable -> Attention use new script from TT-Tom https://github.com/tt-tom17/MyScripts/blob/main/Sonoff_NSPanel/Fahrplan_to_NSPanel.ts
|
- 12.10.2023 - v4.3.1.5 Fix Datapoint for Role timetable -> Attention use new script from TT-Tom https://github.com/tt-tom17/MyScripts/blob/main/Sonoff_NSPanel/Fahrplan_to_NSPanel.ts
|
||||||
|
- 19.10.2023 - v4.3.1.6 Add more Alias Device-Types to Navigation (createEntity) / Minor Fixes
|
||||||
|
|
||||||
Todo:
|
Todo:
|
||||||
- XX.XX.XXXX - v4.4.0 Change the bottomScreensaverEntity (rolling) if more than 6 entries are defined
|
- XX.XX.XXXX - v4.4.0 Change the bottomScreensaverEntity (rolling) if more than 6 entries are defined
|
||||||
@@ -3005,6 +3006,83 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
|
|||||||
if (val === true || val === 'true') { iconId = iconId2 };
|
if (val === true || val === 'true') { iconId = iconId2 };
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'humidity':
|
||||||
|
|
||||||
|
case 'temperature':
|
||||||
|
|
||||||
|
case 'value.temperature':
|
||||||
|
|
||||||
|
case 'value.humidity':
|
||||||
|
|
||||||
|
case 'sensor.door':
|
||||||
|
|
||||||
|
case 'sensor.window':
|
||||||
|
|
||||||
|
case 'thermostat':
|
||||||
|
type = 'text';
|
||||||
|
|
||||||
|
iconId = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : o.common.role == 'value.temperature' || o.common.role == 'thermostat' ? Icons.GetIcon('thermometer') : Icons.GetIcon('information-outline');
|
||||||
|
|
||||||
|
let unit = '';
|
||||||
|
optVal = '0';
|
||||||
|
|
||||||
|
if (existsState(pageItem.id + '.ON_ACTUAL')) {
|
||||||
|
optVal = getState(pageItem.id + '.ON_ACTUAL').val;
|
||||||
|
unit = pageItem.unit !== undefined ? pageItem.unit : GetUnitOfMeasurement(pageItem.id + '.ON_ACTUAL');
|
||||||
|
} else if (existsState(pageItem.id + '.ACTUAL')) {
|
||||||
|
optVal = getState(pageItem.id + '.ACTUAL').val;
|
||||||
|
unit = pageItem.unit !== undefined ? pageItem.unit : GetUnitOfMeasurement(pageItem.id + '.ACTUAL');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (o.common.role == 'value.temperature') {
|
||||||
|
iconId = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : Icons.GetIcon('thermometer');
|
||||||
|
}
|
||||||
|
|
||||||
|
iconColor = GetIconColor(pageItem, parseInt(optVal), useColors);
|
||||||
|
|
||||||
|
if (pageItem.colorScale != undefined) {
|
||||||
|
let iconvalmin = (pageItem.colorScale.val_min != undefined) ? pageItem.colorScale.val_min : 0 ;
|
||||||
|
let iconvalmax = (pageItem.colorScale.val_max != undefined) ? pageItem.colorScale.val_max : 100 ;
|
||||||
|
let iconvalbest = (pageItem.colorScale.val_best != undefined) ? pageItem.colorScale.val_best : iconvalmin ;
|
||||||
|
let valueScale = val;
|
||||||
|
|
||||||
|
if (iconvalmin == 0 && iconvalmax == 1) {
|
||||||
|
iconColor = (getState(pageItem.id).val == 1) ? rgb_dec565(colorScale0) : rgb_dec565(colorScale10);
|
||||||
|
} else {
|
||||||
|
if (iconvalbest == iconvalmin) {
|
||||||
|
valueScale = scale(valueScale,iconvalmin, iconvalmax, 10, 0);
|
||||||
|
} else {
|
||||||
|
if (valueScale < iconvalbest) {
|
||||||
|
valueScale = scale(valueScale,iconvalmin, iconvalbest, 0, 10);
|
||||||
|
} else if (valueScale > iconvalbest || iconvalbest != iconvalmin) {
|
||||||
|
valueScale = scale(valueScale,iconvalbest, iconvalmax, 10, 0);
|
||||||
|
} else {
|
||||||
|
valueScale = scale(valueScale,iconvalmin, iconvalmax, 10, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let valueScaletemp = (Math.round(valueScale)).toFixed();
|
||||||
|
iconColor = HandleColorScale(valueScaletemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (existsState(pageItem.id + '.USERICON')) {
|
||||||
|
iconId = Icons.GetIcon(getState(pageItem.id + '.USERICON').val);
|
||||||
|
if (Debug) console.log('iconid von ' + pageItem.id + '.USERICON: ' + getState(pageItem.id + '.USERICON').val);
|
||||||
|
RegisterEntityWatcher(pageItem.id + '.USERICON');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pageItem.useValue) {
|
||||||
|
if (pageItem.fontSize != undefined) {
|
||||||
|
iconId = optVal + '¬' + pageItem.fontSize;
|
||||||
|
} else {
|
||||||
|
iconId = optVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Debug) console.log('CreateEntity Icon role info, humidity, temperature, value.temperature, value.humidity, sensor.door, sensor.window, thermostat');
|
||||||
|
if (Debug) console.log('CreateEntity ~' + type + 'navigate.' + pageItem.targetPage + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal + ' ' + unit);
|
||||||
|
return '~' + type + '~' + 'navigate.' + pageItem.targetPage + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal + ' ' + unit;
|
||||||
|
|
||||||
case 'warning':
|
case 'warning':
|
||||||
iconId = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : Icons.GetIcon('gesture-tap-button');
|
iconId = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : Icons.GetIcon('gesture-tap-button');
|
||||||
iconColor = pageItem.onColor !== undefined ? GetIconColor(pageItem, true, useColors) : getState(pageItem.id + '.LEVEL').val;
|
iconColor = pageItem.onColor !== undefined ? GetIconColor(pageItem, true, useColors) : getState(pageItem.id + '.LEVEL').val;
|
||||||
@@ -3461,7 +3539,7 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
|
|||||||
let itemFahrzeug:string = getState(pageItem.id + '.VEHICLE').val;
|
let itemFahrzeug:string = getState(pageItem.id + '.VEHICLE').val;
|
||||||
let itemUhrzeit:string = getState(pageItem.id + '.ACTUAL').val;
|
let itemUhrzeit:string = getState(pageItem.id + '.ACTUAL').val;
|
||||||
let itemRichtung:string = getState(pageItem.id + '.DIRECTION').val;
|
let itemRichtung:string = getState(pageItem.id + '.DIRECTION').val;
|
||||||
let itemVerspätung:boolean = getState(pageItem.id + '.DELAY').val;
|
let itemVerspaetung:boolean = getState(pageItem.id + '.DELAY').val;
|
||||||
|
|
||||||
if (Icons.GetIcon(itemFahrzeug) != "") {
|
if (Icons.GetIcon(itemFahrzeug) != "") {
|
||||||
iconId = Icons.GetIcon(itemFahrzeug)
|
iconId = Icons.GetIcon(itemFahrzeug)
|
||||||
@@ -3469,7 +3547,7 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
|
|||||||
iconId=''
|
iconId=''
|
||||||
};
|
};
|
||||||
|
|
||||||
iconColor = (!itemVerspätung) ? rgb_dec565(colorScale0) : rgb_dec565(colorScale10);
|
iconColor = (!itemVerspaetung) ? rgb_dec565(colorScale0) : rgb_dec565(colorScale10);
|
||||||
|
|
||||||
if (Debug) console.log('CreateEntity Icon role timeTable ~' + type + '~' + itemRichtung + '~' + iconId + '~' + iconColor + '~' + itemRichtung + '~' + itemUhrzeit);
|
if (Debug) console.log('CreateEntity Icon role timeTable ~' + type + '~' + itemRichtung + '~' + iconId + '~' + iconColor + '~' + itemRichtung + '~' + itemUhrzeit);
|
||||||
return '~' + type + '~' + itemRichtung + '~' + iconId + '~' + iconColor + '~' + itemRichtung + '~' + itemUhrzeit;
|
return '~' + type + '~' + itemRichtung + '~' + iconId + '~' + iconColor + '~' + itemRichtung + '~' + itemUhrzeit;
|
||||||
@@ -3478,7 +3556,6 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
|
|||||||
if (Debug) console.log('CreateEntity Icon keine passende Rolle gefunden');
|
if (Debug) console.log('CreateEntity Icon keine passende Rolle gefunden');
|
||||||
return '~delete~~~~~';
|
return '~delete~~~~~';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (Debug) console.log('CreateEntity return ~delete~~~~~');
|
if (Debug) console.log('CreateEntity return ~delete~~~~~');
|
||||||
return '~delete~~~~~';
|
return '~delete~~~~~';
|
||||||
|
|||||||
Reference in New Issue
Block a user