We heat our house with oil (grumble grumble grumble) but our float sensor is not a very accurate measure and it’s out of the way to actually see. Has anyone come across a sensor that works with HA and has been reliable? Bonus points for something that still has an “analog” view in case of problem

I’ve seen some sensors on Amazon but I’m skeptical of anything through there.

  • waldenA
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    11 months ago

    I got a sensor set up last year and it’s great. You need a raspberry pi with a camera.

    https://github.com/tangentaudio/opencv_tank_gauge

    The project includes all sorts of 3D printed goodies that I skipped. Since it’s optical in nature, the readings change if there’s a change in lighting (garage door open, etc). I just painted the inside of a cardboard box matte black and covered the whole thing. Works great.

    Another thing I did differently is I used an IR camera. The project is designed around normal cameras. There’s a closed issue on GitHub where I figure out the settings to change, so you can check that out if you want.

    It feeds into Home Assistant and I get notified when the oil is low, can look at graphs, etc.

    1000005338

    • Balakirev@discuss.tchncs.deOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      11 months ago

      This is a really cool project. I do have a pi zero laying around…

      Have you had any issues with this setup? Also was the ir necessary because of the interior of the box?

      • waldenA
        link
        fedilink
        English
        arrow-up
        2
        ·
        11 months ago

        The only problem I had was because of changing light where the tank is. Up until a month ago, it was out in the open. If the garage door opened or the sun came through the window, the reading would jump because the computer would think a reflection was the float sensor.

        Covering it with the spray-painted Amazon box has (almost) completely solved that problem. Here’s a screenshot:

        Around Jan. 5th (earlier this month) is when I installed the box. You can see how the line smooths out, although it did jump around on the 18th for some reason.

        It has been amazingly solid, and I never even think about it. On occasion I SSH in to do a “sudo apt update”, but it never crashes or needs debugging.

        Getting the camera pointed at it was tricky. There’s a pretty narrow range of being “just right”. Cameras for Pi’s don’t typically have adjustable focus, but I bought one that does.

        I got an IR camera because it’s totally dark in the garage at night. The camera has built in IR blasters (this is the one I got). If you get a normal camera, I would still cover it with a box, and you could probably rig up some low-powered LED for light.

        It definitely takes some tinkering to get it set up. Once the software is installed, then you have to get the camera pointed correctly (you can see it live on your phone as you move it around, at least). Then you have to make some small adjustments in the settings to make sure the software is picking up the 100/75/50/25/0 markings on your gauge, as well as the float gauge. The guide has decent instructions, and fortunately once it’s set, you don’t have to touch it ever again.

        When it talks to Home Assistant, it just provides a number. If you want long-term history, you need to give HA more than a number. To do this, I created a Template under Settings -> Helpers. The template takes the number (0-100) and turns it into a percentage. HA will then keep long term history for you.

        So, to sum it all up: An IR camera will require changes to the gauge.py file as seen here because it’s a different image hue (sort of pinkish).
        An enclosure definitely helps in my case, but it depends where your tank is located. Matte Black spray paint is good.
        Be prepared to tinker and follow the directions precisely.
        When you’re done, create a Template Sensor to get those sweet long-term graphs.

        • Balakirev@discuss.tchncs.deOP
          link
          fedilink
          English
          arrow-up
          3
          ·
          10 months ago

          Thank you so much for this detail! You’ve made it sound like a fun (and wonderfully over engineered) solution. I may just give it a go because it sounds like I may learn a lot!