From a60bff301e3e65dfbb166619988e96d0414d1016 Mon Sep 17 00:00:00 2001 From: fre4242 Date: Sun, 23 Apr 2023 11:49:24 +0200 Subject: [PATCH] Fixed error wrong icon index in GeneratePowerPage --- ioBroker/NsPanelTs.ts | 8 ++++---- ioBroker/NsPanelTs_without_Examples.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ioBroker/NsPanelTs.ts b/ioBroker/NsPanelTs.ts index 3a28f00f..2ddab54e 100644 --- a/ioBroker/NsPanelTs.ts +++ b/ioBroker/NsPanelTs.ts @@ -5071,17 +5071,17 @@ function GeneratePowerPage(page: PagePower): Payload[] { let arrayColorScale = [colorScale0, colorScale1, colorScale2, colorScale3, colorScale4, colorScale5, colorScale6, colorScale7, colorScale8, colorScale9, colorScale10]; - let homeIconColor = 0; if (!demoMode) { for (let obji = 1; obji < 7; obji++) { - array_icon_color[obji] = arrayColorScale[obj[obji].iconColor !== '' ? obj[obji].iconColor : 0]; + const color = obj[obji].iconColor !== '' ? obj[obji].iconColor : 0; + array_icon_color[obji] = arrayColorScale[color]; array_icon[obji] = obj[obji].icon; array_powerspeed[obji] = obj[obji].speed; array_powerstate[obji] = obj[obji].value + ' ' + obj[obji].unit ; } array_icon[0] = obj[0].icon; array_powerstate[0] = obj[0].value + ' ' + obj[0].unit; - homeIconColor = obj[0].iconColor; + array_icon_color[0] = arrayColorScale[obj[0].iconColor]; } let power_string : any = ''; @@ -5108,7 +5108,7 @@ function GeneratePowerPage(page: PagePower): Payload[] { '' + '~' + // type (ignored) '' + '~' + // intNameEntity (ignored) Icons.GetIcon(array_icon[0]) + '~' + // icon - rgb_dec565(array_icon_color[homeIconColor]) + '~' + // icon_color + rgb_dec565(array_icon_color[0]) + '~' + // icon_color '' + '~' + // display (ignored in TS) array_powerstate[0] + '~' + // optionalValue '' + '~' + // speed diff --git a/ioBroker/NsPanelTs_without_Examples.ts b/ioBroker/NsPanelTs_without_Examples.ts index 9ac08eed..56a8ce1e 100644 --- a/ioBroker/NsPanelTs_without_Examples.ts +++ b/ioBroker/NsPanelTs_without_Examples.ts @@ -4572,17 +4572,17 @@ function GeneratePowerPage(page: PagePower): Payload[] { let arrayColorScale = [colorScale0, colorScale1, colorScale2, colorScale3, colorScale4, colorScale5, colorScale6, colorScale7, colorScale8, colorScale9, colorScale10]; - let homeIconColor = 0; if (!demoMode) { for (let obji = 1; obji < 7; obji++) { - array_icon_color[obji] = arrayColorScale[obj[obji].iconColor !== '' ? obj[obji].iconColor : 0]; + const color = obj[obji].iconColor !== '' ? obj[obji].iconColor : 0; + array_icon_color[obji] = arrayColorScale[color]; array_icon[obji] = obj[obji].icon; array_powerspeed[obji] = obj[obji].speed; array_powerstate[obji] = obj[obji].value + ' ' + obj[obji].unit ; } array_icon[0] = obj[0].icon; array_powerstate[0] = obj[0].value + ' ' + obj[0].unit; - homeIconColor = obj[0].iconColor; + array_icon_color[0] = arrayColorScale[obj[0].iconColor]; } let power_string : any = ''; @@ -4609,7 +4609,7 @@ function GeneratePowerPage(page: PagePower): Payload[] { '' + '~' + // type (ignored) '' + '~' + // intNameEntity (ignored) Icons.GetIcon(array_icon[0]) + '~' + // icon - rgb_dec565(array_icon_color[homeIconColor]) + '~' + // icon_color + rgb_dec565(array_icon_color[0]) + '~' + // icon_color '' + '~' + // display (ignored in TS) array_powerstate[0] + '~' + // optionalValue '' + '~' + // speed