Running total of minutes boiler is making heat

I would like to total the number of minutes a boiler/furnace is running on a daily, weekly and monthly basis. Correlating the number of minutes running with the number of gallons of fuel used will give me something (not sure what, but definetly data).

I have a bunch of locations, some set up differently from each other.

Some have an oil or propane boiler/furnace and some use electric (either heat pump or pure resistive).

Some have Ecobee thermostats, one has LG tstats, some have dumb line voltage tstats.

Some have a temperature sensor right at the boiler/furnate so I can know with certainty if the boiler is making heat, rather than rely solely on a tstat reporting that it is calling for heat (sometimes boilers fail mechanically, electrically or just run out of fuel).

Here is an example:

Location 630 has a propane fed furnace with Ecobee tstat and Sonoff THR316 temp sensor right at the furnace:

I have these sensors in HA:

1)   - binary_sensor:
	 - name: 630 Heat Graph Binary
    	   state: "{{ is_state_attr('climate.630', 'hvac_action','heating') }}"


2)   sensor.thr316_630_boiler_temperature


3)  - sensor:
      - name: "630 Amerigas Tank Percentage"
        state: >
    	  {% set value = states('sensor.multiscrape_amerigas_tank_percentage_raw_3420398') %}
  		    {{ value | replace('%', '') | int }}

      - name: "Propane 630 Gallons"
    	unit_of_measurement: "Gallons"
    	state_class: measurement
    	state: "{{ (states('sensor.630_amerigas_tank_percentage') |float) * 1.20}}"

I have not been able to find a reliable way to remotely monitor oil level in a tank. I tried smart oil gauge and found it very unreliable. I think a float type physical sensor with a way to convert that analog reading to a digital form and then report it would be a good way to go, but I have not found such a thing.

