From ac26ee9fce5c350c53c75d4d1871498754975ffa Mon Sep 17 00:00:00 2001 From: Armilar <102996011+Armilar@users.noreply.github.com> Date: Fri, 22 Apr 2022 20:49:50 +0200 Subject: [PATCH] Added ALIAS Door, Window, Humitity in ioBroker --- ioBroker/NsPanelTs.ts | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/ioBroker/NsPanelTs.ts b/ioBroker/NsPanelTs.ts index cbdfcdce..3c4c017b 100644 --- a/ioBroker/NsPanelTs.ts +++ b/ioBroker/NsPanelTs.ts @@ -13,10 +13,6 @@ const On: RGB = { red: 253, green: 216, blue: 53 }; const BatteryFull: RGB = { red: 96, green: 176, blue: 62 } const BatteryEmpty: RGB = { red: 179, green: 45, blue: 25 } -//Datenpunkte für Nachricht an Screensaver -var popupNotifyHeading = "0_userdata.0.NSPanel.1.popupNotifyHeading"; -var popupNotifyText = "0_userdata.0.NSPanel.1.popupNotifyText"; - var Wohnen: PageEntities = { "type": "cardEntities", @@ -122,10 +118,6 @@ schedule("0 * * * *", function () { SendDate(); }); -//Send message to screensaver -on({id: [popupNotifyHeading, popupNotifyText], change: "ne"}, async function (obj) { - setState(config.panelSendTopic,(['notify~',getState(popupNotifyHeading).val,'~',getState(popupNotifyText).val].join(''))); -}); // Only monitor the extra nodes if present var updateArray: string[] = []; @@ -365,9 +357,33 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean = iconId = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : Icons.GetIcon("window-open"); iconColor = GetIconColor(pageItem, existsState(pageItem.id + ".ACTUAL") ? getState(pageItem.id + ".ACTUAL").val : true, useColors); return "~" + type + "~" + pageItem.id + "~" + iconId + "~" + iconColor + "~" + name + "~" - + + case "door": + + case "window": + type = "text"; + 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); + var windowState = "opened" + } else { + iconId = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : o.common.role == "door" ? Icons.GetIcon("door-closed") : Icons.GetIcon("window-closed-variant"); + //iconId = Icons.GetIcon("window-closed-variant"); + iconColor = GetIconColor(pageItem, true, useColors); + var windowState = "closed" + } + RegisterEntityWatcher(pageItem.id + ".ACTUAL"); + } + return "~" + type + "~" + pageItem.id + "~" + iconId + "~" + iconColor + "~" + name + "~" + windowState; + case "info": + case "humidity": 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"); @@ -667,14 +683,11 @@ function GenerateDetailPage(type: string, pageItem: PageItem): Payload[] { } if (type == "popupShutter") { - if (existsState(id + ".ACTUAL")) { + if (existsState(id + ".ACTUAL")) val = getState(id + ".ACTUAL").val; - RegisterDetailEntityWatcher(id + ".ACTUAL", pageItem, type); - } else if (existsState(id + ".SET")) { + else if (existsState(id + ".SET")) val = getState(id + ".SET").val; - RegisterDetailEntityWatcher(id + ".SET", pageItem, type); - } - out_msgs.push({ payload: "entityUpdateDetail~" + val }) + out_msgs.push({ payload: "entityUpdateDetail," + val }) } } return out_msgs