Hi
I'm trying to set-up a energy dashboard based on modbus-energy meters. My goal is to have the energy-consumption (kWh) displayed in the dashbaord and the possibility to reset this value to zero by pressing a button. I was able to create a solution based on a "context.global" variable and many many nodes... However I'm convinced there must by a very simple solution.
[{"id":"c510b3456e9827d8","type":"inject","z":"4b82e3cc342b356d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":310,"y":760,"wires":[["d5d5effccc369269"]]},{"id":"3c3390e38f48baeb","type":"ui_button","z":"4b82e3cc342b356d","name":"","group":"546cf34f3a19d849","order":8,"width":0,"height":0,"passthru":false,"label":"Reset","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"[]","payloadType":"str","topic":"topic","topicType":"msg","x":490,"y":840,"wires":[["d5d5effccc369269"]]},{"id":"d5d5effccc369269","type":"ui_text","z":"4b82e3cc342b356d","group":"546cf34f3a19d849","order":7,"width":0,"height":0,"name":"","label":"Energy (kWh)","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":780,"y":760,"wires":[]},{"id":"546cf34f3a19d849","type":"ui_group","name":"Test","tab":"5ba44142e5a211e2","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"5ba44142e5a211e2","type":"ui_tab","name":"Test","icon":"dashboard","disabled":false,"hidden":false}]
The inject-node (timestamp) is a "simulator" for the energy-values (modbus + buffer parser). I'm looking for a function or other node in the red marked area, which saves the current energy-value when reset is pressed (e.g. in a context.global variable). Output should be "actual value" minus "stored context.global value".
Reseting the energy-meter is not what I want.