mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-23 07:54:25 +01:00
Fix CardThermo, added names
This commit is contained in:
@@ -15,7 +15,7 @@ var Wohnen: PageEntities =
|
|||||||
"heading": "Haus",
|
"heading": "Haus",
|
||||||
"useColor": true,
|
"useColor": true,
|
||||||
"items": [
|
"items": [
|
||||||
<PageItem>{ id: "alias.0.Stern"},
|
<PageItem>{ id: "alias.0.Stern", name: "Sternsteckdose"},
|
||||||
<PageItem>{ id: "alias.0.Erker"},
|
<PageItem>{ id: "alias.0.Erker"},
|
||||||
<PageItem>{ id: "alias.0.Küche", interpolateColor: true },
|
<PageItem>{ id: "alias.0.Küche", interpolateColor: true },
|
||||||
<PageItem>{ id: "alias.0.Wand" }
|
<PageItem>{ id: "alias.0.Wand" }
|
||||||
@@ -83,7 +83,7 @@ export const config: Config = {
|
|||||||
"type": "cardThermo",
|
"type": "cardThermo",
|
||||||
"heading": "Thermostat",
|
"heading": "Thermostat",
|
||||||
"useColor": true,
|
"useColor": true,
|
||||||
"items": [<PageItem>{ id: "alias.0.WzNsPanel" }]
|
"items": [<PageItem>{ id: "alias.0.WzNsPanel", name: "Wohnzimmer" }]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
button1Page: button1Page,
|
button1Page: button1Page,
|
||||||
@@ -284,7 +284,7 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
|
|||||||
if (existsObject(pageItem.id)) {
|
if (existsObject(pageItem.id)) {
|
||||||
let o = getObject(pageItem.id)
|
let o = getObject(pageItem.id)
|
||||||
var val = null;
|
var val = null;
|
||||||
name = o.common.name.de
|
name = pageItem.name !== undefined ? pageItem.name : o.common.name.de
|
||||||
|
|
||||||
if (existsState(pageItem.id + ".GET")) {
|
if (existsState(pageItem.id + ".GET")) {
|
||||||
val = getState(pageItem.id + ".GET").val;
|
val = getState(pageItem.id + ".GET").val;
|
||||||
@@ -299,7 +299,7 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
|
|||||||
switch (o.common.role) {
|
switch (o.common.role) {
|
||||||
case "light":
|
case "light":
|
||||||
type = "light"
|
type = "light"
|
||||||
iconId = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : Icons.GetIcon("thermometer");
|
iconId = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : Icons.GetIcon("lightbulb");
|
||||||
var optVal = "0"
|
var optVal = "0"
|
||||||
|
|
||||||
if (val === true || val === "true") {
|
if (val === true || val === "true") {
|
||||||
@@ -363,7 +363,7 @@ function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean =
|
|||||||
case "button":
|
case "button":
|
||||||
type = "button";
|
type = "button";
|
||||||
iconId = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : Icons.GetIcon("gesture-tap-button");
|
iconId = pageItem.icon !== undefined ? Icons.GetIcon(pageItem.icon) : Icons.GetIcon("gesture-tap-button");
|
||||||
let buttonText = pageItem.buttonText !== undefined ? pageItem.buttonText : "PRESS";
|
let buttonText = pageItem.name !== undefined ? pageItem.name : "PRESS";
|
||||||
iconColor = GetIconColor(pageItem, true, useColors);
|
iconColor = GetIconColor(pageItem, true, useColors);
|
||||||
return "~" + type + "~" + pageItem.id + "~" + iconId + "~" + + iconColor + "~" + name + "~" + buttonText;
|
return "~" + type + "~" + pageItem.id + "~" + iconId + "~" + + iconColor + "~" + name + "~" + buttonText;
|
||||||
|
|
||||||
@@ -434,12 +434,12 @@ function GetUnitOfMeasurement(id: string): string {
|
|||||||
function GenerateThermoPage(page: PageThermo): Payload[] {
|
function GenerateThermoPage(page: PageThermo): Payload[] {
|
||||||
var id = page.items[0].id
|
var id = page.items[0].id
|
||||||
var out_msgs: Array<Payload> = [];
|
var out_msgs: Array<Payload> = [];
|
||||||
out_msgs.push({ payload: "pageType,cardThermo" });
|
out_msgs.push({ payload: "pageType~cardThermo" });
|
||||||
|
|
||||||
// ioBroker
|
// ioBroker
|
||||||
if (existsObject(id)) {
|
if (existsObject(id)) {
|
||||||
let o = getObject(id)
|
let o = getObject(id)
|
||||||
let name = o.common.name.de
|
let name = page.items[0].name !== undefined ? page.items[0].name : o.common.name.de
|
||||||
let currentTemp = 0;
|
let currentTemp = 0;
|
||||||
if (existsState(id + ".ACTUAL"))
|
if (existsState(id + ".ACTUAL"))
|
||||||
currentTemp = parseInt(getState(id + ".ACTUAL").val) * 10;
|
currentTemp = parseInt(getState(id + ".ACTUAL").val) * 10;
|
||||||
@@ -454,11 +454,11 @@ function GenerateThermoPage(page: PageThermo): Payload[] {
|
|||||||
let status = ""
|
let status = ""
|
||||||
if (existsState(id + ".MODE"))
|
if (existsState(id + ".MODE"))
|
||||||
status = getState(id + ".MODE").val;
|
status = getState(id + ".MODE").val;
|
||||||
let minTemp = 50
|
let minTemp = 180
|
||||||
let maxTemp = 350
|
let maxTemp = 300
|
||||||
let stepTemp = 5
|
let stepTemp = 5
|
||||||
|
|
||||||
out_msgs.push({ payload: "entityUpd~" + id + "~" + name + "~" + currentTemp + "~" + destTemp + "~" + status + "~" + minTemp + "~" + maxTemp + "~" + stepTemp })
|
out_msgs.push({ payload: "entityUpd~" + name + "~" + GetNavigationString(pageId) + "~" + id + "~" + currentTemp + "~" + destTemp + "~" + status + "~" + minTemp + "~" + maxTemp + "~" + stepTemp })
|
||||||
}
|
}
|
||||||
|
|
||||||
return out_msgs
|
return out_msgs
|
||||||
@@ -558,8 +558,7 @@ function GetNavigationString(pageId: number): string {
|
|||||||
switch (pageId) {
|
switch (pageId) {
|
||||||
case 0:
|
case 0:
|
||||||
return "0|1";
|
return "0|1";
|
||||||
case config.pages.length:
|
case config.pages.length - 1:
|
||||||
log("asd")
|
|
||||||
return "1|0";
|
return "1|0";
|
||||||
default:
|
default:
|
||||||
return "1|1";
|
return "1|1";
|
||||||
@@ -824,7 +823,7 @@ type PageItem = {
|
|||||||
interpolateColor: (boolean | undefined),
|
interpolateColor: (boolean | undefined),
|
||||||
minValue: (number | undefined),
|
minValue: (number | undefined),
|
||||||
maxValue: (number | undefined),
|
maxValue: (number | undefined),
|
||||||
buttonText: (string | undefined)
|
name: (string | undefined)
|
||||||
}
|
}
|
||||||
|
|
||||||
type Config = {
|
type Config = {
|
||||||
|
|||||||
Reference in New Issue
Block a user