Assistance modifying sensor (MQTT) for oil remaining etc

I’m still very much learning HA, so be gentle :slight_smile:

I have a LilyGo running MQTT and pushing a 433MHz oil tank sensor reading into HA, thats working fine and supplying regular readings of the air gap between the top of the oil and the top of the tank.

Obviously displaying the air gap is pretty pointless, other than to check its values are updating.
My next step is to do some calculations, this is where I am stuck.
I hoped to simply find the entry for my Device in a yaml file somewhere and add a few extra lines there.
I can’t find where the file is with this device and its sensors?

My device is called ‘Oil Tank Gauge’ and it has 3 sensors:

Alarm - on or off if the sensor suddenly shows a huge drop, perhaps indicating a leak or somebody drained the tank

Depth - air gap in cm

RSSI - signal strength

I was expecting to add a sensor that was a calculation of the oil depth (120cm-Depth) in cm
another for oil remaining (estimate is 10l per cm, so oil depth x 10) in Litres

Trending usage per day would be helpful, as well as trying to predict, based on current usage, how many days oil are remaining.

After all of this I’d love to use the animated fluid level card to show the tank, that will be another learning curve!

Any suggestions and assistant would be greatfuy received :slight_smile:

You’re ahead of me! Any chance of confirming what LilyGo device you are using and whats steps you needed to go through to get your sensor readings into HA. Thanks in advance

I followed some guides online, such as this LILYGO TTGO LoRa32 V2.1_1.6 433 MHz + Oil Watchman - #22 by psavie - Sensors - Theengs and OpenMQTTGateway

I ordered a LilyGo LoRa32 with 433MHz aerial (<£16)
https://www.aliexpress.com/item/32872078587.html?spm=a2g0o.order_list.order_list_main.5.63b41802zA9FNp

Once setup it just needs power from USB adapter, it receives messages on 433Mhz and uses Wi-Fi to send MQTT packets to the listener on HA.

I have a sensor that shows how many cm of air there are between the sensor in the tank and the top of the oil. Then you need to measure your tank, I also used a stick to measure how much oil was actually remaining.

I’m now trying to figure out how to do the calculations in HA, then display the data in a friendly format.
For my plastic tank, I calculated its approximately 10l of oil per cm of height. Its a 1200L tank and just over 120cm in height.
Today the sensor is reporting 67cm, so thats 120-67 = 53cm of oil, which is approx 530litres.

I don’t need it to be 100% accurate, afterall the in-house display for the watchman only has 10 bars on it, each one representing 10%. I am being cautious with the numbers, aiming to never fall below 15-20% in the tank.

I hope to also do some calculations on average use per day and then be able to predict when I need to order more oil.

Rogers blogs were also useful basic arithmetic in Home Assistant to calculate how much heating oil I need and when I need to order heating oil - Roger Frost: science, sensors and automation.

1 Like