[{"id":"c787281f.74e0d8","type":"tab","label":"Stromzähler","disabled":false,"info":""},{"id":"f7ce84ed.37bb98","type":"debug","z":"c787281f.74e0d8","name":"smartmeter","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":570,"y":140,"wires":[]},{"id":"8893a714.038598","type":"mqtt in","z":"c787281f.74e0d8","name":"","topic":"smartmeter","qos":"2","datatype":"auto","broker":"661ef6c0.9862c8","nl":false,"rap":true,"rh":0,"x":310,"y":200,"wires":[["f7ce84ed.37bb98","6dd1b1e1.a7a08"]]},{"id":"bce62462.8f74b8","type":"mysql","z":"c787281f.74e0d8","mydb":"dfedc41f.024908","name":"MariaDB[Test]","x":760,"y":200,"wires":[["e83fead6.1278f8"]]},{"id":"e83fead6.1278f8","type":"function","z":"c787281f.74e0d8","name":"Insert","func":"msg.letzterWert = msg.payload[0].wert;\nmsg.topic = \"\";\nif (msg.neuerWert > msg.letzterWert && msg.neuerWert < msg.letzterWert * 2) {\n    msg.topic = \"INSERT INTO Messwert2(wert) VALUES ('\"+msg.neuerWert +\"');\";\n    return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":300,"wires":[["215a35eb.e74dba"]]},{"id":"6dd1b1e1.a7a08","type":"function","z":"c787281f.74e0d8","name":"Abfrage","func":"msg.neuerWert = msg.payload;\nmsg.topic = \"SELECT wert FROM Messwert2 ORDER BY zeit DESC LIMIT 1;\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":200,"wires":[["bce62462.8f74b8"]]},{"id":"215a35eb.e74dba","type":"mysql","z":"c787281f.74e0d8","mydb":"dfedc41f.024908","name":"MariaDB[Test]","x":760,"y":300,"wires":[["41aafba1.90e274"]]},{"id":"383b0cad.e75764","type":"comment","z":"c787281f.74e0d8","name":"Plausibilitätsprüfung","info":"# Neuen Wert mit letztem Wert vergleichen.\nFalls neuer Wert < letzter Wert oder neuer Wert > letzter Wert * 2: VERWERFEN","x":330,"y":120,"wires":[]},{"id":"41aafba1.90e274","type":"function","z":"c787281f.74e0d8","name":"Abfrage","func":"msg.neuerWert = msg.payload;\nmsg.topic = \"SELECT wert FROM Messwert2 ORDER BY zeit DESC LIMIT 1;\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":380,"wires":[["b93dd8ce.16f098"]]},{"id":"b93dd8ce.16f098","type":"mysql","z":"c787281f.74e0d8","mydb":"dfedc41f.024908","name":"MariaDB[Test]","x":760,"y":380,"wires":[["ac879fab.637c9"]]},{"id":"49856b23.6bc074","type":"ui_numeric","z":"c787281f.74e0d8","name":"","label":"Gesamtverbrauch [kWh]:","tooltip":"Letzter gemessener Zählstand","group":"f767f57e.fafca8","order":2,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"topic","topicType":"msg","format":"{{value}}","min":0,"max":10,"step":1,"x":1110,"y":420,"wires":[[]]},{"id":"99d60078.bca59","type":"debug","z":"c787281f.74e0d8","name":"output","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1050,"y":480,"wires":[]},{"id":"ac879fab.637c9","type":"change","z":"c787281f.74e0d8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0].wert","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":480,"wires":[["49856b23.6bc074","99d60078.bca59"]]},{"id":"e311af7a.c55cf","type":"comment","z":"c787281f.74e0d8","name":"Dashboard Ideen Hr. Klehn","info":"Ideen für Dashboard:\n- Durchschnittlicher Tageswert vom letzten Monat\n- Letzte Woche\n- Letzte Woche jeden Tag","x":1110,"y":360,"wires":[]},{"id":"661ef6c0.9862c8","type":"mqtt-broker","name":"RaspberryBroker","broker":"192.168.0.12","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"log","birthQos":"0","birthPayload":"ONLINE","birthMsg":{},"closeTopic":"log","closeQos":"0","closePayload":"OFFLINE","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"dfedc41f.024908","type":"MySQLdatabase","name":"","host":"localhost","port":"3306","db":"Test","tz":"","charset":"UTF8"},{"id":"f767f57e.fafca8","type":"ui_group","name":"Standard","tab":"8bfe23ff.a6f95","order":1,"disp":true,"width":"6","collapse":false},{"id":"8bfe23ff.a6f95","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]