Power and usage reading strange value

  • Dear all,


    Is there perhaps some that have a good working flow or something to read the power and the usage from a shelly.

    I see some plugins, they say no accurate readings.

    I use two flows and very very strange value..


    Node red:

    Code
    [{"id":"be902481.2a6448","type":"tab","label":"WP Shelly Power","disabled":false,"info":""},{"id":"9d9cc95f.8db9e8","type":"mqtt in","z":"be902481.2a6448","name":"","topic":"shellies/Shelly-Warmtepomp-25-C48DB3/relay/0/power","qos":"2","datatype":"json","broker":"431d199a.2afdf8","x":200,"y":160,"wires":[["b955eed5.75194"]]},{"id":"96e4cdc0.eec47","type":"debug","z":"be902481.2a6448","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1130,"y":160,"wires":[]},{"id":"6bfda6c1.9f51d8","type":"mqtt out","z":"be902481.2a6448","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"f6628dbd.b9935","x":1150,"y":100,"wires":[]},{"id":"204e7cbb.33d7b4","type":"mqtt in","z":"be902481.2a6448","name":"","topic":"shellies/Shelly-Warmtepomp-25-C48DB3/relay/0/energy","qos":"2","datatype":"json","broker":"f6628dbd.b9935","x":200,"y":100,"wires":[["c8cf6abf.2bf2b8"]]},{"id":"8cb89a55.a0f8d8","type":"function","z":"be902481.2a6448","name":"Filter","func":"var watt = parseInt(msg.payload.power)\n\nvar kw = msg.payload.energy \nvar sval = watt.toString() + \";\" + kw.toString()\n\nmsg.payload = { \n \"idx\" :13501,\n \"nvalue\" :0,\n \"svalue\" :sval\n \n}\nreturn msg;","outputs":1,"noerr":0,"x":910,"y":100,"wires":[["6bfda6c1.9f51d8","96e4cdc0.eec47"]]},{"id":"1b0dda24.8f42d6","type":"join","z":"be902481.2a6448","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":670,"y":100,"wires":[["26b387be.7e0378"]]},{"id":"c8cf6abf.2bf2b8","type":"function","z":"be902481.2a6448","name":"","func":"msg.topic = \"energy\"\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":100,"wires":[["1b0dda24.8f42d6"]]},{"id":"b955eed5.75194","type":"function","z":"be902481.2a6448","name":"","func":"msg.topic = \"power\"\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":160,"wires":[["1b0dda24.8f42d6"]]},{"id":"8fa38b68.437928","type":"comment","z":"be902481.2a6448","d":true,"name":"Warmtepomp Shelly 2.5 in de bijkeuken","info":"","x":590,"y":60,"wires":[]},{"id":"26b387be.7e0378","type":"delay","z":"be902481.2a6448","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":800,"y":160,"wires":[["8cb89a55.a0f8d8"]]},{"id":"366dc1a6.0169de","type":"mqtt in","z":"be902481.2a6448","name":"","topic":"shellies/Shelly-Keuken-25-C4FB16/relay/1/power","qos":"2","datatype":"json","broker":"431d199a.2afdf8","x":180,"y":340,"wires":[["e9755c4a.0024f"]]},{"id":"151caaea.742415","type":"debug","z":"be902481.2a6448","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1150,"y":340,"wires":[]},{"id":"529184d.ab9c57c","type":"mqtt out","z":"be902481.2a6448","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"f6628dbd.b9935","x":1150,"y":280,"wires":[]},{"id":"733674c6.94667c","type":"mqtt in","z":"be902481.2a6448","name":"","topic":"shellies/Shelly-Keuken-25-C4FB16/relay/1/energy","qos":"2","datatype":"json","broker":"f6628dbd.b9935","x":180,"y":280,"wires":[["b72f04c7.7bede8"]]},{"id":"ae1813b0.60704","type":"function","z":"be902481.2a6448","name":"Filter","func":"var watt = parseInt(msg.payload.power)\n\nvar kw = msg.payload.energy \nvar sval = watt.toString() + \";\" + kw.toString()\n\nmsg.payload = { \n \"idx\" :13500,\n \"nvalue\" :0,\n \"svalue\" :sval\n \n}\nreturn msg;","outputs":1,"noerr":0,"x":910,"y":280,"wires":[["529184d.ab9c57c","151caaea.742415"]]},{"id":"7aaef34f.87460c","type":"join","z":"be902481.2a6448","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":670,"y":280,"wires":[["8cb99172.897c7"]]},{"id":"b72f04c7.7bede8","type":"function","z":"be902481.2a6448","name":"","func":"msg.topic = \"energy\"\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":280,"wires":[["7aaef34f.87460c"]]},{"id":"e9755c4a.0024f","type":"function","z":"be902481.2a6448","name":"","func":"msg.topic = \"power\"\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":340,"wires":[["7aaef34f.87460c"]]},{"id":"fcaea9b9.930b08","type":"comment","z":"be902481.2a6448","d":true,"name":"Keuken: Aanrecht Shelly 2.5 ","info":"","x":560,"y":240,"wires":[]},{"id":"8cb99172.897c7","type":"delay","z":"be902481.2a6448","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":800,"y":340,"wires":[["ae1813b0.60704"]]},{"id":"431d199a.2afdf8","type":"mqtt-broker","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":15,"cleansession":true,"birthQos":"0","willQos":"0"},{"id":"f6628dbd.b9935","type":"mqtt-broker","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":15,"cleansession":true,"birthQos":"0","willQos":"0"}]



    And a other flow:

    Code
    [{"id":"3a35ccf9.639e84","type":"tab","label":"TEst Flow 1","disabled":true,"info":""},{"id":"9ddcc33d.7eea6","type":"mqtt in","z":"3a35ccf9.639e84","name":"Energy","topic":"shellies/Shelly-Warmtepomp-25-C48DB3/relay/0/energy","qos":"2","datatype":"json","broker":"16f4f882.1d4c57","x":150,"y":120,"wires":[["983ae345.00171","3079426e.95358e"]]},{"id":"6646efdd.121c","type":"mqtt in","z":"3a35ccf9.639e84","name":"Power","topic":"shellies/Shelly-Warmtepomp-25-C48DB3/relay/0/power","qos":"2","datatype":"json","broker":"15a65981.63a046","x":150,"y":180,"wires":[["983ae345.00171","9ea1752b.49a3a8"]]},{"id":"52b55353.0b4f6c","type":"inject","z":"3a35ccf9.639e84","name":"Inject Energy","topic":"shellies/Shelly-Warmtepomp-25-C48DB3/relay/0/energy","payload":"336743","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":60,"wires":[["983ae345.00171"]]},{"id":"af02f1f6.73e2a","type":"inject","z":"3a35ccf9.639e84","name":"Inject Power","topic":"shellies/Shelly-Warmtepomp-25-C48DB3/relay/0/power","payload":"20.07","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":240,"wires":[["983ae345.00171"]]},{"id":"a4d7a389.483f5","type":"function","z":"3a35ccf9.639e84","name":"","func":"var power = {};\nvar energy = {};\nif (msg.topic == \"shellies/Shelly-Warmtepomp-25-C48DB3/relay/0/power\") {\n power = msg.payload[1].toString();\n energy = msg.payload[0].toString();\n}\nif (msg.topic == \"shellies/Shelly-Warmtepomp-25-C48DB3/relay/0/energy\") {\n power = msg.payload[0].toString(); \n energy = msg.payload[1].toString();\n}\nmsg.payload = {\"command\":\"udevice\",\"idx\":13511,\"nvalue\":0,\"svalue\":power + \";\" + energy};\nreturn msg;","outputs":1,"noerr":0,"x":710,"y":160,"wires":[["efa41c13.56722","8c1110cf.4ba3d"]]},{"id":"9ea1752b.49a3a8","type":"debug","z":"3a35ccf9.639e84","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":410,"y":240,"wires":[]},{"id":"983ae345.00171","type":"join","z":"3a35ccf9.639e84","name":"Merge Power and Energy","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":370,"y":146,"wires":[["30945ea3.6fcce2"]]},{"id":"3079426e.95358e","type":"debug","z":"3a35ccf9.639e84","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":610,"y":100,"wires":[]},{"id":"efa41c13.56722","type":"mqtt out","z":"3a35ccf9.639e84","name":"","topic":"domoticz/in","qos":"1","retain":"","broker":"f6628dbd.b9935","x":910,"y":160,"wires":[]},{"id":"8c1110cf.4ba3d","type":"debug","z":"3a35ccf9.639e84","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":910,"y":220,"wires":[]},{"id":"30945ea3.6fcce2","type":"delay","z":"3a35ccf9.639e84","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":560,"y":200,"wires":[["a4d7a389.483f5"]]},{"id":"16f4f882.1d4c57","type":"mqtt-broker","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":15,"cleansession":true,"birthQos":"0","willQos":"0"},{"id":"15a65981.63a046","type":"mqtt-broker","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":15,"cleansession":true,"birthQos":"0","willQos":"0"},{"id":"f6628dbd.b9935","type":"mqtt-broker","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":15,"cleansession":true,"birthQos":"0","willQos":"0"}]


    And a plugin that says no good reading:

    ScreenShot182.png



    So i hope some can help me to make the good power reading working..