If you want to show the sum of 2 values you can do it as follows:
Define a block. Something like:
Code: Select all
blocks['combined'] = {
title: 'combined',
idx: '3934_1',
value: 'test',
unit:''
}
Then in custom.js add the following:
Code: Select all
var val1=0;
var val2=0;
function updateBlock() {
// console.log(val1, val2);
Dashticz.setBlock('combined', {
value: ''+(val1+val2)+' kWh'
});
}
function deviceHook(device) {
if (device.idx==3934) {
val1=parseFloat(device.Data0);
updateBlock();
}
if (device.idx==6022) {
val2=parseFloat(device.Data0);
updateBlock();
}
}
If you want to show both values (on one line), change custom.js to:
Code: Select all
var val1=0;
var val2=0;
function updateBlock() {
Dashticz.setBlock('combined', { //Example how to redefine another block
value: val1+' '+val2+' kWh'
});
}
function deviceHook(device) {
if (device.idx==3934) {
val1=device.Data0;
updateBlock();
}
if (device.idx==6022) {
val2=device.Data0;
updateBlock();
}
}