You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Visualization of energy matrix data of Vitocal 250
Vitocal provides energy data on a daily and monthly basis. You can view using ViCare App, but data is also available via data points within e3oncan adapter. I created a eChart based in those data points. To create your own matrix charts follow these steps:
Install adapter flexcharts
Adapter is available in Beta-Repository of ioBroker:
Concept and functionality of adapter is described here.
Create a new script within javascript adapter of ioBroker
Name of script doesn't matter. Copy following content to the script:
const baseVcal = 'e3oncan.0.HPMUMASTER_0x680'; // State base for E3 device Vitocal. Pls. adapt if neccessary! Default: 'e3oncan.0.HPMUMASTER_0x680'
const chartsDict = { vitocalenergymatrix: { func: vitocalEnergyMatrix }
};
onMessage('vitocharts', (data, callback) => {
// Waiting for messages "vitocharts". Will be sent by adapter flexcharts.
const chart = data.chart;
const params = (data.params ? JSON.parse(data.params) : {} );
if (chart in chartsDict) {
chartsDict[chart].func(params, callback);
} else {
demoChart(callback);
}
});
// Vitocal Energy Matrix Data:
// ===========================
function vitocalEnergyMatrix(params, callback) {
function doChart(data, params, callback) {
var option = {
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
legend: { },
title: { },
toolbox: { feature: { dataZoom: { yAxisIndex: 'none' }, restore: {}, saveAsImage: {} } },
xAxis: { type: 'time', max: 'dataMax' },
yAxis: [{ type: 'value', position: 'left', name: 'energy (kWh)', alignTicks: true, axisLine: { show: true } },
{ type: 'value', position: 'right', name: 'scop', min: 0, max: 6, axisLine: { show: true, lineStyle: { color: '#0000ff' }}}],
dataZoom: [{ type: 'inside', start: data['dataZoom'], end: 100 }, { start: data['dataZoom'], end: 100 }],
series: [
{ name: 'DHW el.', type: 'bar', yAxisIndex: 0, color: '#00a300', stack: "Consumption", data: data['EnergyConsumptionDomesticHotWater']},
{ name: 'Heating el.', type: 'bar', yAxisIndex: 0, color: '#00ff00', stack: "Consumption", data: data['EnergyConsumptionCentralHeating']},
{ name: 'DHW th.', type: 'bar', yAxisIndex: 0, color: '#a30000', stack: "Generated", data: data['GeneratedDomesticHotWaterOutput']},
{ name: 'Heating th.', type: 'bar', yAxisIndex: 0, color: '#ff3333', stack: "Generated", data: data['GeneratedCentralHeatingOutput']},
{ name: SCOPS.scop.name, type: 'scatter', symbolSize: SCOPS.scop.size, yAxisIndex: 1, color: SCOPS.scop.col, data: data[SCOPS.scop.name]},
{ name: SCOPS.scopDHW.name, type: 'scatter', symbolSize: SCOPS.scopDHW.size, yAxisIndex: 1, color: SCOPS.scopDHW.col, data: data[SCOPS.scopDHW.name]},
{ name: SCOPS.scopHt.name, type: 'scatter', symbolSize: SCOPS.scopHt.size, yAxisIndex: 1, color: SCOPS.scopHt.col, data: data[SCOPS.scopHt.name]}
]
};
callback(option);
}
const STRUCTURE = { daily: [{prefix: 'LastMonth', zoom: 0, start:{ year: 0, month: -1, day: 0}, adder:{ year: 0, month: 0, day: 1}},
{prefix: 'CurrentMonth', zoom: 0, start:{ year: 0, month: 0, day: 0}, adder:{ year: 0, month: 0, day: 1}}],
monthly: [{prefix: 'LastYear', zoom: 0, start:{ year: -1, month: 0, day: 0}, adder:{ year: 0, month: 1, day: 0}},
{prefix: 'CurrentYear', zoom: 0, start:{ year: 0, month: 0, day: 0}, adder:{ year: 0, month: 1, day: 0}}]};
const IDS = { daily: [
[baseVcal+'.json.1294_EnergyConsumptionCentralHeatingMonthMatrix','EnergyConsumptionCentralHeating'],
[baseVcal+'.json.1311_EnergyConsumptionDomesticHotWaterMonthMatrix','EnergyConsumptionDomesticHotWater'],
[baseVcal+'.json.1315_GeneratedCentralHeatingOutputMonthMatrix','GeneratedCentralHeatingOutput'],
[baseVcal+'.json.1392_GeneratedDomesticHotWaterOutputMonthMatrix','GeneratedDomesticHotWaterOutput']
],
monthly: [
[baseVcal+'.json.1316_EnergyConsumptionCentralHeatingYearMatrix','EnergyConsumptionCentralHeating'],
[baseVcal+'.json.1333_EnergyConsumptionDomesticHotWaterYearMatrix','EnergyConsumptionDomesticHotWater'],
[baseVcal+'.json.1337_GeneratedCentralHeatingOutputYearMatrix','GeneratedCentralHeatingOutput'],
[baseVcal+'.json.1393_GeneratedDomesticHotWaterOutputYearMatrix','GeneratedDomesticHotWaterOutput']
]};
const period = (((params.period) && (params.period in IDS)) ? params.period : 'daily'); // Default: Daily chart if parameter 'period' is invalid or missing
const structDict = STRUCTURE[period];
const ids = IDS[period];
const SCOPS ={
scop: {num: [2,3], denom: [0,1], name: 'scopTotal', col: '#0000ff', size: 7}, // scop total
scopHt: {num: [2], denom: [0], name: 'scopHeating', col: '#ff3333', size: 5}, // scop Heating only
scopDHW: {num: [3], denom: [1], name: 'scopDHW', col: '#a30000', size: 5} // scop DHW only
};
const dataDict = { cnt: 0, dataZoom: structDict.zoom };
const now = new Date();
const tStop = new Date(now.getFullYear(), now.getMonth(), now.getDate()+1);
for (const info of Object.values(structDict)) {
var tStart;
if (info.prefix.includes('Month')) {
tStart = new Date(now.getFullYear()+info.start.year, now.getMonth()+info.start.month, 1+info.start.day);
} else {
tStart = new Date(now.getFullYear()+info.start.year, 0+info.start.month, 1+info.start.day);
}
// Collect data for DHW and Heating
for (const id of Object.values(ids)) {
const vals = JSON.parse(getState(id[0]).val);
if (!(id[1] in dataDict)) dataDict[id[1]] = [];
for (const key of Object.keys(vals[info.prefix])) {
const i = Number(key.slice(0,2))-1; // Index dor daily or monthly data
const t = new Date(tStart.getFullYear()+info.adder.year*i, tStart.getMonth()+info.adder.month*i, tStart.getDate()+info.adder.day*i);
if (t.getTime() < tStop.getTime()) {
dataDict[id[1]].push([t.getTime(), vals[info.prefix][key]]);
dataDict.cnt++;
}
}
}
// Calculate scop values:
for (const scop of Object.values(SCOPS)) {
const nums = [];
const denoms = [];
for (var i=0;i<scop.num.length;i++) {
nums.push(JSON.parse(getState(ids[scop.num[i]][0]).val)[info.prefix]);
denoms.push(JSON.parse(getState(ids[scop.denom[i]][0]).val)[info.prefix]);
}
const scops = {};
for (const key of Object.keys(nums[0])) {
var num = 0.0;
var denom = 0.0;
for (var i=0;i<nums.length;i++) {
num += nums[i][key];
denom += denoms[i][key];
}
if (denom != 0.0) {
scops[key] = Math.round(100*num/denom)/100;
}
}
if (!(scop.name in dataDict)) dataDict[scop.name] = [];
for (const key of Object.keys(scops)) {
const i = Number(key.slice(0,2))-1; // Index dor daily or monthly data
const t = new Date(tStart.getFullYear()+info.adder.year*i, tStart.getMonth()+info.adder.month*i, tStart.getDate()+info.adder.day*i);
if (t.getTime() < tStop.getTime()) {
dataDict[scop.name].push([t.getTime(), scops[key]]);
dataDict.cnt++;
}
}
}
}
doChart(dataDict, params, callback);
}
// Demo chart as fall back for unkown chart requirement:
function demoChart(callback) {
const data = [];
for (let i = 0; i <= 100; i++) { let theta = (i / 100) * 360; let r = 5 * (1 + Math.sin((theta / 180) * Math.PI)); data.push([r, theta]); }
const option = {
title: { text: 'Demo Chart: Two Value-Axes in Polar' },
legend: { data: ['line'] },
polar: {},
tooltip: { trigger: 'axis',axisPointer: { type: 'cross' } }, angleAxis: { type: 'value', startAngle: 0 },
radiusAxis: {},
series: [ { coordinateSystem: 'polar', name: 'line', type: 'line', data: data } ]
};
callback(option);
}
Check value of constant baseVcal - may be different in your configuration of e3oncan adapter.
Check values of constant IDS - possibly your Vitocal uses different data points.
Start the script. If you're using more than one javascript instance, assign the script to instance javascript.0
Make sure, adapter e3oncan is reading data points 1294, 1311, 1315, 1316, 1333, 1337, 1392, 1393
Now open a new browser tab and try following addresses (replace localhost with address of your ioBroker host)
For daily data: https://localhost:8082/flexcharts/echarts.html?source=script&message=vitocharts&chart=vitocalenergymatrix¶ms={"period":"daily"}
For monthly data: https://localhost:8082/flexcharts/echarts.html?source=script&message=vitocharts&chart=vitocalenergymatrix¶ms={"period":"monthly"}
eCharts should show up. You may of course use those addresses also with iFrames in vis or jarvis.
Visualization of refrigeration cycle of Vitocal 250
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Visualization of energy matrix data of Vitocal 250
Vitocal provides energy data on a daily and monthly basis. You can view using ViCare App, but data is also available via data points within e3oncan adapter. I created a eChart based in those data points. To create your own matrix charts follow these steps:
Install adapter flexcharts
Adapter is available in Beta-Repository of ioBroker:
Concept and functionality of adapter is described here.
Create a new script within javascript adapter of ioBroker
baseVcal
- may be different in your configuration of e3oncan adapter.IDS
- possibly your Vitocal uses different data points.Now open a new browser tab and try following addresses (replace
localhost
with address of your ioBroker host)https://localhost:8082/flexcharts/echarts.html?source=script&message=vitocharts&chart=vitocalenergymatrix¶ms={"period":"daily"}
https://localhost:8082/flexcharts/echarts.html?source=script&message=vitocharts&chart=vitocalenergymatrix¶ms={"period":"monthly"}
eCharts should show up. You may of course use those addresses also with iFrames in vis or jarvis.
Visualization of refrigeration cycle of Vitocal 250
Please refer to https://github.com/MyHomeMyData/iob.vis.vitocal250
Beta Was this translation helpful? Give feedback.
All reactions