Added ALIAS Door, Window, Humitity in ioBroker

This commit is contained in:
Armilar
2022-04-22 20:49:50 +02:00
committed by GitHub
parent 4e18abf4d1
commit ac26ee9fce

View File

@@ -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