Utility metering (city gas supply) on HASO using Node-RED, MQTT and Zigbee device

Guys,
finally my RB Pi4 with HASO is working and i can see the dashboard. I have managed to make zigbee gate running so i can see temperature and humidity in my garrage. The next step is to use SONOFF Door/Window sensor and modify it to provide pulses everytime my gas meter count 1 cubic meter of gas. The meter has a special place to put a reid switch. Of course one can not modify the device so i bought original reid switch snap on accessory so now every time 0.1 m3 counter drum make a full turn one of the magnets is giving close contact pulse. This i want to solder to SONOFF Door switch module and then modify HASO/entity/NodeRED (pick the right one as i don’t know yet what to be modified…:(). The thing is i’d like to se on my dashboard the following info regarding gas meter:

  1. m3 used today
  2. m3 used this week
  3. m3 used this month
  4. calculations to convert m3 to money
  5. history trend showing gas usage.

Ideally i’d like to use NodeRED to receive MQTT message from SONOFF that reid switch stated changed and base on that update some system variable containing gas consumption. But then how to divide it and make stats for daily, weekly, monthly usage data presentation. On the same trend i’d like to put external temperature as well to see corelation between the numbers. Do we have ready-to-use NodeRED node that basically is doing the math for this type of utility meters data? The next thing is Influxdb and Grafana integration. Please direct me as i spent so much time with no luck. Thank you.

Any ideas? Do you guys know and ready to use node in NodeRED that can be used to create gas meter entity?