Mopeka Pro propane sensors via Bluetooth

I REALLY want to make a sweet integration of all smart objects in my home. Unfortunately, I keep running into roadblocks. Some seem very ridiculous to be impediments but they are. Most of my efforts in the past for creating a Home Assistant controller has been in a Debian-based VM. On this go-around, I am starting with a new Raspberry Pi 5 (8GB) with Pineberry’s HATdrive Bottom and a 1TB Crucial P3 SSD on which I’ve installed the latest HAOS. When I first started setting up Home Assistant, I was surprised when it automatically discovered the two Mopeka Pro propane tank sensors via Bluetooth. Those hadn’t even crossed my mind when I was thinking of things to integrate but now that I know it is a possibility, I want to use them. Unfortunately, the built-in Mopeka device setup in HA shows the level in “inches” instead of percentage. Upon seeing this, I was referred to ESPHome, which is what leads me to this particular forum.

I went ahead and installed the ESPHome add-on in my new Home Assistant device and upon opening the page for ESPHome, I am seeing “Welcome to ESPHome It looks like you don’t yet have any devices.” with a “+ NEW DEVICE” button. This is where something that should be very simple to understand is confusing me. I’m told that a device needs to be connected using a USB cable… At this point, I am not looking at creating my own new device from a blank ESP32 device. It seems to me that this is what it is attempting to do.

I was able to add an “IoT-uni-dongle” device that I had installed into a MrCool Mini-Split by adding the IP address of that dongle. That did not involve doing anything within the ESPHome web interface. I am now able to control the mini-split in my office.

What I am UNABLE to do is to figure out how to add the Mopeka Pro propane sensors via Bluetooth. I believe I somehow need to setup a Bluetooth scanner to discover the full MAC address of my devices. I only know three of the six octets for my Mopeka sensors, so I need to figure out the rest. I then need to figure out how to access them. Unfortunately, the information at Mopeka Pro Check BLE Sensor — ESPHome already assumes I know other information. It seems like there is a wall and I can’t find the door. Once I figure out where the door is, I’m hoping I can figure out the rest.

I am not a complete NOOB, just new to ESPHome and finding the learning curve to start by going straight up.

Hi, things can be confusing and daunting. EspHome is meant to create firmware for microcontroller devices, so it is not what you need to get your newly discovered devices to show different units. EspHome could come in handy if you have limited bluetooth range.

To convert a device that measures inches to a percentage, you can create a template sensor in Home Assistant itself. That will create a new entity with a different representation.

2 Likes

This is a joke, right? You already have the propane sensors working in HA but just need to convert units?

By whom? How is ESPHome going to help with that? You’ve jumped down the wrong rabbit hole.

You need a template sensor in HA — we can help with that if you can explain how to convert inches to %.

1 Like

To be clear: when the device is autodetected and you add it, then it is integrated. So that part is done. The inches are likely the raw data. you need to know how many inches is full and empty. From that, and the entity id of the original sensor, we can help you write the calculation template.

You can create a template sensor in the helpers section of the settings. If full is 15 inch and empty is 25 inch, and the sensor entity is sensor.tank_inches, then the template for the value would look something like this:

{{ 100 - (((states('sensor.tank_inches') | float(0)) - 15) * 100) / (25 - 15) }}

There mopeka devices can be added in two ways. Either as a native integration in home assistant Mopeka - Home Assistant or via esphome Mopeka Standard Check BLE Sensor — ESPHome

I am unsure if one is better than the other, but there are in fact two components for esphome, so maybe they cover more models. However the important thing to note is that esphome will need an esp32 to read the Bluetooth from the mopeka and relay the data to home assistant.

You seem to have them installed via the native integration. Be happy. As @Edwin_D said you can calculate the percentage.

1 Like

I am still learning how to code it to look pretty but I found how to show the values of both of my tanks. At the moment, in my configuration.yaml file, I have added:

template:
  - sensor:
      - name: "Door-Side Propane Tank"
        state: "{{ [ ((states('sensor.pro_check_73ef_tank_level') | float(1.5) - 1.5) * 7.4074) | round(0), 100] | min }}"
        unit_of_measurement: "%"
        icon: mdi:propane-tank
        
      - name: "Slide-Side Propane Tank"
        state: "{{ [ ((states('sensor.pro_check_1436_tank_level') | float(1.5) - 1.5) * 7.4074) | round(0), 100] | min }}"
        unit_of_measurement: "%"
        icon: mdi:propane-tank

I’m sure I will find a better way to display the data but this at least returns values that mimic the values my phone reports for my 30-pound tanks. Just getting the raw data that is easy to understand is the first step before making it “pretty”.

3 Likes

Pretty enough for me, if I could suggest some improvements to make it even better:

  • Add an availability template. When the base sensor is not available, the tank seems 0% with this. In that case you’d want to be unavailable too for all kinds of reasons.
  • Add a unique_id will allow you to configure things using the UI such ass adding an area.

Normally I’d also advise a device_class but for this you don’t need one. So add these to both (unique id should be unique of course):

      - name: "Door-Side Propane Tank"
        state: "{{ [ ((states('sensor.pro_check_73ef_tank_level') | float(1.5) - 1.5) * 7.4074) | round(0), 100] | min }}"
        unit_of_measurement: "%"
        icon: mdi:propane-tank
        availability: "{{ is_number((states('sensor.pro_check_73ef_tank_level')) }}"
        unique_id: sensor.pro_check_73ef_tank_level        

Start with learning how to ask a good question and pay special attention to the title (7.)

Like that you spend 5 minutes reading the getting started guide?

In other words you can’t find the search?

https://esphome.io/search.html