Calculating Oil Consumption

You got it

count/100000

is what you would then enter in ‘set to 2 decimal’ node

1 Like

So @Mikefila, it seems I had another reset of the oil tracker during a reboot of Home Assistant. Node-Red restarted from the full tank value even though I had the latest changes you identified. When reviewing the Node-Red flow, how does the Flow know what the last value was during a restart? It only picked up the initial tank value.

Judd

Did you upgrade node-red? The current version is 8.2.1. It seems like the data does not make it through the upgrade.

The way node-red works the designation set flow ties that information to everything directly connected. flow.counter is tied to that set of connected nodes. On deploy or reset it checks the file tied to nodes for values.

Yes I did upgrade, I am on version 8.2.1.

After posting on the node red forums it’s not possible to find out exactly what happened with the current counter. Did the upgrade delete the data or was it reset from something else. :man_shrugging:

This is a new counter that will show the value as null should the data be deleted, rather than reset to the default. I added an inject node to easily restore the previous value. This is a func node so there is no gui. I already set it for your tank size and burn rate. Swap the nodes and inject the current counter value from the new inject node.

[{"id":"9a6e8332.90d2b","type":"inject","z":"ec78a76b.a0a4d","name":"Reset to number set here","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"set","payload":"47230000","payloadType":"str","x":290,"y":40,"wires":[["40cecc4e.aa8684"]]},{"id":"6f0843b0.c5be9c","type":"change","z":"ec78a76b.a0a4d","name":"reset count","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":160,"wires":[["bcf643d5.c3e278","40cecc4e.aa8684"]]},{"id":"40cecc4e.aa8684","type":"function","z":"ec78a76b.a0a4d","name":"counter","func":"var count = context.get(\"count\");\n\nif(msg.topic == \"reset\" || msg.reset == true) {\n    count = 27500000;\n} else if (msg.topic == \"set\") {\n    count = msg.payload;\n} else if (msg.topic == \"increment\" || msg.topic == \"inc\") {\n    count += 354;\n} else {\n    //assume decrement\n    count -= 354;\n}\ncontext.set(\"count\", count); //store it\nnode.status({ text: count });\n\nmsg.count = count; //pass current count in msg.count\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":855,"y":100,"wires":[["aee7a4c6.0cd6f8","c62686c3.3c9558"]],"icon":"node-red-dashboard/ui_numeric.png","l":false},{"id":"c62686c3.3c9558","type":"change","z":"ec78a76b.a0a4d","name":"set to 2 decimal","rules":[{"t":"set","p":"count","pt":"msg","to":"count/100000","tot":"jsonata"},{"t":"set","p":"count","pt":"msg","to":"$round(count, 2)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":100,"wires":[["4f4facbf.7c9d5c"]]}]

I found a custom card that works well for the oil level.

positions:
  icon: 'off'
  indicator: inside
  name: outside
type: 'custom:bar-card'
width: 70%
style: |-
  bar-card-value {
    margin-right: auto;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 2px 2px #0005;
  }
entities:
  - entity: sensor.oil_level
min: '0'
max: '550'
severity:
  - from: '0'
    to: '150'
    color: red
  - from: '151'
    to: '225'
    color: yellow
  - from: '226'
    to: '400'
    color: blue
  - from: '401'
    to: '550'
2 Likes

Can someone please put a latest solution? I am using the BMW connected apps and using the HA integration and will it to register automatically the data somewhere on HA.

Hi @123, I am trying to achieve the same thing but using an Aqara vibration sensor. So glad to see someone else had the same thought. But mine doesn’t seem to be sensitive enough to notice the jolt from the oil furnace starting, I tried different locations and nada.

I’m wondering where you placed yours? It’s probably a more modern furnace, mine was put in 1963. I use about 1800L / year on heating and warm water, and I want more data. Has your sensor been reliable over time?

I recently placed an Aqara temp / humidity sensor on top of it and the temp varies between 29ish C and 30ish C, but the range seems to be going lower as it gets colder outside, so not sure I’ll be able to use a threshold helper on this one.

I put a current sensor on the furnace AC power. When the oil burner runs it draws more than 1 amp and use that as a signal it is running. My nozzle burns 0.86 gph. Since I have data from all thermostats I’m able to prorate that 0.86gph into the different zones.

Nowhere; I don’t own an oil furnace. My involvement in this discussion was limited to providing Papester with an example of a History Stats sensor as originally suggested by CaptTom.

I believe Papester or CaptTom may be the person you want to talk to.

I also use a current sensor to measure the runtime of my oil burner and multiple that time by the burn rate of the burner which in my oil burner is .85 gals and hour.

1 Like

Which is your latest code to import your flow? I’m very green when it comes to node red. So it’s a bit hard to keep up with the changes and where they need to be applied exactly.

Maybe you like to join my ESP8266 project to read the oil values based on colors.
https://github.com/Phreak87/OilMeter

This project includes MQTT with Homeassistant Autodiscovery.