-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
sensehistory.json
1 lines (1 loc) · 3.53 KB
/
sensehistory.json
1
[{"id":"f2d67eb619de6923","type":"grohe sense","z":"3a763adab0a2a52d","location":"dd73ac27fcefb839","room":"Wasserkeller","appliance":"Sense3","devicetype":"101","description":"","x":400,"y":380,"wires":[["667715029d9d7a62"]]},{"id":"e3aeb6fbe42726b5","type":"function","z":"3a763adab0a2a52d","name":"data","func":"let now = Date.now();\nlet end = now;\nlet start = now - 7 * 24 * 60 * 60000;\n\nmsg.payload = {\n data : {\n from : start,\n to : end\n }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":250,"y":380,"wires":[["f2d67eb619de6923"]]},{"id":"d76b31949d238dd4","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":380,"wires":[["e3aeb6fbe42726b5"]]},{"id":"a17c1fe18eb715c2","type":"ui_chart","z":"3a763adab0a2a52d","name":"","group":"d3ce60f5352fb0db","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":360,"wires":[[]]},{"id":"667715029d9d7a62","type":"function","z":"3a763adab0a2a52d","name":"convert","func":"if (msg.payload.data){\n let measurement = msg.payload.data.measurement;\n\n let temperatureData = [];\n let humidityData = [];\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\n };\n temperatureData.push(temperaturePoint);\n\n let humidityPoint = {\n x: timestamp,\n y: item.humidity\n };\n humidityData.push(humidityPoint);\n }\n\n let msg1 = { \n payload : [{\n series: [\"Temperature\"],\n data: [temperatureData],\n labels : [\"Sense3\"]\n }]\n };\n\n let msg2 = {\n payload: [{\n series: [\"Humidity\"],\n data: [humidityData],\n labels: [\"Sense3\"]\n }]\n };\n let msgs = [msg1, msg2];\n return msgs;\n}\n","outputs":2,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":380,"wires":[["a17c1fe18eb715c2"],["9e24b8c267907218"]]},{"id":"9e24b8c267907218","type":"ui_chart","z":"3a763adab0a2a52d","name":"","group":"d3ce60f5352fb0db","order":3,"width":"0","height":"0","label":"Humidity","chartType":"line","legend":"false","xformat":"auto","interpolate":"step","nodata":"","dot":false,"ymin":"0","ymax":"100","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":400,"wires":[[]]},{"id":"dd73ac27fcefb839","type":"grohe location","location":"Haus"},{"id":"d3ce60f5352fb0db","type":"ui_group","name":"Sense History","tab":"933900f0656633c1","order":3,"disp":true,"width":"6","collapse":false,"className":""},{"id":"933900f0656633c1","type":"ui_tab","name":"Grohe","icon":"fa-tint","disabled":false,"hidden":false}]