-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsenseguardhistory.json
1 lines (1 loc) · 6.03 KB
/
senseguardhistory.json
1
[{"id":"ed7589d527fde314","type":"grohe sense","z":"3a763adab0a2a52d","location":"dd73ac27fcefb839","room":"Wasserkeller","appliance":"SenseGuard","devicetype":"103","description":"","x":410,"y":120,"wires":[["1c805198756f32e4","8bd5c1954b70c692"]]},{"id":"c478c1d3715264d5","type":"function","z":"3a763adab0a2a52d","name":"data","func":"let end = new Date();\nlet start = new Date();\nstart.setDate(end.getDate() - 4); // last 7 days.\n\nmsg.payload = {\n data : {\n from : start,\n to : end,\n groupBy: 'hour'\n }\n}\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":250,"y":120,"wires":[["ed7589d527fde314"]]},{"id":"8c577a27b2846c21","type":"inject","z":"3a763adab0a2a52d","name":"get data","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":120,"wires":[["c478c1d3715264d5"]]},{"id":"7c48a090670f1d7c","type":"ui_chart","z":"3a763adab0a2a52d","name":"","group":"c3c1f58f8122f797","order":3,"width":"0","height":"0","label":"Temperature","chartType":"line","legend":"false","xformat":"auto","interpolate":"step","nodata":"","dot":false,"ymin":"0","ymax":"30","removeOlder":"7","removeOlderPoints":"1000","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#b31e1e","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":770,"y":80,"wires":[[]]},{"id":"1c805198756f32e4","type":"function","z":"3a763adab0a2a52d","name":"measurement","func":"if (msg.payload.data){\n let measurement = msg.payload.data.measurement;\n\n let temperatureData = [];\n let pressureData = [];\n let flowrateData = [];\n\n for (const item of measurement) {\n let date = new Date(item.date);\n var timestamp = date; //Math.floor(date.getTime() / 1000); // unix\n\n let temperaturePoint = {\n x : timestamp,\n y: item.temperature_guard\n };\n temperatureData.push(temperaturePoint);\n\n let pressurePoint = {\n x: timestamp,\n y: item.pressure\n };\n pressureData.push(pressurePoint);\n\n let flowratePoint = {\n x: timestamp,\n y: item.flowrate\n };\n flowrateData.push(flowratePoint);\n }\n\n let msg1 = { \n payload : [{\n series: [\"Temperature\"],\n data: [temperatureData],\n labels: [\"SenseGuard\"]\n }]\n };\n\n let msg2 = {\n payload: [{\n series: [\"Pressure\"],\n data: [pressureData],\n labels: [\"SenseGuard\"]\n }]\n };\n\n let msg3 = {\n payload: [{\n series: [\"Flowrate\"],\n data: [flowrateData],\n labels: [\"SenseGuard\"]\n }]\n };\n\n let msgs = [msg1, msg2, msg3];\n return msgs;\n}\n","outputs":3,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":600,"y":120,"wires":[["7c48a090670f1d7c"],["d3bf5c1c5a788794"],["388db5f93031978b"]]},{"id":"d3bf5c1c5a788794","type":"ui_chart","z":"3a763adab0a2a52d","name":"","group":"c3c1f58f8122f797","order":3,"width":"0","height":"0","label":"Pressure","chartType":"line","legend":"false","xformat":"auto","interpolate":"step","nodata":"","dot":false,"ymin":"0","ymax":"10","removeOlder":"24","removeOlderPoints":"1000","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":760,"y":120,"wires":[[]]},{"id":"388db5f93031978b","type":"ui_chart","z":"3a763adab0a2a52d","name":"","group":"c3c1f58f8122f797","order":3,"width":"0","height":"0","label":"Flowrate","chartType":"line","legend":"false","xformat":"auto","interpolate":"step","nodata":"","dot":false,"ymin":"0","ymax":"20","removeOlder":"24","removeOlderPoints":"1000","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1eb328","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":760,"y":160,"wires":[[]]},{"id":"8bd5c1954b70c692","type":"function","z":"3a763adab0a2a52d","name":"withdrawals","func":"if (msg.payload.data){\n let withdrawals = msg.payload.data.withdrawals;\n\n let waterconsumptionData = [];\n // TODO: hotwater_share, hotwater_share, water_cost, energy_cost\n\n for (const item of withdrawals) {\n let date = new Date(item.date);\n \n let waterconsumptionPoint1 = {\n x: date,\n y: item.waterconsumption\n };\n\n waterconsumptionData.push(waterconsumptionPoint1);\n }\n\n let msg1 = { \n payload : [{\n series: [\"Water Consumption\"],\n data: [waterconsumptionData],\n labels: [\"SenseGuard\"]\n }]\n };\n\n\n let msgs = [msg1];\n return msgs;\n}\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":220,"wires":[["b0b2b52ac3d0bf14"]]},{"id":"b0b2b52ac3d0bf14","type":"ui_chart","z":"3a763adab0a2a52d","name":"","group":"c3c1f58f8122f797","order":3,"width":"0","height":"0","label":"Water Consumption","chartType":"line","legend":"false","xformat":"auto","interpolate":"step","nodata":"","dot":true,"ymin":"0","ymax":"250","removeOlder":"7","removeOlderPoints":"10000","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1e30b3","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":790,"y":240,"wires":[[]]},{"id":"dd73ac27fcefb839","type":"grohe location","location":"Haus"},{"id":"c3c1f58f8122f797","type":"ui_group","name":"SenseGuard History","tab":"933900f0656633c1","order":4,"disp":true,"width":"13","collapse":false,"className":""},{"id":"933900f0656633c1","type":"ui_tab","name":"Grohe","icon":"fa-tint","disabled":false,"hidden":false}]