I would like to keep a daily, weekly and monthly total of the number of minutes the boiler is running. Perhaps a test (or condition) that the temperature at the boiler (sensor #2) is above xx degrees to actually accumulate (in addition to the main determinate of the HVAC_ACTION attribute equalling HEATING).

Possible?

Thank you.

Here’s what one of this location’s cards looks like:

I can only answer for the kind of boiler I have for my hydronic baseboard system. In systems like mine, the boiler fires based on a high and low limit. It will fire occasionally to keep the temperature above a lower limit, and it fires whenever a thermostat is calling for heat, up to a higher limit. So I can’t just use the total time a thermostat is calling for heat to estimate the fuel burn.

So I connected a relay (contactor) to the 120VAC (mains) supply to the burner. At first I’d connected the contacts on that relay to a door sensor. I’d removed the reed switch and soldered the wires to the contacts in its place. Later, I went directly to the GPIO pins of the RPi running HA. I’ve also tried it with the GPIO pins of an ESP8266 I plan to use to tidy things up a bit one of these days.

There are a few threads on this forum about doing things like this. Search for “boiler runtime.” One of them I started back in March '21, but the above is the gist of it. There are also some threads on using this value to estimate fuel burn, including one explaining how I did it.

My latest addition was an ultrasonic level sensor in my oil tank. Again, there are some threads here, search “oil tank level sensor.” Mine is similar to this one. I used an ESP8266 instead of an ESP32, and I used an off-the-shelf plumbing fitting which I’d drilled a hole in to hold the JSN-SR04T sensor. I’m finding it’s very accurate in my steel tank, except at very high (full) and low (empty) levels.

One more thing. It sounds like you’re doing this for rental units. Give some consideration to how you are going to track and retain the data. The HA database is pretty efficient for what it does, but it’s not really designed for long-term storage. I save my daily summaries in text (csv) files.

While this is not for a boiler, I use “run time” on multiple entities in my system to determine things like how many hours the furnace filter has been in use, how many hours a humidifier has been in use (and using that with calculations for how much water is left in the tank), how long it’s been since my air quality monitors have been outside to recalibrate, etc.

Most of mine are based on a helper button press (i.e., I just changed the furnace filter, start over or I just refilled the humidifier, start over) and then a sensor that evaluates the time since that button press (which can be triggered via automation or scripts too) with something like this:

Sensor to know if the humidifier is running

binary_sensor:
  - name: "Bedroom Humidifier is Running"
    unique_id: 61e32503-1fc4-4bf2-ab27-67619d21cc2f
    icon: mdi:air-humidifier
    state: >-
      {% set runstate = 'off' %}

      {% if states('humidifier.bedroom') not in ['unknown','unavailable'] and states('switch.bedroom_humidifier_wall_switch') not in ['unknown','unavailable'] %}
        {% if int(states('sensor.bedroom_humidifier_switch_power'), 0) > 5 %}
          {% set runstate = 'on' %}
        {% elif state_attr('humidifier.bedroom', 'action') != 'idle' %}
          {% set runstate = 'on' %}
        {% elif int(states('sensor.bedroom_humidifier_switch_power'), 0) < 5 %}
          {% set runstate = 'off' %}
        {% elif states('humidifier.bedroom') == 'off' %}
          {% set runstate = 'off' %}
        {% endif %}
      {% endif %}

      {{ runstate }}

Calculate the total run time

platform: history_stats
name: "Bedroom Humidifier Use Total"
unique_id: 903bbbc9-5d8d-4d6d-b67b-585d4ef32d84
entity_id: binary_sensor.bedroom_humidifier_is_running
state: "on"
type: time
start: >
  {{ as_timestamp(states('input_button.bedroom_humidifier_refill_water'), (now() | as_timestamp) ) }}
end: "{{ now() }}"

Perhaps you could use a variant of this concept. It’s worked quite well for me and has been very accurate.

Thanks for the help.

I don’t know what “fires based on a high and low limit” means. I know there is a high water temperature limit sensor and a low water level sensor both used safety devices, but maybe I’m misunderstanding.

It sounds like your solution reports when voltage exists on the line to the burner (I assume a fan/motor/pump of some sort). If so, what I’d prefer is a more outcome-based report. What I mean by that is that sometimes (during failures) voltage is properly being supplied but for any of a variety of reaons heat is not being created. That’s why I went with a secondary reporting mechanism that measures heat in the close physical area around the boiler.

I’ll check out the links on getting runtime data.

As for the ultrasonic level: I have one and I don’t think it is particularly accurate. I need to test and experiment more. Further, it does not have any integration with HA which is very aggravating. It is the T-Meter system by Tumblevd . It has an iOS app, but getting that data into HA is beyond my capabilities.

Might be a roll-your-own solution required.

I can see lots of uses for “run time” applications.

I don’t follow the binary_sensor logic (it’s me, not you). What are the entities humidifier.bedroom, bedroom_humidifier_switch_power, bedroom_humidifier_wall_switch?

In my case, the humidifier.bedroom is a generic hydgrostat entity (think humidifier template, for you it could be something else), the bedroom_humidifier_switch is a outlet adapter so I can force power on/power off if the IR signals don’t work and so I can use the power output of that switch (bedroom_humidifier_switch_power) to know if it’s drawing power and how much power, and in this way I can determine not that it’s just on but at what level it is on.

Brilliant!

I just got a bunch of Sonoff outlets today and just a couple hours ago set one up. Nice to see watts/amps/volts as well as to control the outlet. Great way to know if something is “really” on.

Right. The burner is like a blower which shoots the air/fuel oil mixture into the boiler’s firebox. Obviously you wouldn’t have this with natural gas or propane.

The logic is a lot simpler than it sounds. The boiler will start the burner whenever its internal temperature is below the “low” setting. This keeps the water in the boiler at this set temperature.

Until a thermostat calls for heat. That causes the burner to fire, and it will keep firing until the thermostat stops calling for heat…UNLESS the boiler internal temperature reaches the “high” limit, which again turns off the burner, although the circulator pump is still circulating water through the baseboards.

So the result is continual cycling of the blower during the day, somewhat independent of when the thermostats call for heat.

Of course it’s the outcome that I care most about, too. I want to know if my pipes are likely to freeze! For that I have a number of sensors. Three thermostats reporting to HA, along with numerous temperature sensors in strategic locations around the house, including one above the boiler, one on the boiler casting itself, and one each on the hot and cold domestic water pipes. Those let me know if there’s a problem, and specifically, where.

The boiler runtime is mostly for keeping track of fuel burn. Not critical, but nice to know. The burner fuel flow rate is regulated by the nozzle, and knowing that allows my fuel burn estimate based on runtime to be very accurate. The ultrasonic sensor is a nice backup. Both methods offer a remote alternative to actually looking at the fuel gauge on the tank.