Compare commits

..

24 Commits

Author SHA1 Message Date
dependabot[bot]
bc5a27f252 Merge 98926a3de1 into b1b679701e 2023-12-31 23:14:20 -07:00
Armilar
b1b679701e Merge pull request #1110 from joBr99/Armilar-patch-4
v4.3.3.28 - Update NsPanelTs.ts
2023-12-31 11:43:28 +01:00
Armilar
c489f07c0a v4.3.3.28 - Update NsPanelTs.ts
- Fix short ID's in v4.3.3.27
- Fix window Icons in CreateEntity 
- Add MQTT-Client Check
2023-12-31 11:33:40 +01:00
Armilar
14bc7dedec v4.3.3.28 - Update NsPanelTs.ts
- Fix short ID's in v4.3.3.27
- Fix window Icons in CreateEntity 
- Add MQTT-Client Check
2023-12-30 14:15:54 +01:00
Armilar
d4067c5ddb v4.3.3.28 - Update NsPanelTs.ts
- Fix short ID's in v4.3.3.27
- Fix window Icons in CreateEntity 
- Add MQTT-Client Check
2023-12-30 11:56:31 +01:00
Armilar
50209418d7 v4.3.3.28 - Update NsPanelTs.ts
- short ID's
- Fix windows open/close in createEntity
2023-12-30 11:23:09 +01:00
Armilar
8f3c74165d v4.3.3.26 - Downgrade NsPanelTs.ts
Bug with inSel-Popup in v4.3.3.27
2023-12-29 12:27:21 +01:00
Armilar
b7b8f389eb Merge pull request #1108 from tt-tom17/PageId
v4.3.3.27 Update NSPanel.ts
2023-12-28 14:51:14 +01:00
Thomas
9082ed20f3 v4.3.3.27 Update NSPanel.ts
- Fix Payload (pageItem.id -> placeId) by Function CreateEntity
- Fix Fallback PageItem.name by Function CreateEntity
2023-12-28 14:40:09 +01:00
Thomas
f807406a97 Update NsPanelTs.ts 2023-12-28 10:23:02 +01:00
Thomas
93aafe259b Update NsPanelTs.ts
Ablösung pageItem.id durch placeId
2023-12-28 09:46:05 +01:00
Armilar
b96fc6e6bd Merge pull request #1105 from tt-tom17/main
v4.3.3.26 - Update NSPanel.ts
2023-12-26 20:55:31 +01:00
joBr99
1996b29c60 . 2023-12-26 12:04:00 +01:00
Thomas
c8eb476ca8 Merge pull request #1 from tt-tom17/Log-JSON-Convert
v4.3.3.26 - Update NSPanel.ts
2023-12-26 00:52:26 +01:00
Thomas
aeaa995a0a v4.3.3.26 - Update NSPanel.ts
Fix Log output payload -> Json.stringify
2023-12-26 00:51:23 +01:00
Thomas
b35122868f Update NsPanelTs.ts 2023-12-26 00:45:48 +01:00
Thomas
1cb974494f Update NsPanelTs.ts
Fix Log output payload -> Json.stringify
2023-12-25 14:57:04 +01:00
Armilar
723ecde4cd 4.3.3.25 - Update NsPanelTs.ts
Remove Example
2023-12-22 16:30:02 +01:00
Armilar
f29e5c4978 Merge pull request #1100 from tt-tom17/main
v4.3.3.25 - Update NSPanel.ts
2023-12-22 13:57:08 +01:00
Thomas
46ffff7eea Update ioBroker_NSPanel_locales.json
Tag "qr" supplemented
2023-12-22 13:28:10 +01:00
Thomas
774c920591 v4.3.3.25 - Update NSPanel.ts
Add switch of cardQR by hidePassword: true
2023-12-22 13:25:56 +01:00
Thomas
f27eb07827 v4.3.3.25 - Update NSPanel.ts
Add switch of cardQR by hidePassword: true
2023-12-21 12:25:58 +01:00
Armilar
da8362d81d Merge pull request #1097 from joBr99/Armilar-patch-3
v4.3.3.24 - Update NsPanelTs.ts
2023-12-18 16:45:58 +01:00
dependabot[bot]
98926a3de1 Bump github/codeql-action from 2 to 3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 06:30:31 +00:00
5 changed files with 204 additions and 122 deletions

View File

@@ -47,7 +47,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -58,7 +58,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
@@ -72,4 +72,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3

View File

