Currently, the Mopeka propane tank level sensor only shows the level in inches of propane. The native app also shows percentage. Feature request to add percentage to the HA Mopeka integration.
This would be very helpful, I tried to write a template sensor with no luck.
The ESPHome integration for these sensors includes level-to-percentage conversions for 20, 30, and 40 lb vertical tanks:
esphome/components/mopeka_pro_check/sensor.py
Converted from mm to inches, a standard 20 lb (5 gal) vertical tank goes from 1.5 in (empty) to 10.0 in (full). So a suitable conversion template would be something like this:
- name: Tank 1 Percentage
state: "{{ ((states('sensor.tank_1_tank_level') | float(1.5) - 1.5) * 11.77) | round(0) }}"
unit_of_measurement: "%"
icon: mdi:propane-tank
Works fine for me so far - the value matches what I see in the Mopeka smartphone app.
Is it possible to get a copy of the full template. Fighting with this for days and just canāt seem to get if correct. Thanks MikeyM
In my configuration.yaml, just replace sensor.propane_tank_level with the proper entity.
template:
- sensor:
- name: "Propane Percentage"
state: "{{ ((states('sensor.propane_tank_level') | float(1.5) - 1.5) * 11.77) | round(0) }}"
unit_of_measurement: "%"
icon: mdi:propane-tank
Thank you! Worked perfectly. The problem I had was the formatting of the template. Thanks again!
Does anyone know the empty / full levels for a 500 gal tank, or 320 gal? I suppose I can calibrate against analog gauge before / after tank is filled (e.g., going from 25% full to 80 % full).
Would be useful if someone could figure out a more generic volume calculation, based on tank dimensions, like the Mopeka app does.
But meanwhile the above template YAML should work for me, after calibration to my analog gauge readings; thanks much.
I canāt seem to get this to work in my config.yaml
Replace āsensor.propane_tank_levelā with the proper entity (the name you use) and use āinchesā in mopeka integration unit of measurement.
And for those in the metric hemisphere, this worked to match my Mopeka app with a 9kg propane tank.
- platform: template
sensors:
propane_percentage:
friendly_name: "Propane Percentage"
unique_id: propane_percentage
value_template: "{{ ((states('sensor.pro_check_3c2e_tank_level') | float(1.5) - 1.5) * 0.22) | round(0) }}"
unit_of_measurement: "%"
I made a template and put it in my configuration.yaml file, but I canāt for the life of me figure out how to use that value in a lovelace card. Could you post how you did that?
It turns out the latest HA update (2023.9.0) makes it available natively.
So I failed the intelligence test ā¦
I pasted the above in configuration.yanly with my own tank entity ā¦ but getting an error below.
Any ideas please as I am using the latest 2023.9.1
Donāt put it in configuration.yaml
. Put it in your sensors.yaml
file if you have one. The code you pasted does not tell HA itās a sensor if you put it in configuration.yaml
. If you want to put it there, youād have to preface it with sensor
like so.
# Example configuration.yaml entry
sensor:
- platform: template
Can you elaborate? Iām still seeing the native integration sensor in mm.
Thank you so much for the assistance !
I put the ammended configuration.yaml entry in and it works great,
I also have a 9kg tank ā¦ but my reading in HASS are different to the Mopeka app ā¦ Iāll try and do some further digging.
Thank you again !
Jason
Youāre welcome. Just tweak this value to match the app
* 0.22)
Just magnificent @xbmcnut !!!
You have made this a great weekend for me !
All is working perfectly !
Thank you again for your super fast and kind help !
Jason
Iām trying to get this working on a 100lb ASME horizontal mount tank. Any tips?
is this to be used with the mopeka integration or the espHome ?