Humidity and background changes, added gauge

This commit is contained in:
Florian Brinker 2019-10-29 19:52:48 +01:00
parent 2b83cf6374
commit d479171da4
5 changed files with 72 additions and 167 deletions

BIN
tileboard/background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

View File

@ -11,6 +11,36 @@ function loadConfig(url) {
req.send(null);
}
function createGauge(position, label, sensor, append) {
if (!append) {
append = '@attributes.unit_of_measurement'
}
return {
position: position,
type: TYPES.GAUGE,
title: label,
id: 'sensor.' + sensor,
state: false,
value: function(item, entity) {
num = parseFloat(entity.state);
return num && !isNaN(num) ? num.toFixed(1) : num;
},
settings: {
size: 120,
type: 'arch',
min: 0,
max: 100,
cap: 'round',
thick: 10,
append: append,
duration: 500,
thresholds: { 0: { color: '#16a085'}, 66: { color: '#f1c40f' }, 70: { color: '#e74c3c' } },
fractionSize: 1,
}
}
}
// Load secrets
loadConfig("includes/config/secrets.js");
@ -79,7 +109,7 @@ var CONFIG = {
pages: [
PAGE_OVERVIEW,
//PAGE_HUMIDITY,
PAGE_HUMIDITY,
PAGE_CCTV,
PAGE_MISC,
],

View File

@ -1,6 +1,6 @@
var PAGE_CCTV = {
title: 'CCTV',
bg: 'images/bg2.png',
bg: 'images/background.png',
icon: 'mdi-cctv',
groups: [
{

View File

@ -1,20 +1,19 @@
var PAGE_HUMIDITY = {
title: 'Luftfeuchtigkeit',
bg: 'images/bg1.jpeg',
bg: 'images/background.png',
icon: 'mdi-water-percent',
groupMarginCss: '20px 16px',
groups: [
{
title: '',
title: 'Badezimmer',
width: 2,
height: 3,
height: 2,
items: [
{
position: [0, 0],
type: TYPES.SENSOR,
title: 'Temperatur',
subtitle: 'Schlafzimmer',
id: 'sensor.temperature_11',
title: 'Elternbad',
id: 'sensor.hygro_bathroom_parents_temperature',
unit: 'C',
state: false,
filter: function (value) { // optional
@ -22,25 +21,12 @@ var PAGE_HUMIDITY = {
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
{
position: [1, 0],
type: TYPES.SENSOR,
title: 'Luftfeuchtigkeit',
subtitle: 'Schlafzimmer',
id: 'sensor.humidity_12',
unit: '%',
state: false,
filter: function (value) { // optional
var num = parseFloat(value);
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
createGauge([1, 0], 'Elternbad', 'hygro_bathroom_parents_humidity'),
{
position: [0, 1],
type: TYPES.SENSOR,
title: 'Temperatur',
subtitle: 'Elternbad',
id: 'sensor.parents_bathroom_hygrometer_temperature',
title: 'Kinderbad',
id: 'sensor.hygro_bathroom_kids_temperature',
unit: 'C',
state: false,
filter: function (value) { // optional
@ -48,57 +34,31 @@ var PAGE_HUMIDITY = {
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
{
position: [1, 1],
type: TYPES.SENSOR,
title: 'Luftfeuchtigkeit',
subtitle: 'Elternbad',
id: 'sensor.parents_bathroom_hygrometer_humidity',
unit: '%',
state: false,
filter: function (value) { // optional
var num = parseFloat(value);
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
{
position: [0, 2],
type: TYPES.SENSOR,
title: 'Temperatur',
subtitle: 'Kinderbad',
id: 'sensor.kids_bathroom_hygrometer_temperature',
unit: 'C',
state: false,
filter: function (value) { // optional
var num = parseFloat(value);
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
{
position: [1, 2],
type: TYPES.SENSOR,
title: 'Luftfeuchtigkeit',
subtitle: 'Kinderbad',
id: 'sensor.kids_bathroom_hygrometer_humidity',
unit: '%',
state: false,
filter: function (value) { // optional
var num = parseFloat(value);
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
createGauge([1, 1], 'Kinderbad', 'hygro_bathroom_kids_humidity'),
/*{
position: [0, 2],
type: TYPES.SENSOR,
title: 'Schlafzimmer',
id: 'sensor.temperature_11',
unit: 'C',
state: false,
filter: function (value) { // optional
var num = parseFloat(value);
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
createGauge([1, 2], 'Schlafzimmer', 'humidity_12'),*/
]
},
{
title: '',
title: 'Aufenthaltsräume',
width: 2,
height: 3,
height: 2,
items: [
{
position: [0, 0],
type: TYPES.SENSOR,
title: 'Temperatur',
subtitle: 'Wohnzimmer',
title: 'Wohnzimmer',
id: 'sensor.temperature_3',
unit: 'C',
state: false,
@ -107,24 +67,11 @@ var PAGE_HUMIDITY = {
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
{
position: [1, 0],
type: TYPES.SENSOR,
title: 'Luftfeuchtigkeit',
subtitle: 'Wohnzimmer',
id: 'sensor.humidity_4',
unit: '%',
state: false,
filter: function (value) { // optional
var num = parseFloat(value);
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
createGauge([1, 0], 'Wohnzimmer', 'humidity_4'),
{
position: [0, 1],
type: TYPES.SENSOR,
title: 'Temperatur',
subtitle: 'Büro',
title: 'Büro',
id: 'sensor.temperature_14',
unit: 'C',
state: false,
@ -133,24 +80,11 @@ var PAGE_HUMIDITY = {
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
{
position: [1, 1],
type: TYPES.SENSOR,
title: 'Luftfeuchtigkeit',
subtitle: 'Büro',
id: 'sensor.humidity_15',
unit: '%',
state: false,
filter: function (value) { // optional
var num = parseFloat(value);
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
{
createGauge([1, 1], 'Büro', 'humidity_15'),
/*{
position: [0, 2],
type: TYPES.SENSOR,
title: 'Temperatur',
subtitle: 'Gästezimmer',
title: 'Gästezimmer',
id: 'sensor.temperature_17',
unit: 'C',
state: false,
@ -159,32 +93,19 @@ var PAGE_HUMIDITY = {
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
{
position: [1, 2],
type: TYPES.SENSOR,
title: 'Luftfeuchtigkeit',
subtitle: 'Gästezimmer',
id: 'sensor.humidity_18',
unit: '%',
state: false,
filter: function (value) { // optional
var num = parseFloat(value);
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
createGauge([1, 2], 'Gästezimmer', 'humidity_18'),*/
]
},
{
title: '',
title: 'Sonstige',
width: 2,
height: 3,
height: 2,
items: [
{
position: [0, 0],
type: TYPES.SENSOR,
title: 'Temperatur',
subtitle: 'Hauswirtschaftsraum',
id: 'sensor.hwr_hygrometer_temperature',
title: 'Hauswirtschaftsraum',
id: 'sensor.hygro_hwr_temperature',
unit: 'C',
state: false,
filter: function (value) { // optional
@ -192,24 +113,11 @@ var PAGE_HUMIDITY = {
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
{
position: [1, 0],
type: TYPES.SENSOR,
title: 'Luftfeuchtigkeit',
subtitle: 'Hauswirtschaftsraum',
id: 'sensor.hwr_hygrometer_humidity',
unit: '%',
state: false,
filter: function (value) { // optional
var num = parseFloat(value);
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
createGauge([1, 0], 'Hauswirtschaftsraum', 'hygro_hwr_humidity'),
{
position: [0, 1],
type: TYPES.SENSOR,
title: 'Temperatur',
subtitle: 'Dachboden',
title: 'Dachboden',
id: 'sensor.attic_temperature_2',
unit: 'C',
state: false,
@ -218,19 +126,7 @@ var PAGE_HUMIDITY = {
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
{
position: [1, 1],
type: TYPES.SENSOR,
title: 'Luftfeuchtigkeit',
subtitle: 'Dachboden',
id: 'sensor.attic_humidity_2',
unit: '%',
state: false,
filter: function (value) { // optional
var num = parseFloat(value);
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
createGauge([1, 1], 'Dachboden', 'attic_humidity_2'),
]
}
]

View File

@ -1,6 +1,6 @@
var PAGE_OVERVIEW = {
title: 'Übersicht',
bg: 'images/bg1.jpeg',
bg: 'images/background.png',
icon: 'mdi-home-outline',
groups: [
{
@ -134,28 +134,7 @@ var PAGE_OVERVIEW = {
return num && !isNaN(num) ? num.toFixed(1) : value;
}
},
{
position: [1, 0],
type: TYPES.GAUGE,
title: 'Luftfeuchtigkeit',
id: 'sensor.humidity_4',
value: function(item, entity) {
num = parseFloat(entity.state);
return num && !isNaN(num) ? num.toFixed(1) : num;
},
settings: {
size: 120,
type: 'arch',
min: 0,
max: 100,
cap: 'round',
thick: 10,
append: '@attributes.unit_of_measurement',
duration: 500,
thresholds: { 0: { color: 'green'}, 66: { color: 'yellow' }, 70: { color: 'red' } },
fractionSize: 1,
},
},
createGauge([1, 0], 'Luftfeuchtigkeit', 'humidity_4'),
{
position: [0, 1],
id: 'media_player.spotify',