@@ -1,5 +1,5 @@
/*-----------------------------------------------------------------------
TypeScript v4.3.3.24 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @Sternmiere / @Britzelpuf / @ravenS0ne
TypeScript v4.3.3.28 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @Sternmiere / @Britzelpuf / @ravenS0ne
- abgestimmt auf TFT 53 / v4.3.3 / BerryDriver 9 / Tasmota 13.3.0
@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
@@ -81,6 +81,13 @@ ReleaseNotes:
- 14.12.2023 - v4.3.3.22 Fix name by static Navi Icon
- 17.12.2023 - v4.3.3.23 Optimization of the blind control (enable or disable Up/Stop/Down)
- 18.12.2023 - v4.3.3.24 Hotfix Update Message / Add Icon Colors to Entity Button
- 21.12.2023 - v4.3.3.25 Add switch of cardQR by hidePassword: true
- 26.12.2023 - v4.3.3.26 Fix Log output payload -> Json.stringify
- 28.12.2023 - v4.3.3.27 Fix Payload (pageItem.id -> placeId) by Function CreateEntity
- 28.12.2023 - v4.3.3.27 Fix Fallback PageItem.name by Function CreateEntity --> Many Bugs
- 30.12.2023 - v4.3.3.28 Fix short ID's in v4.3.3.27
- 30.12.2023 - v4.3.3.28 Fix window Icons in CreateEntity
- 30.12.2023 - v4.3.3.28 Add MQTT-Client Check
Todo:
- XX.XX.XXXX - v5.0.0 Change the bottomScreensaverEntity (rolling) if more than 6 entries are defined
@@ -767,6 +774,7 @@ export const config = <Config> {
// Seiteneinteilung / Page division
// Hauptseiten / Mainpages
pages: [
NSPanel_Service, //Auto-Alias Service Page
//Unlock_Service //Auto-Alias Service Page (Service Pages used with cardUnlock)
],
@@ -956,7 +964,7 @@ export const config = <Config> {
// _________________________________ DE: Ab hier keine Konfiguration mehr _____________________________________
// _________________________________ EN: No more configuration from here _____________________________________
const scriptVersion: string = 'v4.3.3.24';
const scriptVersion: string = 'v4.3.3.28';
const tft_version: string = 'v4.3.3';
const desired_display_firmware_version = 53;
const berry_driver_version = 9;
@@ -1166,12 +1174,18 @@ async function CheckMQTTPorts() {
portArray[i] = adapterInstancePort.trim();
}
let mqttInstance = adapterArray.indexOf(instanceName);
for (let j: number = 1; j < portArray.length; j++) {
if (portArray[j] == portArray[mqttInstance] && adapterArray[j] == adapterArray[mqttInstance]) {
log('- MQTT-Port-Check OK: Instance of Adapter: ' + adapterArray[j] + ' is running on Port:' + portArray[j], 'info');
} else if (portArray[j] == portArray[mqttInstance] && adapterArray[j] != adapterArray[mqttInstance]) {
log('Instance of Adapter: ' + adapterArray[j] + ' is running on same Port:' + portArray[j] + ' as ' + adapterArray[mqttInstance], 'warn');
log('Please Change Port of Instance: ' + adapterArray[j], 'warn');
const mqttConfig = getObject(`system.adapter.${adapterArray[mqttInstance]}`)
if (mqttConfig && mqttConfig.native && mqttConfig.native.type == 'client') {
log('- MQTT-Port-Check OK: Instance of Adapter: ' +adapterArray[mqttInstance] + ' is running as client!','info');
} else {
for (let j: number = 1; j < portArray.length; j++) {
if (portArray[j] == portArray[mqttInstance] && adapterArray[j] == adapterArray[mqttInstance]) {
log('- MQTT-Port-Check OK: Instance of Adapter: ' + adapterArray[j] + ' is running on Port:' + portArray[j], 'info');
} else if (portArray[j] == portArray[mqttInstance] && adapterArray[j] != adapterArray[mqttInstance]) {
log('Instance of Adapter: ' + adapterArray[j] + ' is running on same Port:' + portArray[j] + ' as ' + adapterArray[mqttInstance], 'warn');
log('Please Change Port of Instance: ' + adapterArray[j], 'warn');
}
}
}
log('End MQTT-Port-Check ---------------------------------------','info');
@@ -2965,13 +2979,21 @@ function HandleMessage(typ: string, method: string, page: number, words: Array<s
case 'pageOpenDetail':
screensaverEnabled = false;
UnsubscribeWatcher();
if (Debug) {
log('HandleMessage -> pageOpenDetail ' + words[0] + ' - ' + words[1] + ' - ' + words[2] + ' - ' + words[3] + ' - ' + words[4], 'info');
}
let tempId: PageItem['id'];
let tempPageItem = words[3].split('?');
let pageItem = findPageItem(tempPageItem[0]);
let placeId = undefined;
if (!isNaN(parseInt(tempPageItem[0]))){
tempId = activePage.items[tempPageItem[0]].id;
placeId = tempPageItem[0]
} else {
tempId = tempPageItem[0];
}
let pageItem: PageItem = findPageItem(tempId);
if (pageItem !== undefined) {
if (Debug) {
log('HandleMessage -> pageOpenDetail ' + words[0] + ' - ' + words[1] + ' - ' + words[2] + ' - ' + words[3] + ' - ' + words[4], 'info');
}
SendToPanel(GenerateDetailPage(words[2], tempPageItem[1], pageItem));
SendToPanel(GenerateDetailPage(words[2], tempPageItem[1], pageItem, placeId));
}
break;
case 'buttonPress2':
@@ -3006,7 +3028,7 @@ function findPageItem(searching: String): PageItem {
let pageItem = activePage.items.find(e => e.id === searching);
if (pageItem !== undefined) {
if (Debug) log('findPageItem -> pageItem ' + pageItem, 'info');
if (Debug) log('findPageItem -> pageItem ' + JSON.stringify(pageItem), 'info');
return pageItem;
}
@@ -3016,7 +3038,7 @@ function findPageItem(searching: String): PageItem {
return pageItem === undefined;
});
if (Debug) log('findPageItem -> pageItem SubPage ' + pageItem, 'info');
if (Debug) log('findPageItem -> pageItem SubPage ' + JSON.stringify(pageItem), 'info');
return pageItem;
} catch (err) {
@@ -3230,7 +3252,7 @@ function GeneratePageElements(page: Page): string {
for (let index = 0; index < maxItems; index++) {
if (page.items[index] !== undefined) {
pageData += CreateEntity(page.items[index], index + 1, page.useColor);
pageData += CreateEntity(page.items[index], index, page.useColor);
}
}
if (Debug) log('GeneratePageElements pageData ' + pageData, 'info');
@@ -3276,12 +3298,12 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
}
// Fallback if no name is given
name = pageItem.name !== undefined ? pageItem.name : o.common.name.de;
name = pageItem.name !== undefined ? pageItem.name : o.common.name.de == undefined ? o.common.name : o.common.name.de;
let prefix = pageItem.prefixName !== undefined ? pageItem.prefixName : '';
let suffix = pageItem.suffixName !== undefined ? pageItem.suffixName : '';
// If name is used with changing values
if (name.indexOf('getState(') != -1) {
if ((name || '').indexOf('getState(') != -1) {
let dpName: string = name.slice(10, name.length -6);
name = getState(dpName).val;
RegisterEntityWatcher(dpName);
@@ -3362,17 +3384,17 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
case 'door':
case 'window':
iconId = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : o.common.role == 'door' ? Icons.GetIcon('door-open') : Icons.GetIcon('window-open-variant');
iconId2 = pageItem.icon2 !== undefined ? Icons.GetIcon(pageItem.icon2) : o.common.role == 'door' ? Icons.GetIcon('door-closed') : Icons.GetIcon('window-closed-variant');
iconId = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : o.common.role == 'door' ? Icons.GetIcon('door-closed') : Icons.GetIcon('window-closed-variant');
iconId2 = pageItem.icon2 !== undefined ? Icons.GetIcon(pageItem.icon2) : o.common.role == 'door' ? Icons.GetIcon('door-open') : Icons.GetIcon('window-open-variant');
buttonText = pageItem.buttonText !== undefined ? pageItem.buttonText : existsState(pageItem.id + '.BUTTONTEXT') ? getState(pageItem.id + '.BUTTONTEXT').val : 'PRESS';
if (existsState(pageItem.id + '.COLORDEC')) {
iconColor = getState(pageItem.id + '.COLORDEC').val;
} else {
if (val === true || val === 'true') {
iconColor = GetIconColor(pageItem, false, useColors);
} else {
iconColor = GetIconColor(pageItem, true, useColors);
} else {
iconColor = GetIconColor(pageItem, false, useColors);
}
}
if (val === true || val === 'true') { iconId = iconId2 };
@@ -3540,8 +3562,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
}
}
if (Debug) log('CreateEntity Icon role socket/light ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
if (Debug) log('CreateEntity Icon role socket/light ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
case 'hue':
type = 'light';
@@ -3570,8 +3592,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
}
}
if (Debug) log('CreateEntity Icon role hue ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
if (Debug) log('CreateEntity Icon role hue ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
case 'ct':
type = 'light';
@@ -3590,8 +3612,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
}
}
if (Debug) log('CreateEntity Icon role ct ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
if (Debug) log('CreateEntity Icon role ct ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
case 'rgb':
type = 'light';
@@ -3620,8 +3642,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
}
}
if (Debug) log('CreateEntity Icon role rgb ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
if (Debug) log('CreateEntity Icon role rgb ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
case 'cie':
case 'rgbSingle':
@@ -3652,8 +3674,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
}
}
if (Debug) log('CreateEntity Icon role cie/rgbSingle ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
if (Debug) log('CreateEntity Icon role cie/rgbSingle ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
case 'dimmer':
type = 'light';
@@ -3672,8 +3694,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
}
}
if (Debug) log('CreateEntity Icon role dimmer ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
if (Debug) log('CreateEntity Icon role dimmer ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
case 'blind':
type = 'shutter';
@@ -3705,9 +3727,9 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
let icon_down_status = tempVal === max_Level ? 'disable' : 'enable';
let value = icon_up + '|' + icon_stop + '|' + icon_down + '|' + icon_up_status + '|' + icon_stop_status + '|' + icon_down_status
if (Debug) log('CreateEntity Icon role blind ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + value, 'info');
if (Debug) log('CreateEntity Icon role blind ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + value, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + value;
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + value;
case 'gate':
type = 'text';
@@ -3727,8 +3749,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
}
if (Debug) log('CreateEntity Icon role gate ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + gateState, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + gateState;
if (Debug) log('CreateEntity Icon role gate ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + gateState, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + gateState;
case 'door':
case 'window':
@@ -3738,18 +3760,18 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
if (existsState(pageItem.id + '.ACTUAL')) {
if (getState(pageItem.id + '.ACTUAL').val) {
iconId = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : o.common.role == 'door' ? Icons.GetIcon('door-open') : Icons.GetIcon('window-open-variant');
iconColor = GetIconColor(pageItem, false, useColors);
iconColor = GetIconColor(pageItem, true, useColors);
windowState = findLocale('window', 'opened');
} else {
iconId = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : o.common.role == 'door' ? Icons.GetIcon('door-closed') : Icons.GetIcon('window-closed-variant');
iconId = pageItem.icon2 !== undefined ? Icons.GetIcon(pageItem.icon2) : iconId;
iconColor = GetIconColor(pageItem, true, useColors);
iconColor = GetIconColor(pageItem, false, useColors);
windowState = findLocale('window', 'closed');
}
}
if (Debug) log('CreateEntity Icon role door/window ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + windowState, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + windowState;
if (Debug) log('CreateEntity Icon role door/window ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + windowState, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + windowState;
case 'motion':
type = 'text';
@@ -3763,8 +3785,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
iconId = pageItem.icon2 !== undefined ? Icons.GetIcon(pageItem.icon2) : Icons.GetIcon('motion-sensor');
}
if (Debug) log('CreateEntity Icon role motion ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
if (Debug) log('CreateEntity Icon role motion ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
case 'info':
@@ -3838,8 +3860,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
}
if (Debug) log('CreateEntity Icon role info, humidity, temperature, value.temperature, value.humidity, sensor.door, sensor.window, thermostat', 'info');
if (Debug) log('CreateEntity ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal+ ' ' + unit, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal + ' ' + unit;
if (Debug) log('CreateEntity ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal+ ' ' + unit, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal + ' ' + unit;
case 'buttonSensor':
@@ -3848,8 +3870,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
iconColor = GetIconColor(pageItem, true, useColors);
let inSelText = pageItem.buttonText !== undefined ? pageItem.buttonText : 'PRESS';
if (Debug) log('CreateEntity Icon role buttonSensor ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + inSelText, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + inSelText;
if (Debug) log('CreateEntity Icon role buttonSensor ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + inSelText, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + inSelText;
case 'button':
type = 'button';
@@ -3862,8 +3884,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
let buttonText = pageItem.buttonText !== undefined ? pageItem.buttonText : 'PRESS';
if (Debug) log('CreateEntity Icon role button ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + buttonText, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + buttonText;
if (Debug) log('CreateEntity Icon role button ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + buttonText, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + buttonText;
case 'value.time':
case 'level.timer':
type = 'timer';
@@ -3876,8 +3898,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
RegisterEntityWatcher(pageItem.id + '.STATE');
}
if (Debug) log('CreateEntity Icon role level.timer ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + timerText, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + timerText;
if (Debug) log('CreateEntity Icon role level.timer ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + timerText, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + timerText;
case 'value.alarmtime':
type = 'timer';
@@ -3894,8 +3916,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
name = ('0' + String(Math.floor(timer_actual / 60))).slice(-2) + ':' + ('0' + String(timer_actual % 60)).slice(-2);
}
if (Debug) log('CreateEntity Icon role value.alarmtime ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + alarmtimerText + ' ' + val, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + alarmtimerText;
if (Debug) log('CreateEntity Icon role value.alarmtime ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + alarmtimerText + ' ' + val, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + alarmtimerText;
case 'level.mode.fan':
@@ -3915,8 +3937,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
}
}
if (Debug) log('CreateEntity Icon role level.mode.fan ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
if (Debug) log('CreateEntity Icon role level.mode.fan ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + optVal;
case 'lock':
type = 'button';
@@ -3937,8 +3959,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
lockState = pageItem.buttonText !== undefined ? pageItem.buttonText : lockState;
}
if (Debug) log('CreateEntity Icon role lock ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + lockState, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + lockState;
if (Debug) log('CreateEntity Icon role lock ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + lockState, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + lockState;
case 'slider':
type = 'number';
@@ -3946,8 +3968,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
iconColor = GetIconColor(pageItem, false, useColors);
if (Debug) log('CreateEntity Icon role slider ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + val + '|' + pageItem.minValue + '|' + pageItem.maxValue, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + val + '|' + pageItem.minValue + '|' + pageItem.maxValue;
if (Debug) log('CreateEntity Icon role slider ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + val + '|' + pageItem.minValue + '|' + pageItem.maxValue, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + val + '|' + pageItem.minValue + '|' + pageItem.maxValue;
case 'volumeGroup':
case 'volume':
@@ -3968,8 +3990,8 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
iconId = Icons.GetIcon('volume-mute');
}
if (Debug) log('CreateEntity Icon role volumeGroup/volume ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + val + '|' + pageItem.minValue + '|' + pageItem.maxValue, 'info');
return '~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + name + '~' + val + '|' + pageItem.minValue + '|' + pageItem.maxValue;
if (Debug) log('CreateEntity Icon role volumeGroup/volume ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + val + '|' + pageItem.minValue + '|' + pageItem.maxValue, 'info');
return '~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + name + '~' + val + '|' + pageItem.minValue + '|' + pageItem.maxValue;
case 'warning':
type = 'text';
@@ -3985,7 +4007,7 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
iconId = itemInfo;
}
if (Debug) log('CreateEntity Icon role warning ~' + type + '~' + pageItem.id + '~' + iconId + '~' + iconColor + '~' + itemName + '~' + itemInfo, 'info');
if (Debug) log('CreateEntity Icon role warning ~' + type + '~' + placeId + '~' + iconId + '~' + iconColor + '~' + itemName + '~' + itemInfo, 'info');
return '~' + type + '~' + itemName + '~' + iconId + '~' + iconColor + '~' + itemName + '~' + itemInfo;
case 'timeTable':
@@ -4138,14 +4160,16 @@ function RegisterEntityWatcher(id: string): void {
}
}
function RegisterDetailEntityWatcher(id: string, pageItem: PageItem, type: string): void {
function RegisterDetailEntityWatcher(id: string, pageItem: PageItem, type: string, placeId: number): void {
try {
if (subscriptions.hasOwnProperty(id)) {
return;
}
if (Debug) log('id: ' + id + ' - pageItem: ' + JSON.stringify(pageItem) + ' - type: ' + type + ' - placeId: ' + placeId, 'info');
subscriptions[id] = (on({ id: id, change: 'any' }, () => {
SendToPanel(GenerateDetailPage(type, undefined, pageItem));
SendToPanel(GenerateDetailPage(type, undefined, pageItem, placeId));
}))
} catch (err) {
log('error at function RegisterDetailEntityWatcher: ' + err.message, 'warn');
@@ -5318,7 +5342,7 @@ function GenerateMediaPage(page: PageMedia): Payload[] {
});
}
if (Debug) {
log('GenerateMediaPage payload: ' + out_msgs, 'info');
log('GenerateMediaPage payload: ' + JSON.stringify(out_msgs), 'info');
}
return out_msgs
} catch (err) {
@@ -5474,7 +5498,7 @@ function GenerateAlarmPage(page: PageAlarm): Payload[] {
});
if (Debug) {
log('GenerateAlarmPage payload: ' + out_msgs, 'info');
log('GenerateAlarmPage payload: ' + JSON.stringify(out_msgs), 'info');
}
return out_msgs;
}
@@ -5554,7 +5578,7 @@ function GenerateUnlockPage(page: PageUnlock): Payload[] {
});
if (Debug) {
log('GenerateUnlockPage payload: ' + out_msgs, 'info');
log('GenerateUnlockPage payload: ' + JSON.stringify(out_msgs), 'info');
}
return out_msgs;
@@ -5572,9 +5596,11 @@ async function createAutoQRAlias(id:string, dpPath:string) {
if (autoCreateAlias) {
if (isSetOptionActive) {
if (existsState(dpPath + 'Daten') == false) {
await createStateAsync(dpPath + 'Daten', 'WIFI:T:undefined;S:undefined;P:undefined;H:undefined;', { type: 'string' });
setObject(id, { _id: id, type: 'channel', common: { role: 'info', name: 'QR Page' }, native: {} });
await createStateAsync(dpPath + 'Daten', 'WIFI:T:undefined;S:undefined;P:undefined;H:undefined;', <iobJS.StateCommon>{ type: 'string' });
await createStateAsync(dpPath + 'Switch', false, <iobJS.StateCommon>{ type: 'boolean' });
setObject(id, { _id: id, type: 'channel', common: { role: 'switch.mode.wlan', name: 'QR Page' }, native: {} });
await createAliasAsync(id + '.ACTUAL', dpPath + 'Daten', true, <iobJS.StateCommon>{ type: 'string', role: 'state', name: 'ACTUAL' });
await createAliasAsync(id + '.SWITCH', dpPath + 'Switch', true, <iobJS.StateCommon>{ type: 'boolean', role: 'state', name: 'SWITCH' });
log('Adjust data for the QR page under ' + dpPath + 'data. Follow the instructions in the wiki.', 'warn');
}
}
@@ -5630,16 +5656,21 @@ function GenerateQRPage(page: PageQR): Payload[] {
let type1 = 'text';
let internalName1 = findLocale('qr', 'ssid');
let iconId1 = Icons.GetIcon('wifi');
let iconColor1 = 65535;
let displayName1 = findLocale('qr', 'ssid');
let type2 = 'text';
let internalName2 = findLocale('qr', 'password');
let iconColor2 = 65535;
let iconId2 = Icons.GetIcon('key');
let displayName2 = findLocale('qr', 'password');
if (hiddenPWD) {
type2 = 'disable';
iconColor1 = getState(page.items[0].id + '.SWITCH').val ? rgb_dec565(colorScale0) : rgb_dec565(colorScale10);
type2 = 'switch';
internalName2 = id
iconId2 = '';
displayName2 = '';
displayName2 = getState(page.items[0].id + '.SWITCH').val ? findLocale('qr', 'Wlan enabled') : findLocale('qr', 'Wlan disabled');
optionalValue2 = getState(page.items[0].id + '.SWITCH').val ? 1 : 0;
}
out_msgs.push({
@@ -5650,19 +5681,19 @@ function GenerateQRPage(page: PageQR): Payload[] {
type1 + '~' + //type
internalName1 + '~' + //internalName
iconId1 + '~' + //iconId
65535 + '~' + //iconColor
iconColor1 + '~' + //iconColor
displayName1 + '~' + //displayName
optionalValue1 + '~' + //optionalValue
type2 + '~' + //type
internalName2 + '~' + //internalName
iconId2 + '~' + //iconId
65535 + '~' + //iconColor
iconColor2 + '~' + //iconColor
displayName2 + '~' + //displayName
optionalValue2
});
if (Debug) {
log('GenerateQRPage payload: ' + out_msgs, 'info');
log('GenerateQRPage payload: ' + JSON.stringify(out_msgs), 'info');
}
return out_msgs;
@@ -5807,7 +5838,7 @@ function GeneratePowerPage(page: PagePower): Payload[] {
// 1st to 6th Item
power_string
});
if (Debug) log('GeneratePowerPage payload: ' + out_msgs, 'info');
if (Debug) log('GeneratePowerPage payload: ' + JSON.stringify(out_msgs), 'info');
return out_msgs;
} catch (err) {
@@ -5839,7 +5870,7 @@ function GenerateChartPage(page: PageChart): Payload[] {
txt
});
if (Debug) log('GenerateChartPage payload: ' + out_msgs, 'info');
if (Debug) log('GenerateChartPage payload: ' + JSON.stringify(out_msgs), 'info');
return out_msgs;
} catch (err) {
@@ -5909,6 +5940,15 @@ function HandleButtonEvent(words: any): void {
let tempid = words[2].split('?');
let id = tempid[0];
let buttonAction = words[3];
let pageItemID: string = '';
if (!isNaN(id)) {
pageItemID = activePage.items[id].id;
if (Debug) {
log('HandleButtonEvent activePage: ' + activePage.items.length + ' id: ' + id + ' tempid: ' + tempid + ' pageItemId: ' + pageItemID);
}
id = pageItemID
};
if (Debug) {
log('HandleButtonEvent übergebene Werte ' + words[0] + ' - ' + words[1] + ' - ' + words[2] + ' - ' + words[3] + ' - ' + words[4] + ' - PageId: ' + pageId, 'info');
@@ -6072,6 +6112,9 @@ function HandleButtonEvent(words: any): void {
if (words[4] == '1')
action = true;
let o = getObject(id);
if (Debug) {
log('HandleButtonEvent -> OnOff: ' + words[4] + ' - ' + id + ' - Role - ' + o.common.role, 'info')
}
switch (o.common.role) {
case 'level.mode.fan':
case 'socket':
@@ -6094,6 +6137,11 @@ function HandleButtonEvent(words: any): void {
case 'rgbSingle':
case 'hue':
setIfExists(id + '.ON_ACTUAL', action);
break;
case 'switch.mode.wlan':
setIfExists(id + '.SWITCH', action);
GeneratePage(activePage);
break;
}
}
break;
@@ -6969,33 +7017,35 @@ function GetNavigationString(pageId: number): string {
}
}
function GenerateDetailPage(type: string, optional: string, pageItem: PageItem): Payload[] {
function GenerateDetailPage(type: string, optional: string, pageItem: PageItem, placeId: number): Payload[] {
if (Debug) log('GenerateDetailPage Übergabe Type: ' + type + ' - optional: ' + optional + ' - pageItem.id: ' + pageItem.id, 'info');
try {
let out_msgs: Array<Payload> = [];
let id = pageItem.id;
if (existsObject(id)) {
let o = getObject(id);
let val: (boolean | number) = 0;
let icon = Icons.GetIcon('lightbulb');
let iconColor = rgb_dec565(config.defaultColor);
if (type == 'popupLight') {
let switchVal = '0';
let brightness = 0;
if (o.common.role == 'light' || o.common.role == 'socket') {
if (existsState(id + '.GET')) {
val = getState(id + '.GET').val;
RegisterDetailEntityWatcher(id + '.GET', pageItem, type);
RegisterDetailEntityWatcher(id + '.GET', pageItem, type, placeId);
} else if (existsState(id + '.SET')) {
if(pageItem.monobutton != undefined && pageItem.monobutton == true){
val = getState(id + ".STATE").val;
RegisterDetailEntityWatcher(id + ".STATE", pageItem, type);
RegisterDetailEntityWatcher(id + ".STATE", pageItem, type, placeId);
}
else {
val = getState(id + '.SET').val;
RegisterDetailEntityWatcher(id + '.SET', pageItem, type);
RegisterDetailEntityWatcher(id + '.SET', pageItem, type, placeId);
}
}
@@ -7013,9 +7063,11 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
effect_supported = 'enable';
}
let tempId = placeId != undefined ? placeId : id;
out_msgs.push({
payload: 'entityUpdateDetail' + '~' // entityUpdateDetail
+ id + '~'
+ tempId + '~'
+ icon + '~' // iconId
+ iconColor + '~' // iconColor
+ switchVal + '~' // buttonState
@@ -7033,10 +7085,10 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
if (o.common.role == 'dimmer') {
if (existsState(id + '.ON_ACTUAL')) {
val = getState(id + '.ON_ACTUAL').val;
RegisterDetailEntityWatcher(id + '.ON_ACTUAL', pageItem, type);
RegisterDetailEntityWatcher(id + '.ON_ACTUAL', pageItem, type, placeId);
} else if (existsState(id + '.ON_SET')) {
val = getState(id + '.ON_SET').val;
RegisterDetailEntityWatcher(id + '.ON_SET', pageItem, type);
RegisterDetailEntityWatcher(id + '.ON_SET', pageItem, type, placeId);
}
if (val === true) {
@@ -7061,16 +7113,18 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
iconColor = GetIconColor(pageItem, false, true);
}
RegisterDetailEntityWatcher(id + '.ACTUAL', pageItem, type);
RegisterDetailEntityWatcher(id + '.ACTUAL', pageItem, type, placeId);
let effect_supported = 'disable';
if (pageItem.modeList != undefined) {
effect_supported = 'enable';
}
let tempId = placeId != undefined ? placeId : id;
out_msgs.push({
payload: 'entityUpdateDetail' + '~' //entityUpdateDetail
+ id + '~'
+ tempId + '~'
+ icon + '~' //iconId
+ iconColor + '~' //iconColor
+ switchVal + '~' //buttonState
@@ -7089,7 +7143,7 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
if (existsState(id + '.ON_ACTUAL')) {
val = getState(id + '.ON_ACTUAL').val;
RegisterDetailEntityWatcher(id + '.ON_ACTUAL', pageItem, type);
RegisterDetailEntityWatcher(id + '.ON_ACTUAL', pageItem, type, placeId);
}
if (existsState(id + '.DIMMER')) {
@@ -7098,7 +7152,7 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
} else {
brightness = getState(id + '.DIMMER').val;
}
RegisterDetailEntityWatcher(id + '.DIMMER', pageItem, type);
RegisterDetailEntityWatcher(id + '.DIMMER', pageItem, type, placeId);
} else {
log('function GenerateDetailPage role:hue -> Alias-Datenpunkt: ' + id + '.DIMMER could not be read', 'warn');
}
@@ -7138,9 +7192,11 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
effect_supported = 'enable';
}
let tempId = placeId != undefined ? placeId : id;
out_msgs.push({
payload: 'entityUpdateDetail' + '~' //entityUpdateDetail
+ id + '~'
+ tempId + '~'
+ icon + '~' //iconId
+ iconColor + '~' //iconColor
+ switchVal + '~' //buttonState
@@ -7159,7 +7215,7 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
if (existsState(id + '.ON_ACTUAL')) {
val = getState(id + '.ON_ACTUAL').val;
RegisterDetailEntityWatcher(id + '.ON_ACTUAL', pageItem, type);
RegisterDetailEntityWatcher(id + '.ON_ACTUAL', pageItem, type, placeId);
}
if (existsState(id + '.DIMMER')) {
@@ -7168,7 +7224,7 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
} else {
brightness = getState(id + '.DIMMER').val;
}
RegisterDetailEntityWatcher(id + '.DIMMER', pageItem, type);
RegisterDetailEntityWatcher(id + '.DIMMER', pageItem, type, placeId);
} else {
log('function GenerateDetailPage role:rgb -> Alias-Datenpunkt: ' + id + '.DIMMER could not be read', 'warn');
}
@@ -7206,10 +7262,12 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
if (pageItem.modeList != undefined) {
effect_supported = 'enable';
}
let tempId = placeId != undefined ? placeId : id;
out_msgs.push({
payload: 'entityUpdateDetail' + '~' //entityUpdateDetail
+ id + '~'
+ tempId + '~'
+ icon + '~' //iconId
+ iconColor + '~' //iconColor
+ switchVal + '~' //buttonState
@@ -7228,7 +7286,7 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
if (existsState(id + '.ON_ACTUAL')) {
val = getState(id + '.ON_ACTUAL').val;
RegisterDetailEntityWatcher(id + '.ON_ACTUAL', pageItem, type);
RegisterDetailEntityWatcher(id + '.ON_ACTUAL', pageItem, type, placeId);
}
if (existsState(id + '.DIMMER')) {
@@ -7237,7 +7295,7 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
} else {
brightness = getState(id + '.DIMMER').val;
}
RegisterDetailEntityWatcher(id + '.DIMMER', pageItem, type);
RegisterDetailEntityWatcher(id + '.DIMMER', pageItem, type, placeId);
} else {
log('function GenerateDetailPage role:rgbSingle -> Alias-Datenpunkt: ' + id + '.DIMMER could not be read', 'warn');
}
@@ -7281,9 +7339,11 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
effect_supported = 'enable';
}
let tempId = placeId != undefined ? placeId : id;
out_msgs.push({
payload: 'entityUpdateDetail' + '~' //entityUpdateDetail
+ id + '~'
+ tempId + '~'
+ icon + '~' //iconId
+ iconColor + '~' //iconColor
+ switchVal + '~' //buttonState
@@ -7302,7 +7362,7 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
if (existsState(id + '.ON')) {
val = getState(id + '.ON').val;
RegisterDetailEntityWatcher(id + '.ON', pageItem, type);
RegisterDetailEntityWatcher(id + '.ON', pageItem, type, placeId);
}
if (existsState(id + '.DIMMER')) {
@@ -7311,7 +7371,7 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
} else {
brightness = getState(id + '.DIMMER').val;
}
RegisterDetailEntityWatcher(id + '.DIMMER', pageItem, type);
RegisterDetailEntityWatcher(id + '.DIMMER', pageItem, type, placeId);
} else {
log('function GenerateDetailPage role:ct -> Alias-Datenpunkt: ' + id + '.DIMMER could not be read', 'warn');
}
@@ -7343,9 +7403,11 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
effect_supported = 'enable';
}
let tempId = placeId != undefined ? placeId : id;
out_msgs.push({
payload: 'entityUpdateDetail' + '~' //entityUpdateDetail
+ id + '~'
+ tempId + '~'
+ icon + '~' //iconId
+ iconColor + '~' //iconColor
+ switchVal + '~' //buttonState
@@ -7365,7 +7427,7 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
icon = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : Icons.GetIcon('window-open');
if (existsState(id + '.ACTUAL')) {
val = getState(id + '.ACTUAL').val;
RegisterDetailEntityWatcher(id + '.ACTUAL', pageItem, type);
RegisterDetailEntityWatcher(id + '.ACTUAL', pageItem, type, placeId);
} else if (existsState(id + '.SET')) {
val = getState(id + '.SET').val;
//RegisterDetailEntityWatcher(id + '.SET', pageItem, type);
@@ -7373,7 +7435,7 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
let tilt_position: any = 'disabled'
if (existsState(id + '.TILT_ACTUAL')) {
tilt_position = getState(id + '.TILT_ACTUAL').val;
RegisterDetailEntityWatcher(id + '.TILT_ACTUAL', pageItem, type);
RegisterDetailEntityWatcher(id + '.TILT_ACTUAL', pageItem, type, placeId);
} else if (existsState(id + '.TILT_SET')) {
tilt_position = getState(id + '.TILT_SET').val;
//RegisterDetailEntityWatcher(id + '.TILT_SET', pageItem, type);
@@ -7433,9 +7495,11 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
textSecondRow = pageItem.secondRow;
}
let tempId = placeId != undefined ? placeId : id;
out_msgs.push({
payload: 'entityUpdateDetail' + '~' //entityUpdateDetail
+ id + '~' //entity_id
+ tempId + '~' //entity_id
+ val + '~' //Shutterposition
+ textSecondRow + '~' //pos_status 2.line
+ findLocale('blinds', 'Position') + '~' //pos_translation
@@ -7465,7 +7529,7 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
let payloadParameters1 = '~~~~'
if (pageItem.popupThermoMode1 != undefined) {
RegisterDetailEntityWatcher(pageItem.id + "." + pageItem.setThermoAlias[0], pageItem, type);
RegisterDetailEntityWatcher(pageItem.id + "." + pageItem.setThermoAlias[0], pageItem, type, placeId);
payloadParameters1 = pageItem.popUpThermoName[0] + '~' //{heading}~ Mode 1
+ 'modus1' + '~' //{id}~ Mode 1
+ getState(pageItem.id + "." + pageItem.setThermoAlias[0]).val + '~' //{ACTUAL}~ Mode 1
@@ -7474,7 +7538,7 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
let payloadParameters2 = '~~~~'
if (pageItem.popupThermoMode2 != undefined) {
RegisterDetailEntityWatcher(pageItem.id + "." + pageItem.setThermoAlias[1], pageItem, type);
RegisterDetailEntityWatcher(pageItem.id + "." + pageItem.setThermoAlias[1], pageItem, type, placeId);
payloadParameters2 = pageItem.popUpThermoName[1] + '~' //{heading}~ Mode 2
+ 'modus2' + '~' //{id}~ Mode 2
+ getState(pageItem.id + "." + pageItem.setThermoAlias[1]).val + '~' //{ACTUAL}~ Mode 2
@@ -7483,7 +7547,7 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
let payloadParameters3 = '~~~~'
if (pageItem.popupThermoMode3 != undefined) {
RegisterDetailEntityWatcher(pageItem.id + "." + pageItem.setThermoAlias[2], pageItem, type);
RegisterDetailEntityWatcher(pageItem.id + "." + pageItem.setThermoAlias[2], pageItem, type, placeId);
payloadParameters3 = pageItem.popUpThermoName[2] + '~' //{heading}~ Mode 3
+ 'modus3' + '~' //{id}~ Mode 3
+ getState(pageItem.id + "." + pageItem.setThermoAlias[2]).val + '~' //{ACTUAL}~ Mode 3
@@ -7506,12 +7570,12 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
let timer_actual: number = 0;
if (existsState(id + '.ACTUAL')) {
RegisterDetailEntityWatcher(id + '.ACTUAL', pageItem, type);
RegisterDetailEntityWatcher(id + '.ACTUAL', pageItem, type, placeId);
timer_actual = getState(id + '.ACTUAL').val;
}
if (existsState(id + '.STATE')) {
RegisterDetailEntityWatcher(id + '.STATE', pageItem, type);
RegisterDetailEntityWatcher(id + '.STATE', pageItem, type, placeId);
}
let editable = 1;
@@ -7569,11 +7633,13 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
}
}
let tempId = placeId != undefined ? placeId : id;
out_msgs.push({
payload: 'entityUpdateDetail' + '~' //entityUpdateDetail
+ id + '~~' //{entity_id}
+ tempId + '~~' //{entity_id}
+ rgb_dec565(White) + '~' //{icon_color}~
+ id + '~'
+ tempId + '~'
+ min_remaining + '~'
+ sec_remaining + '~'
+ editable + '~'
@@ -7593,10 +7659,10 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
if (o.common.role == 'level.mode.fan') {
if (existsState(id + '.SET')) {
val = getState(id + '.SET').val;
RegisterDetailEntityWatcher(id + '.SET', pageItem, type);
RegisterDetailEntityWatcher(id + '.SET', pageItem, type, placeId);
}
if (existsState(id + '.MODE')) {
RegisterDetailEntityWatcher(id + '.MODE', pageItem, type);
RegisterDetailEntityWatcher(id + '.MODE', pageItem, type, placeId);
}
icon = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : 'fan';
@@ -7613,10 +7679,12 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
let modeList = pageItem.modeList.join('?');
let actualMode = pageItem.modeList[getState(id + '.MODE').val];
let tempId = placeId != undefined ? placeId : id;
out_msgs.push({
payload: 'entityUpdateDetail' + '~' // entityUpdateDetail
+ id + '~'
+ tempId + '~'
+ icon + '~' // iconId
+ iconColor + '~' // iconColor
+ switchVal + '~' // buttonState
@@ -7845,9 +7913,11 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
mode = 'favorites';
}
let tempId = placeId != undefined ? placeId : id;
out_msgs.push({
payload: 'entityUpdateDetail2' + '~' //entityUpdateDetail
+ id + '?' + optional + '~~' //{entity_id}
+ tempId + '?' + optional + '~~' //{entity_id}
+ rgb_dec565(HMIOn) + '~' //{icon_color}~
+ mode + '~'
+ actualState + '~'
@@ -7861,7 +7931,7 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
if (pageItem.inSel_ChoiceState || pageItem.inSel_ChoiceState == undefined) {
if (existsObject(pageItem.id + '.VALUE')) {
actualValue = formatInSelText(pageItem.modeList[getState(pageItem.id + '.VALUE').val]);
RegisterDetailEntityWatcher(id + '.VALUE', pageItem, type);
RegisterDetailEntityWatcher(id + '.VALUE', pageItem, type, placeId);
}
}
@@ -7871,9 +7941,11 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
}
let valueList = pageItem.modeList != undefined ? tempModeList.join('?') : '';
let tempId = placeId != undefined ? placeId : id;
out_msgs.push({
payload: 'entityUpdateDetail2' + '~' //entityUpdateDetail2
+ id + '~~' //{entity_id}
+ tempId + '~~' //{entity_id}
+ rgb_dec565(White) + '~' //{icon_color}~
+ 'insel' + '~'
+ actualValue + '~'
@@ -7894,7 +7966,7 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
if (pageItem.inSel_ChoiceState || pageItem.inSel_ChoiceState == undefined) {
if (existsObject(pageItem.id + '.VALUE')) {
actualValue = formatInSelText(pageItem.modeList[getState(pageItem.id + '.VALUE').val]);
RegisterDetailEntityWatcher(id + '.VALUE', pageItem, type);
RegisterDetailEntityWatcher(id + '.VALUE', pageItem, type, placeId);
}
}
@@ -7905,10 +7977,11 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
let valueList = pageItem.modeList != undefined ? tempModeList.join('?') : '';
//log(valueList);
let tempId = placeId != undefined ? placeId : id;
out_msgs.push({
payload: 'entityUpdateDetail2' + '~' //entityUpdateDetail2
+ id + '~~' //{entity_id}
+ tempId + '~~' //{entity_id}
+ rgb_dec565(White) + '~' //{icon_color}~
+ 'insel' + '~'
+ actualValue + '~'
@@ -7918,6 +7991,7 @@ function GenerateDetailPage(type: string, optional: string, pageItem: PageItem):
}
}
}
if (Debug) log('GenerateDetailPage -> payload: ' + JSON.stringify(out_msgs), 'info');
return out_msgs;
} catch (err) {

View File

@@ -2497,6 +2497,14 @@
"vi-VN":"Mật khẩu",
"zh-CN":"密码",
"zh-TW":"密碼"
},
"Wlan enabled":{
"en-US":"Wlan enabled",
"de-DE":"Wlan aktiviert"
},
"Wlan disabled":{
"en-US":"Wlan disabled",
"de-DE":"Wlan deaktiviert"
}
},
"media":{

View File

@@ -1,6 +1,6 @@
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
name: NSPanel Lovelace UI Addon
version: "4.7.73"
version: "4.7.74"
slug: nspanel-lovelace-ui
description: NSPanel Lovelace UI Addon
services:

View File

@@ -67,7 +67,7 @@ class LovelaceUIPanel:
self.schedule = Scheduler()
self.schedule.minutely(datetime.time(second=0), self.update_time)
self.schedule.hourly(datetime.time(
minute=0, second=0), self.update_time)
minute=0, second=0), self.update_date)
schedule_thread = threading.Thread(target=self.schedule_thread_target)
schedule_thread.daemon = True
schedule_thread.start()