Hello
I need the collective knowledge to work out a solution for my node red.
I get a 1 second pulse (state goes to 1) via mqtt when my gas meter has advanced by 0.001 qm.
I now want to see in the dashboard the runtime of the single heating process and the amount of gas needed for this during the day. This can be from 0 to about 10 operations as this is dependent on outside temperature and action in the house....
I have a maria db which I could use but was wondering if I could do this with node red alone.
However, I lack the idea how to determine the start and stop of the heating process.
My first attempts have become so confusing and convoluted that I have lost the overview myself and now have to start over.
How would you approach the problem, has someone already realized a similar one. I have no experience with database queries and shy away from something like this, especially since I have no data in the database to test.
From a S0 gas consumption you will have a hard time to determine (precisely) the start / stop of your gas burner.
Consumption will be pretty easy since you need to just sum the impulses and multiply with 0.001 and some way to reset on a daily basis.
What I have done in a similar situation is to add an energy meter to the system to measure the power in Watt. If the heating is operating, e.g. circulation pumps etc. are running, then you can compare the power to a threshold to determine the run state.
Then SQL something like this (untested) will retrieve the number of ticks per heater event.
You might find it needs tweeking by 1 tick.
SELECT h.heaterid, count(g.id) AS ticks FROM heaterevent h, gasmeterticks g
WHERE h.ontime >= g.timestamp AND h.offtime <= g.ontime AND h.offtime IS NOT NULL
GROUP BY h.heaterid
Thank you
as Sineos already said I am looking for a way to determine the start and end of the operation.
I had tried in my first attempts that if there is no change of status for more than 1 minute to declare it as finished.
But I somehow got lost in the start and stop process so that there were problems when there was a reboot or a network WLAN failure or something with mqtt.
You can work with a time-out value: Determine the minimum frequency of the S0 pulses, e.g. every 20 seconds and send a time-out value if no pulse is received for 25 seconds.
I have worked with this approach on various occasions and even created a small node that does exactly this: node-red-contrib-timeouttrigger (node) - Node-RED (same can be done with the standard trigger node as well just a bit more wires)
You can even use the status node to manage various status along the process (there is an example in the nodes example folder).
My preferred solution is definitively to use some "helper" values, like power consumption etc. to determine this. Maybe your heating even offers some relays or other interfaces that you could use to this end.
Most likely hard to tell. For my gas meter this depends on room temperature, target temperature and outdoor temperature. You can only work with the minimum frequency / maximum gap between the pulses as threshold. Basically when the heating system is "barely" running.
Ok so you have two bits of distinct data to grab and store
Ticks from your Gas Meter
ON/OFF/Running state of your Gas Boiler/Furnace
As the Gas meter is shared (presumably) with all of your gas devices then you have no way of quantifying how much of that useage is from the Gas Heater - you can estimate - but without knowing the consumption rate for various firing levels you can not get too accurate - a number of the solutions above will enabel you to capture and store this information - personally if it was me and you really wanted to know this - i would get an inline gas meter with a hall effect sensor plumbed into the Gas Furnace line
In terms of the gas furnace turning on/off - there will be one of two things that happen
A blower will come on to circulate warm air (assuming it is a gas fire heater) or
A circulating pump will come on to move hot water from the boiler to the Hydronic heating panels/tubing/buffer tank
Either way if the blower/pump is not hardwired but plugs into a socket i would patch into that path - if they are hardwired then you need an electrician (unless you know what you are doing with High Voltage and it is legal to DIY in your country) to put a T into the line to activate a secondary circuit
I would power a Sonoff/Shelly device (with Tasmota) from this secondary circuit - every time it started up it will send an Alive message to your MQTT broker - in Node Red you can grab this and then set a trigger to reset every 5 seconds - when it does not hear from the Sonoff you can then assume it has powered back off - pretty easy calculation to perform at that point for elapsed runtime.
You can use the Teleperiod command in Tasmota to tell the device how often to report its status - so this can be set as low as you want to a minimum of 1 second.