mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-22 15:34:26 +01:00
v3.8.3 - Update
Add globalTracklist for every Volumio-Player by @egal Upgrade TFT 48 Add cardLChart for Line diagrams Add new monobutton Functions by @ronny130286 Add Repeat-Button and external Tracklists/Queues to Volumio Media-Player by @egal Add configurable navigation buttons by @ravenst0ne (v3.8.1.1) Add Char"€" to HMI
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*-----------------------------------------------------------------------
|
||||
TypeScript v3.8.1.1 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar/@Sternmiere/@Britzelpuf
|
||||
- abgestimmt auf TFT 47 / v3.8.1 / BerryDriver 8 / Tasmota 12.3.1
|
||||
TypeScript v3.8.3 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar/@Sternmiere/@Britzelpuf
|
||||
- abgestimmt auf TFT 48 / v3.8.3 / BerryDriver 8 / Tasmota 12.3.1
|
||||
@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
|
||||
icon_mapping.ts: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroker/icon_mapping.ts (TypeScript muss in global liegen)
|
||||
@@ -110,11 +110,17 @@ ReleaseNotes:
|
||||
- 01.01.2023 - v3.8.0 Add Tasmota "Web Admin Password"
|
||||
- 02.01.2023 - v3.8.0 Add Navigation bSubPrev and bSubNext and Subpages for bHome
|
||||
- 03.01.2023 - v3.8.0 Bugfix for cardThermostat - Payload (Minor)
|
||||
- 04.01.2023 - v3.8.0 Add Volumio-Player to cardMedia
|
||||
- 04.01.2023 - v3.8.0 Add Volumio-Player to cardMedia by @egal
|
||||
- 05.01.2023 - v3.8.0 Upgrade TFT 47
|
||||
- 06.01.2023 - v3.8.0 Add Volumio Tracklist
|
||||
- 06.01.2023 - v3.8.0 Add Volumio Tracklist by @egal
|
||||
- 06.01.2023 - v3.8.1 HMI-Hotfix
|
||||
- 11.01.2023 - v3.8.1.1 Add configurable navigation buttons by @ravenst0ne
|
||||
- 06.01.2023 - v3.8.2 Add globalTracklist for every Volumio-Player by @egal
|
||||
- 07.01.2023 - v3.8.3 Upgrade TFT 48
|
||||
- 08.01.2023 - v3.8.3 Add cardLChart for Line diagrams
|
||||
- 09.01.2023 - v3.8.3 Add new monobutton Functions by @ronny130286
|
||||
- 10.01.2023 - v3.8.3 Add Repeat-Button and external Tracklists/Queues to Volumio Media-Player by @egal
|
||||
- 11.01.2023 - v3.8.3 Add configurable navigation buttons by @ravenst0ne (v3.8.1.1)
|
||||
- 11.01.2023 - v3.8.3 Add Char"€" to HMI
|
||||
|
||||
*****************************************************************************************************************
|
||||
* Falls Aliase durch das Skript erstellt werden sollen, muss in der JavaScript Instanz "setObect" gesetzt sein! *
|
||||
@@ -188,7 +194,7 @@ Erforderliche Adapter:
|
||||
|
||||
Upgrades in Konsole:
|
||||
Tasmota BerryDriver : Backlog UpdateDriverVersion https://raw.githubusercontent.com/joBr99/nspanel-lovelace-ui/main/tasmota/autoexec.be; Restart 1
|
||||
TFT EU STABLE Version : FlashNextion http://nspanel.pky.eu/lovelace-ui/github/nspanel-v3.8.1.tft
|
||||
TFT EU STABLE Version : FlashNextion http://nspanel.pky.eu/lovelace-ui/github/nspanel-v3.8.3.tft
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
let Icons = new IconsSelector();
|
||||
@@ -300,7 +306,6 @@ let Test_Licht1 = <PageEntities>
|
||||
'type': 'cardEntities',
|
||||
'heading': 'Color Aliase 1',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.TestRGBLichteinzeln', name: 'RGB-Licht Hex-Color', interpolateColor: true},
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.TestRGBLicht', name: 'RGB-Licht', minValueBrightness: 0, maxValueBrightness: 100, interpolateColor: true},
|
||||
@@ -309,13 +314,10 @@ let Test_Licht1 = <PageEntities>
|
||||
]
|
||||
};
|
||||
|
||||
//Only DEV --> Test
|
||||
let CardChartExample = <PageChart>
|
||||
{
|
||||
'type': 'cardChart',
|
||||
'heading': 'Stromzähler L1+L2+L3',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [<PageItem>{
|
||||
id: 'alias.0.NSPanel_1.cardChart',
|
||||
yAxis: 'Leistung [kW]',
|
||||
@@ -324,11 +326,23 @@ let CardChartExample = <PageChart>
|
||||
}]
|
||||
};
|
||||
|
||||
//Only DEV --> Test
|
||||
let CardLChartExample = <PageChart>
|
||||
{
|
||||
"type": "cardLChart",
|
||||
"heading": "Büro Temperatur",
|
||||
'items': [<PageItem>{
|
||||
id: 'alias.0.Haus.Erdgeschoss.Buero.Charts.Temperatur',
|
||||
yAxis: 'Temperatur [°C]',
|
||||
yAxisTicks: [160,170,180,190,200,210,220,230],
|
||||
onColor: Yellow
|
||||
}]
|
||||
};
|
||||
|
||||
let CardPowerExample = <PagePower>
|
||||
{
|
||||
'type': 'cardPower',
|
||||
'heading': 'cardPower Emulator',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.Power.PowerCard' },
|
||||
@@ -354,7 +368,6 @@ let Test_Funktionen = <PageEntities>
|
||||
'type': 'cardEntities',
|
||||
'heading': 'Sonstige Aliase',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.TestLautstärke', offColor: MSRed, onColor: MSGreen, name: 'Echo Spot Büro', minValue: 0, maxValue: 100 },
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.TestTemperatur',name: 'Temperatur außen', icon: 'thermometer', onColor: White },
|
||||
@@ -369,7 +382,6 @@ let Buero_Seite_1 = <PageEntities>
|
||||
'type': 'cardEntities',
|
||||
'heading': 'Büro',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.Schreibtischlampe', interpolateColor: true},
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.Deckenbeleuchtung', interpolateColor: true},
|
||||
@@ -383,7 +395,6 @@ let Fenster_1 = <PageEntities>
|
||||
'type': 'cardEntities',
|
||||
'heading': 'Fenster und Türen',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.TestFenster', offColor: MSRed, onColor: MSGreen, name: 'Büro Fenster'},
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.Haustuer', offColor: MSRed, onColor: MSGreen, name: 'Haustür'},
|
||||
@@ -391,13 +402,12 @@ let Fenster_1 = <PageEntities>
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.TestDoorlock', offColor: MSRed, onColor: MSGreen, name: 'Türschloss'},
|
||||
]
|
||||
};
|
||||
//<PageItem>{ id: "alias.0.NS-Panel.Buero.Rollade", icon: "blinds-horizontal", offColor: White, onColor: Yellow, name: "Büro", secondRow: "Hier Text für 2. Zeile"},
|
||||
|
||||
let Button_1 = <PageEntities>
|
||||
{
|
||||
'type': 'cardEntities',
|
||||
'heading': 'Button Aliase',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.TestTastensensor', name: 'Tastensensor (FFN)'},
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.Radio.NDR2', icon: 'radio', name: 'Taste (NDR2)', onColor: colorRadio},
|
||||
@@ -411,7 +421,6 @@ let Subpages_1 = <PageEntities>
|
||||
'type': 'cardEntities',
|
||||
'heading': 'Test Subpages',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [
|
||||
<PageItem>{ navigate: true, id: null, targetPage: 'Abfall', onColor: White, name: "Abfallkalender"},
|
||||
<PageItem>{ navigate: true, id: 'alias.0.NSPanel_1.TestBlind', targetPage: 'WLAN', name: 'Gäste WLAN', onColor: MSGreen, offColor: MSRed },
|
||||
@@ -439,7 +448,6 @@ let Subpages_1 = <PageEntities>
|
||||
{
|
||||
'type': 'cardQR',
|
||||
'heading': 'Gäste WLAN',
|
||||
'useColor': true,
|
||||
'subPage': true,
|
||||
'parent': Subpages_1,
|
||||
'items': [<PageItem>{ id: 'alias.0.NSPanel_1.Guest_Wifi', hidePassword: true }]
|
||||
@@ -450,7 +458,6 @@ let Buero_Seite_2 = <PageGrid>
|
||||
'type': 'cardGrid',
|
||||
'heading': 'Büro 2',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.Schreibtischlampe', name: 'Schreibtisch'},
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.Deckenbeleuchtung', name: 'Deckenlampe'},
|
||||
@@ -466,7 +473,6 @@ let Radiosender = <PageGrid>
|
||||
'type': 'cardGrid',
|
||||
'heading': 'Büro 2',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.Radio.Bob', icon: 'radio', name: 'Radio BOB', onColor: colorRadio},
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.Countdown', icon: 'timer-outline', name: 'Timer', onColor: White}
|
||||
@@ -478,7 +484,6 @@ let WLED = <PageGrid>
|
||||
'type': 'cardGrid',
|
||||
'heading': 'WLED Stripes WZ',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.WLED.Example.On', name: 'Power', icon: 'power', onColor: HMIOn, offColor: HMIOff},
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.WLED.Example.Sync', name: 'Sync', icon: 'sync', onColor: HMIOn, offColor: White},
|
||||
@@ -502,7 +507,6 @@ let SensorGrid = <PageGrid>
|
||||
'type': 'cardGrid',
|
||||
'heading': 'Sensor Werte',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.TestTemperatur', name: 'Außentemp. °C', offColor: MSRed, onColor: MSGreen, useValue: true },
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.TestFeuchtigkeit', name: 'Luftfeuchte %', offColor: MSYellow, onColor: MSYellow , useValue: true },
|
||||
@@ -519,8 +523,6 @@ let Alexa = <PageMedia>
|
||||
{
|
||||
'type': 'cardMedia',
|
||||
'heading': 'Alexa',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [<PageItem>{
|
||||
id: AliasPath + 'Media.PlayerAlexa',
|
||||
adapterPlayerInstance: 'alexa2.0.',
|
||||
@@ -550,8 +552,6 @@ let Sonos = <PageMedia>
|
||||
{
|
||||
'type': 'cardMedia',
|
||||
'heading': 'Sonos',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [<PageItem>{
|
||||
id: AliasPath + 'Media.PlayerSonos',
|
||||
adapterPlayerInstance: 'sonos.0.',
|
||||
@@ -568,8 +568,6 @@ let SpotifyPremium = <PageMedia>
|
||||
{
|
||||
"type": "cardMedia",
|
||||
"heading": "Spotify-Premium",
|
||||
"useColor": true,
|
||||
"subPage": false,
|
||||
"items": [<PageItem>{
|
||||
id: AliasPath + 'Media.PlayerSpotifyPremium',
|
||||
adapterPlayerInstance: "spotify-premium.0.",
|
||||
@@ -590,8 +588,6 @@ let SqueezeboxRPC = <PageMedia>
|
||||
{
|
||||
'type': 'cardMedia',
|
||||
'heading': 'SqueezeboxRPC',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [<PageItem>{
|
||||
id: 'alias.0.Media.LMS.SqueezePlay',
|
||||
adapterPlayerInstance: 'squeezeboxrpc.0.Players.SqueezePlay.',
|
||||
@@ -603,8 +599,6 @@ let Buero_Themostat = <PageThermo>
|
||||
{
|
||||
'type': 'cardThermo',
|
||||
'heading': 'Test Thermostat',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [<PageItem>{ id: 'alias.0.NSPanel_1.Thermostat_Buero', minValue: 50, maxValue: 300 }]
|
||||
};
|
||||
|
||||
@@ -612,8 +606,6 @@ let Buero_Klimaanlage = <PageThermo>
|
||||
{
|
||||
'type': 'cardThermo',
|
||||
'heading': 'Test Klimaanlage',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [<PageItem>{
|
||||
id: 'alias.0.NSPanel_1.TestKlimaanlage',
|
||||
minValue: 50,
|
||||
@@ -632,8 +624,6 @@ let Buero_Alarm = <PageAlarm >
|
||||
{
|
||||
'type': 'cardAlarm',
|
||||
'heading': 'Alarm',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [<PageItem>{ id: 'alias.0.Alarm' }]
|
||||
};
|
||||
|
||||
@@ -642,7 +632,6 @@ let button1Page = <PageGrid>
|
||||
'type': 'cardGrid',
|
||||
'heading': 'Radio',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.Radio.FFN', icon: 'radio', name: 'FFN', onColor: colorRadio},
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.Radio.Antenne' , icon: 'radio', name: 'Antenne Nds.', onColor: colorRadio},
|
||||
@@ -658,7 +647,6 @@ let button2Page = <PageEntities>
|
||||
'type': 'cardEntities',
|
||||
'heading': 'Büro',
|
||||
'useColor': true,
|
||||
'subPage': false,
|
||||
'items': [
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.Schreibtischlampe'},
|
||||
<PageItem>{ id: 'alias.0.NSPanel_1.Deckenbeleuchtung'}
|
||||
@@ -1351,7 +1339,7 @@ function get_locales() {
|
||||
|
||||
async function check_updates() {
|
||||
try {
|
||||
const desired_display_firmware_version = 47;
|
||||
const desired_display_firmware_version = 48;
|
||||
const berry_driver_version = 8;
|
||||
|
||||
if (Debug) {
|
||||
@@ -1819,8 +1807,17 @@ function update_berry_driver_version() {
|
||||
}
|
||||
|
||||
function update_tft_firmware() {
|
||||
const tft_version: string = 'v3.8.1';
|
||||
const desired_display_firmware_url = `http://nspanel.pky.eu/lovelace-ui/github/nspanel-${tft_version}.tft`;
|
||||
const tft_version: string = 'v3.8.3';
|
||||
let desired_display_firmware_url =""
|
||||
|
||||
if(getState(NSPanel_Path + '.NSPanel_Version').val =="us-l"){
|
||||
desired_display_firmware_url = `http://nspanel.pky.eu/lovelace-ui/github/nspanel-us-l-${tft_version}.tft`;
|
||||
}else if (getState(NSPanel_Path + '.NSPanel_Version').val =="us-p"){
|
||||
desired_display_firmware_url = `http://nspanel.pky.eu/lovelace-ui/github/nspanel-us-p-${tft_version}.tft`;
|
||||
}else{
|
||||
desired_display_firmware_url = `http://nspanel.pky.eu/lovelace-ui/github/nspanel-${tft_version}.tft`;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
let urlString = `http://${get_current_tasmota_ip_address()}/cm?cmnd=FlashNextion ${desired_display_firmware_url}`;
|
||||
@@ -2034,6 +2031,9 @@ function GeneratePage(page: Page): void {
|
||||
case 'cardChart':
|
||||
SendToPanel(GenerateChartPage(<PageChart>page));
|
||||
break;
|
||||
case 'cardLChart':
|
||||
SendToPanel(GenerateChartPage(<PageChart>page));
|
||||
break;
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('function GeneratePage: ' + err.message);
|
||||
@@ -2191,13 +2191,20 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
val = getState(pageItem.id + '.GET').val;
|
||||
RegisterEntityWatcher(pageItem.id + '.GET');
|
||||
}
|
||||
if (existsState(pageItem.id + '.SET')) {
|
||||
val = getState(pageItem.id + '.SET').val;
|
||||
RegisterEntityWatcher(pageItem.id + '.SET');
|
||||
}
|
||||
if (existsState(pageItem.id + '.ACTUAL')) {
|
||||
val = getState(pageItem.id + '.ACTUAL').val;
|
||||
RegisterEntityWatcher(pageItem.id + '.ACTUAL');
|
||||
if(pageItem.monobutton != undefined && pageItem.monobutton == true){
|
||||
if (existsState(pageItem.id + '.ACTUAL')) {
|
||||
val = getState(pageItem.id + '.ACTUAL').val;
|
||||
RegisterEntityWatcher(pageItem.id + '.ACTUAL');
|
||||
}
|
||||
} else {
|
||||
if (existsState(pageItem.id + '.ACTUAL')) {
|
||||
val = getState(pageItem.id + '.ACTUAL').val;
|
||||
RegisterEntityWatcher(pageItem.id + '.ACTUAL');
|
||||
}
|
||||
if (existsState(pageItem.id + '.SET')) {
|
||||
val = getState(pageItem.id + '.SET').val;
|
||||
RegisterEntityWatcher(pageItem.id + '.SET');
|
||||
}
|
||||
}
|
||||
if (existsState(pageItem.id + '.ON_ACTUAL')) {
|
||||
val = getState(pageItem.id + '.ON_ACTUAL').val;
|
||||
@@ -2319,9 +2326,16 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (val === true || val === 'true') {
|
||||
optVal = '1';
|
||||
iconColor = GetIconColor(pageItem, existsState(pageItem.id + '.DIMMER') ? 100 - getState(pageItem.id + '.DIMMER').val : true, useColors);
|
||||
} else {
|
||||
iconColor = GetIconColor(pageItem, false, useColors);
|
||||
if (pageItem.icon !== undefined) {
|
||||
if (pageItem.icon2 !== undefined) {
|
||||
iconId = iconId2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pageItem.interpolateColor != undefined && pageItem.interpolateColor == true) {
|
||||
if (pageItem.interpolateColor != undefined && pageItem.interpolateColor == true && val) {
|
||||
if (existsState(pageItem.id + '.HUE')) {
|
||||
if (getState(pageItem.id + '.HUE').val != null) {
|
||||
let huecolor = hsv2rgb(getState(pageItem.id + '.HUE').val, 1, 1);
|
||||
@@ -2341,8 +2355,16 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (val === true || val === 'true') {
|
||||
optVal = '1';
|
||||
iconColor = GetIconColor(pageItem, existsState(pageItem.id + '.DIMMER') ? 100 - getState(pageItem.id + '.DIMMER').val : true, useColors);
|
||||
} else {
|
||||
iconColor = GetIconColor(pageItem, false, useColors);
|
||||
if (pageItem.icon !== undefined) {
|
||||
if (pageItem.icon2 !== undefined) {
|
||||
iconId = iconId2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
|
||||
|
||||
case 'rgb':
|
||||
@@ -2353,9 +2375,16 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (val === true || val === 'true') {
|
||||
optVal = '1';
|
||||
iconColor = GetIconColor(pageItem, existsState(pageItem.id + '.DIMMER') ? 100 - getState(pageItem.id + '.DIMMER').val : true, useColors);
|
||||
} else {
|
||||
iconColor = GetIconColor(pageItem, false, useColors);
|
||||
if (pageItem.icon !== undefined) {
|
||||
if (pageItem.icon2 !== undefined) {
|
||||
iconId = iconId2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (existsState(pageItem.id + '.RED') && existsState(pageItem.id + '.GREEN') && existsState(pageItem.id + '.BLUE')) {
|
||||
if (existsState(pageItem.id + '.RED') && existsState(pageItem.id + '.GREEN') && existsState(pageItem.id + '.BLUE') && val) {
|
||||
if (getState(pageItem.id + '.RED').val != null && getState(pageItem.id + '.GREEN').val != null && getState(pageItem.id + '.BLUE').val != null) {
|
||||
let rgbRed = getState(pageItem.id + '.RED').val;
|
||||
let rgbGreen = getState(pageItem.id + '.GREEN').val;
|
||||
@@ -2376,9 +2405,16 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (val === true || val === 'true') {
|
||||
optVal = '1'
|
||||
iconColor = GetIconColor(pageItem, existsState(pageItem.id + '.DIMMER') ? 100 - getState(pageItem.id + '.DIMMER').val : true, useColors);
|
||||
} else {
|
||||
iconColor = GetIconColor(pageItem, false, useColors);
|
||||
if (pageItem.icon !== undefined) {
|
||||
if (pageItem.icon2 !== undefined) {
|
||||
iconId = iconId2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (existsState(pageItem.id + '.RGB')) {
|
||||
if (existsState(pageItem.id + '.RGB') && val) {
|
||||
if (getState(pageItem.id + '.RGB').val != null) {
|
||||
let hex = getState(pageItem.id + '.RGB').val;
|
||||
let hexRed = parseInt(hex[1] + hex[2], 16);
|
||||
@@ -2399,6 +2435,13 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
if (val === true || val === 'true') {
|
||||
optVal = '1';
|
||||
iconColor = GetIconColor(pageItem, existsState(pageItem.id + '.ACTUAL') ? 100 - getState(pageItem.id + '.ACTUAL').val : true, useColors);
|
||||
} else {
|
||||
iconColor = GetIconColor(pageItem, false, useColors);
|
||||
if (pageItem.icon !== undefined) {
|
||||
if (pageItem.icon2 !== undefined) {
|
||||
iconId = iconId2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
|
||||
@@ -2616,11 +2659,14 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
|
||||
default:
|
||||
return '~delete~~~~~';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return '~delete~~~~~';
|
||||
} catch (err) {
|
||||
console.warn('function CreateEntity: ' + err.message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function findLocale(controlsObject: string, controlsState: string): string {
|
||||
@@ -3398,9 +3444,26 @@ function GenerateMediaPage(page: PageMedia): Payload[] {
|
||||
'media1~'
|
||||
}
|
||||
|
||||
//InSel Playlist
|
||||
//InSel Tracklist
|
||||
let trackListString: string = '~~~~~~'
|
||||
let trackListIconCol = rgb_dec565(HMIOff);
|
||||
if (v2Adapter == 'volumio') { /* Volumio: get queue */
|
||||
setTimeout(async function () {
|
||||
request({ url: `${getState(vInstance+'info.host').val}/api/getQueue`, headers: {'User-Agent': 'ioBroker'} },
|
||||
async (error, response, result) => {
|
||||
try {
|
||||
const QUEUELIST = JSON.parse(result);
|
||||
page.items[0].globalTracklist = QUEUELIST.queue;
|
||||
if (Debug) { for (let i_index in QUEUELIST.queue) console.log(QUEUELIST.queue[i_index]); }
|
||||
} catch (err) {
|
||||
console.log('get_volumio-queue: ' + err.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
}, 2000);
|
||||
globalTracklist = page.items[0].globalTracklist;
|
||||
}
|
||||
|
||||
if (globalTracklist!= null && globalTracklist.length != 0) {
|
||||
trackListIconCol = rgb_dec565(HMIOn);
|
||||
trackListString = 'input_sel' + '~' +
|
||||
@@ -3458,10 +3521,14 @@ function GenerateMediaPage(page: PageMedia): Payload[] {
|
||||
repeatIcon = Icons.GetIcon('repeat-once');
|
||||
repeatIconCol = rgb_dec565(HMIOn);
|
||||
}
|
||||
} else if (v2Adapter == 'volumio') { /* Volumio: only Repeat true/false with API */
|
||||
if (getState(id + '.REPEAT').val == true) {
|
||||
repeatIcon = Icons.GetIcon('repeat-variant');
|
||||
repeatIconCol = rgb_dec565(colMediaIcon);
|
||||
}
|
||||
}
|
||||
/* Volumio todo: 2 boolean 'Repeat' + 'RepeatSingle' */
|
||||
|
||||
if (v2Adapter == 'spotify-premium' || v2Adapter == 'alexa2' || v2Adapter == 'sonos') {
|
||||
if (v2Adapter == 'spotify-premium' || v2Adapter == 'alexa2' || v2Adapter == 'sonos' || v2Adapter == 'volumio') {
|
||||
repeatButtonString = 'button' + '~' +
|
||||
id + '?repeat' + '~' +
|
||||
repeatIcon + '~' +
|
||||
@@ -3795,12 +3862,11 @@ function GenerateChartPage(page: PageChart): Payload[] {
|
||||
|
||||
let id = page.items[0].id
|
||||
let out_msgs: Array<Payload> = [];
|
||||
out_msgs.push({ payload: 'pageType~cardChart' });
|
||||
out_msgs.push({ payload: 'pageType~' + page.type });
|
||||
|
||||
let heading = page.heading !== undefined ? page.heading : "Chart..."
|
||||
|
||||
let txt = getState(id + '.ACTUAL').val
|
||||
//entityUpd~Chart Demo~1|1~6666~Gas [kWh]~20:40:60:80:100~10~7^2:00~7~6^4:00~6~7^6:00~0~7^8:00~5~1^10:00~1~10^12:00~5~6^14:00~8
|
||||
|
||||
out_msgs.push({
|
||||
payload: 'entityUpd~' + //entityUpd
|
||||
@@ -3812,6 +3878,8 @@ function GenerateChartPage(page: PageChart): Payload[] {
|
||||
txt
|
||||
});
|
||||
|
||||
//console.log(out_msgs);
|
||||
|
||||
return out_msgs
|
||||
|
||||
} catch (err) {
|
||||
@@ -3853,6 +3921,22 @@ function toggleState(id: string): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
// Änderung für Monobutton
|
||||
function triggerButton(id: string): boolean{
|
||||
try {
|
||||
let obj = getObject(id);
|
||||
if (existsState(id) && obj.common.type !== undefined && obj.common.type === "boolean") {
|
||||
setState(id, true);
|
||||
setTimeout(function() { setState(id, false) }, 250)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (err) {
|
||||
console.warn('function triggerButton: ' + err.message);
|
||||
}
|
||||
}
|
||||
// Änderung für Monobutton
|
||||
|
||||
function HandleButtonEvent(words): void {
|
||||
try {
|
||||
let tempid = words[2].split('?');
|
||||
@@ -3993,8 +4077,18 @@ function HandleButtonEvent(words): void {
|
||||
case 'level.mode.fan':
|
||||
case 'socket':
|
||||
case 'light':
|
||||
setIfExists(id + '.SET', action);
|
||||
break;
|
||||
|
||||
let pageItem = findPageItem(id);
|
||||
if(pageItem.monobutton != undefined && pageItem.monobutton == true){
|
||||
triggerButton(id + ".SET")
|
||||
}
|
||||
else {
|
||||
setIfExists(id + '.SET', action);
|
||||
}
|
||||
break;
|
||||
|
||||
//setIfExists(id + '.SET', action);
|
||||
//break;
|
||||
case 'dimmer':
|
||||
setIfExists(id + '.ON_SET', action) ? true : setIfExists(id + '.ON_ACTUAL', action);
|
||||
break;
|
||||
@@ -4026,8 +4120,20 @@ function HandleButtonEvent(words): void {
|
||||
break;
|
||||
case 'socket':
|
||||
case 'light':
|
||||
toggleState(id + '.SET') ? true : toggleState(id + '.ON_SET');
|
||||
break;
|
||||
// Änderung für Monobutton
|
||||
let pageItem = findPageItem(id);
|
||||
if(pageItem.monobutton != undefined && pageItem.monobutton == true){
|
||||
triggerButton(id + ".SET")
|
||||
}
|
||||
else {
|
||||
toggleState(id + ".SET") ? true : toggleState(id + ".ON_SET")
|
||||
}
|
||||
break;
|
||||
// Änderung für // Änderung für Monobutton
|
||||
|
||||
//toggleState(id + '.SET') ? true : toggleState(id + '.ON_SET');
|
||||
//break;
|
||||
|
||||
case 'dimmer':
|
||||
toggleState(id + '.ON_SET') ? true : toggleState(id + '.ON_ACTUAL');
|
||||
break;
|
||||
@@ -4067,8 +4173,11 @@ function HandleButtonEvent(words): void {
|
||||
console.log('Repeat kann nicht verändert werden');
|
||||
}
|
||||
break;
|
||||
case 'volumio':
|
||||
request({ url:`${getState(adapterInstanceRepeat+'info.host').val}/api/commands/?cmd=repeat`, headers: {'User-Agent': 'ioBroker'} },
|
||||
async (error, response, result)=>{}); /* nothing todo @ error */
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4278,19 +4387,7 @@ function HandleButtonEvent(words): void {
|
||||
let strDevicePL = pageItemPL.playList[words[4]];
|
||||
request({ url:`${getState(adapterInstancePL+'info.host').val}/api/commands/?cmd=playplaylist&name=${strDevicePL}`, headers: {'User-Agent': 'ioBroker'} },
|
||||
async (error, response, result)=>{}); /* nothing todo @ error */
|
||||
setTimeout(async function () {
|
||||
request({ url: `${getState(adapterInstancePL+'info.host').val}/api/getQueue`, headers: {'User-Agent': 'ioBroker'} },
|
||||
async (error, response, result) => {
|
||||
try {
|
||||
const QUEUELIST = JSON.parse(result);
|
||||
globalTracklist = QUEUELIST.queue;
|
||||
if (Debug) { for (let i_index in QUEUELIST.queue) console.log(QUEUELIST.queue[i_index]); }
|
||||
} catch (err) {
|
||||
console.log('get_volumio-queue: ' + err.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
}, 2000);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -4326,6 +4423,7 @@ function HandleButtonEvent(words): void {
|
||||
break;
|
||||
case 'alexa2':
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
case 'mode-equalizer':
|
||||
@@ -4629,8 +4727,16 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
|
||||
val = getState(id + '.GET').val;
|
||||
RegisterDetailEntityWatcher(id + '.GET', pageItem, type);
|
||||
} else if (existsState(id + '.SET')) {
|
||||
val = getState(id + '.SET').val;
|
||||
RegisterDetailEntityWatcher(id + '.SET', pageItem, type);
|
||||
if(pageItem.monobutton != undefined && pageItem.monobutton == true){
|
||||
val = getState(id + ".STATE").val;
|
||||
RegisterDetailEntityWatcher(id + ".STATE", pageItem, type);
|
||||
}
|
||||
else {
|
||||
val = getState(id + '.SET').val;
|
||||
RegisterDetailEntityWatcher(id + '.SET', pageItem, type);
|
||||
}
|
||||
//val = getState(id + '.SET').val;
|
||||
//RegisterDetailEntityWatcher(id + '.SET', pageItem, type);
|
||||
}
|
||||
|
||||
icon = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : o.common.role == 'socket' ? Icons.GetIcon('power-socket-de') : Icons.GetIcon('lightbulb');
|
||||
@@ -5251,10 +5357,10 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
|
||||
/* Volumio: works for files */
|
||||
if (vAdapter == 'volumio') {
|
||||
actualState = getState(pageItem.id + '.TITLE').val;
|
||||
globalTracklist = pageItem.globalTracklist;
|
||||
} else {
|
||||
actualState = getState(pageItem.adapterPlayerInstance + 'player.trackName').val;
|
||||
}
|
||||
actualState = getState(pageItem.adapterPlayerInstance + 'player.trackName').val;
|
||||
actualState = (actualState.replace('?','')).split(' -');
|
||||
actualState = actualState[0].split(" (");
|
||||
actualState = formatInSelText(actualState[0]);
|
||||
@@ -6209,7 +6315,7 @@ on({ id: config.panelRecvTopic.substring(0, config.panelRecvTopic.length - 'RESU
|
||||
|
||||
await setStateAsync(NSPanel_Path + 'Sensor.Time', <iobJS.State>{ val: Tasmota_Sensor.Time, ack: true });
|
||||
await setStateAsync(NSPanel_Path + 'Sensor.TempUnit', <iobJS.State>{ val: '°' + Tasmota_Sensor.TempUnit, ack: true });
|
||||
await setStateAsync(NSPanel_Path + 'Sensor.ANALOG.Temperature', <iobJS.State>{ val: parseFloat(Tasmota_Sensor.ANALOG.Temperature1), ack: true });
|
||||
//await setStateAsync(NSPanel_Path + 'Sensor.ANALOG.Temperature', <iobJS.State>{ val: parseFloat(Tasmota_Sensor.ANALOG.Temperature1), ack: true });
|
||||
await setStateAsync(NSPanel_Path + 'Sensor.ESP32.Temperature', <iobJS.State>{ val: parseFloat(Tasmota_Sensor.ESP32.Temperature), ack: true });
|
||||
|
||||
if (autoCreateAlias) {
|
||||
@@ -6402,8 +6508,8 @@ type Page = {
|
||||
type: string,
|
||||
heading: string,
|
||||
items: PageItem[],
|
||||
useColor: boolean,
|
||||
subPage: (boolean | undefined),
|
||||
useColor: (boolean | false),
|
||||
subPage: (boolean | false),
|
||||
parent: (Page | undefined),
|
||||
parentIcon: (string | undefined),
|
||||
prev: (string | undefined),
|
||||
@@ -6450,7 +6556,7 @@ interface PagePower extends Page {
|
||||
}
|
||||
|
||||
interface PageChart extends Page {
|
||||
type: 'cardChart',
|
||||
type: 'cardChart' | 'cardLChart',
|
||||
items: PageItem[],
|
||||
}
|
||||
|
||||
@@ -6496,9 +6602,11 @@ type PageItem = {
|
||||
setThermoDestTemp2: (string | undefined),
|
||||
yAxis: (string | undefined),
|
||||
yAxisTicks: (number[] | undefined),
|
||||
xAxisDecorationId: (string | undefined),
|
||||
popupType: (string | undefined),
|
||||
popupOptions: (string[] | undefined),
|
||||
useValue: (boolean | undefined)
|
||||
useValue: (boolean | undefined),
|
||||
monobutton: (boolean | undefined)
|
||||
}
|
||||
|
||||
type DimMode = {
|
||||
@@ -6529,7 +6637,7 @@ type Config = {
|
||||
defaultOnColor: RGB,
|
||||
defaultOffColor: RGB,
|
||||
defaultBackgroundColor: RGB,
|
||||
pages: (PageThermo | PageMedia | PageAlarm | PageQR | PageEntities | PageGrid | PagePower | PageChart)[],
|
||||
pages: (PageThermo | PageMedia | PageAlarm | PageQR | PageEntities | PageGrid | PagePower | PageChart )[],
|
||||
subPages: (PageThermo | PageMedia | PageAlarm | PageQR | PageEntities | PageGrid | PagePower | PageChart)[],
|
||||
button1Page: (PageThermo | PageMedia | PageAlarm | PageQR | PageEntities | PageGrid | PagePower | PageChart | null),
|
||||
button2Page: (PageThermo | PageMedia | PageAlarm | PageQR | PageEntities | PageGrid | PagePower | PageChart | null)
|
||||
|
||||
Reference in New Issue
Block a user