Monitor Your Water Levels with Home Assistant

After updating to Home Assistant version 2025.12.0 some errors may appear. Just download the yaml file again and replace it in the packages directory (dashboard and yaml file).

Keeping track of water levels in tanks, rain barrels, or ponds is essential for efficient water management. Smart Gateways has two options for this. The Water Level Gateway and the Distance Meter Gateway. I will tell you the differences later.

you can easily monitor the water level at a glance. These gateways seamlessly integrate with popular home automation platforms like Home Assistant, Domoticz, Homey, and other products. They have a waterproof sensor that can be mounted at the top of a reservoir, providing accurate readings. By utilizing this sensor, you can automate the process of refilling your pond and ensure it never runs dry.

Water level sensor
Water Level Gateway (Uses Time Of Flight / Laser sensor)
Distance Meter Gateway (Uses ultrasonic sensor)

What is the Difference Between the Distance Meter Gateway and the Water Level Gateway?

Both the Distance Meter Gateway and the Water Level Gateway are equipped with sensors that measure distance. However, they use different technologies to do so.

The Distance Meter Gateway operates using ultrasonic sound waves. These waves are emitted from the sensor and reflect off a surface. The gateway measures the time it takes for the sound waves to return, and from this, it calculates the distance.

In contrast, the Water Level Gateway uses a Time-of-Flight (TOF) sensor, which emits infrared laser light. Like the ultrasonic sensor, the TOF sensor measures the time it takes for the laser light to reflect back from a surface and uses this to calculate the distance.

While both gateways work on the principle of measuring the time taken for a signal to return, the key difference is in the technology they use: one relies on sound waves, while the other uses laser light.

Is a TOF Sensor Better Than an Ultrasonic Sensor for Measuring Distance?

Each sensor type has its own strengths, depending on the application.

The beam of ultrasonic sound waves becomes wider as it moves away from the sensor, diverging at an angle of 15 degrees from the center (a total spread of 30 degrees). This means that if you’re using it in narrow spaces like pipes, especially for measuring groundwater levels, the pipe must become wider as the distance increases. Additionally, ultrasonic sensors require a minimum distance of 20 cm (around 8 inches) to measure accurately. If the object is closer than 20 cm, the sensor cannot provide a reading. The maximum measurable distance for this sensor is 4.5 meters (175 inches).

The TOF sensor used by the Water Level Gateway, however, has a much narrower beam spread of 6 degrees from the center (12 degrees total). This allows it to be used in tighter, more confined spaces, such as narrow pipes. It also has a shorter minimum distance requirement—just 5 cm—making it more versatile for close-range measurements. The maximum range of the TOF sensor is 4 meters (approximately 157 inches).

Which Sensor Is Better?

The choice between the two depends on the specific application. Ultrasonic sensors are great for longer distances and larger open areas, but their wider beam means they may not be suitable for narrow spaces. TOF sensors, with their narrow beam and shorter minimum distance, are ideal for precise measurements in confined spaces, though they have a slightly shorter maximum range.

Features:

  1. Gateway and Waterproof Sensor: Both gateways come with a water-resistant sensor. It is designed to measure water levels in tanks and various other surfaces, making it versatile for different applications.
  2. Compatibility: It is compatible with popular home automation platforms such as Home Assistant, Domoticz, and Homey.
  3. Full MQTT Support: The gateway offers complete MQTT support, making it suitable for vendors who want to monitor their customers’ water usage through their own cloud services.
  4. REST API: All measurements can be accessed via a JSON web server, allowing easy integration with other applications.
  5. User-Friendly Dashboard: The gateway provides a clear and concise dashboard for Home Assistant, enabling you to view water level data and track changes over time.
  6. Automatic Firmware Updates: The gateway ensures you stay up to date with the latest features and improvements by providing automatic firmware updates through the dashboard.
  7. Wide Measurement Range: The sensor has a range of 20 to 450 cm and a resolution of 1 cm, offering accurate readings for various water level scenarios.
  8. Customizable Maximum Level: You can set the maximum level of the water based on your specific requirements using the web server interface.
  9. Sensor Offset Adjustment: The sensor offset can be modified to virtually place the sensor higher or lower to the measured surface.
  10. Energy Efficiency: The gateway has a low energy consumption of 50mA, ensuring efficient operation.
  11. The sensor cable of the Distancemeter Gateway is 2 meters long and can be extended using up to three 3.5-meter extension cables, for a total maximum length of 11.5 meters.

  12. The sensor cable of the Water Level Gateway can be extended up to 50 meters using a UTP cable with the optional Extension Module Kit. (Be sure to select the extension kit at checkout.)

  13. Web Server with Real-Time Water Level Display: The gateway’s internal web server displays the water level in real-time, allowing you to monitor it even without using home automation software. By entering the maximum level and any offset for the sensor, the web server calculates and displays the water level accurately.
  14. Home Assistant Integration: The Distancemeter WiFi Gateway seamlessly integrates with Home Assistant, providing a comprehensive dashboard for monitoring and automation. The dashboard displays the distance in centimeters from the water surface. By inputting the total distance from the sensor to the tank bottom, Home Assistant calculates the tank’s fill level and presents it as a percentage.
  15. Preventing Fluctuations: To ensure stable readings, the gateway measures the distance to the water surface at a rate of 10 measurements per second. Occasionally, slight variations may occur due to external factors. To mitigate these fluctuations, the gateway calculates the average distance from a set of measurements. Both the average distance and real-time distance are transmitted via MQTT and the REST API, ensuring stable representation in your chosen home automation software.
Water Level Sensor – Internal Webserver

Home Assistant Water Level Dashboard

In this post I am going to guide you through the process of integrating your water level meter into Home Assistant. After going through this guide you are able to track the water level with the Home Assistant Distance Meter Gateway Dashboard.

The Water Level dashboard from Smart Gateways shown below:

If you are not sure if this Distance Meter Gateway is the right solution for you, just send a message to Smart Gateways and they will advice you about this solution. You can use the contact form on their website for this.

Pre-requirements to setup the Water Level Dashboard

Setting up the dashboard can be done in a few easy steps. Complete each step one by one and verify if the step is completed before proceeding with the next step.

  1. First install Mosquitto MQTT Broker on Home Assistant using this manual
  2. Connect the Distance Meter WiFi Gateway using the Installation Manual found on the Smart Gateways Support page
  3. Enter the MQTT settings on the internal webpage of the Distance Meter WiFi Gateway
  4. Install HACS (Home Assistant Community Store) using this manual

Install the Apexcharts-card plugin into Home Assistant

When you completed all the above steps it’s time to add the apexcharts-card repository to Home Assistant. You have to do this using HACS.

  1. Click HACS on the sidebar of Home Assistant
  2. Click Frontend
  3. Click EXPLORE & DOWNLOAD REPOSITORIES in the lower right corner
  4. Type apexcharts-card in the Search for repository box
  5. Click DOWNLOAD in the lower right corner
  6. Select the latest version and Click DOWNLOAD
  7. RELOAD the browser to activate the apexcharts-card plugin

Add additional MQTT Configuration for diagnostical data

The Water Level Dashboard for Home Assistant will show some diagnostical data from the Distance Meter WiFi Gateway. This data is sent by the gateway through MQTT. You can add this to Home Assistant by adding a mqtt file. You first have to install the File editor Add-on.

  1. Within your Home Assistant frontend/home navigate to the Settings menu
  2. Click Add-ons
  3. Click ADD-ON STORE in the lower right corner
  4. Go to the Search add-ons box
  5. Type File editor
  6. Click on File editor from the list
  7. Click INSTALL and wait for the File editor to be installed
  8. Enable Start on boot, Show in sidebar and Watchdog
  9. Click START to start the broker

Add the Packages directory to Home Assistant and place some configuration files

When using the packages directory for all your .yaml configuration files, you are able to sort all configuration in specific files for each integration. You have to edit the configuration.yaml file first for Home Assistant to use the packages directory.

  1. The file editor is shown in the sidebar. Click on the File editor icon
  2. Click on the configuration.yaml file
  3. The contents of the configuration.yaml file are shown
  4. Insert the following configuration into the file:
    • homeassistant:
        packages: !include_dir_named packages
  5. Click the save button (Floppy Disk Icon) on the upper right corner to save the configuration.yaml
  6. Click on the Browse File System Icon on the upper bar
  7. Click on the New Folder icon (second icon)
  8. name the new folder packages
  9. Click OK
  10. Download the following file (disable pop-up blockers)
  11. Click here to download file
  12. Unpack the zip file
  13. Place the file smartgateways_distancemeter.yaml in the packages folder by using the Upload File button within the File editor Add-on
  14. Save the file
  15. Restart Home Assistant

Add the Water Level Dashboard to Home Assistant

When you completed all the above steps it’s time to add the Water Level Dashboard to Home Assistant.

  1. Enable Advanced Mode for your user account
    • Within your Home Assistant frontend/home navigate your user profile (in the lower left corner)
    • Enable Advanced Mode to unlock advanced features
  2. Open the file distancemeter_dashboard.txt from the downloaded zip file and copy the contents of this file to the clipboard
  3. Click the three dots in the upper right corner of the dashboard in Home Assistant
  4. Click on the 3 dots again
  5. Click Raw configuration editor
  6. Scroll till the end and start a new line
  7. Paste the contents of the Dashboard panels file into the editor
  8. Click SAVE in the upper right corner
  9. Close the editor by clicking the cross on the upper left corner
  10. Restart Home Assistant
  11. Notice the new Water Level Dashboard.

23 thoughts on “Water Level Dashboard for Home Assistant”
  1. Hi Roel,
    very interesting article.
    What is the power necessary for this device ?
    I need to install such a device but I would like to power it with my solar panel so I need a 12V device.
    Is this distance meter compatible with such power ?
    Kr

    1. Hi Candido,

      The gateway uses 40mA power and has a micro usb connector. You can use a small solar panel with usb connector to feed the gateway. There are multiple users using this. Just use enough batteries in the solar panel to get along the dark days in winter. Also you can use the extension cables (optionally available when you place the gateway in your cart) to place the gateway near a power supply.

  2. Hi Roel,
    I’ve just received the water level gateway and it works fine using the rest api. Are there more instructions to connect the water level gateway via mqtt?
    I have my own NodeRed and Mqtt server setup and I am wondering how to get the mqtt connection right with this device. I am used to work with a Mqtt topic to get the data, but I don’t understand how to get data from this device.

    Pieter

    1. Hi Pieter,

      Good you received the gateway! The instructions for mqtt which you need for the dashboard are in this post too (at the end). You need the password to download the files. If you mail your order number to support@smartgateways.nl you receive the password.

      Regards,
      Roel

  3. Do you have any pictures available of this product being installed on a pool? I need something like this, but I’m having a hard time picturing exactly how it would be implemented.
    Thanks!
    matthew

  4. Hi, is there an extension cord of 15m possible for the water level gateway?

      1. Hi Rob,

        Yes this also works for oil. In fact, it works on every surface (the sonar waves or laser just reflects and the time it takes from the surface to the sensor is measured to calculate the distance).

        If your oil tank is narrow I suggest you use the Water Level gateway which is more suitable for narrow spaces. Also the sensor cable can be extended with the new extension kit: https://smartgateways.nl/en/product/water-level-gateway-extension-module-kit/

  5. Hi Roel,

    On the help files you mention that you’re working an extension cable for the TOF sensor.
    I need to have the sensor at a distance of about 3-4 meters from the power/wifi box.

    Do you have any idea when and if this is still in the works?

    Thanks,

    Michael

    1. The water level sensor cannot be longer than 0.5 to 1 meter because it is using the I2C bus which is made for small distances. If you need a longer distance, you can try to use the distancemeter gateway. This sensor can be extended to 11.5 meters (2 meter standard sensorcable + 3x 3 meter extension cables). Using more than 3 extension cables will make the signal unreliable.

  6. Hello,

    I would also be interessted in those pictures.
    I’m looking to use 1 of these 2 sensors to place in my underground rainwater collection tank. I just have no idea whatsoever how I would install it.

    thank you,
    Sander

    1. Hi Sander,

      This user-submitted photo shows a DIY installation of a water level sensor inside a narrow vertical access pipe of an underground rainwater tank. The sensor is mounted on a wooden beam placed across the pipe opening and is positioned to measure the water level accurately. The setup includes a separate dry compartment for electronics and wiring, ensuring protection from moisture. This solution is ideal for compact spaces and demonstrates a practical approach to integrating water monitoring with smart home systems like Home Assistant.

      This photo shows the setup for groundwater level monitoring using a Water Level Gateway with a TOF (Time-of-Flight) LiDAR sensor. The underground rainwater tank is accessed by opening a vertical inspection pipe next to a patio wall. Landscaping fabric and artificial grass have been rolled back to expose the sensor area. A separate dry compartment houses the power supply and controller, making the system ideal for smart groundwater level tracking and integration with home automation platforms.

      A detailed view of a groundwater level monitoring installation using a Water Level Gateway with a TOF LiDAR sensor. The sensor is mounted on a wooden beam across the top of a narrow vertical pipe, aimed directly downward to measure the groundwater level inside an underground tank. The setup includes a weather-protected wiring compartment nearby. This configuration provides accurate, real-time groundwater level data and is ideal for use in smart home systems and remote monitoring applications.

  7. Hallo Roel,
    Ik heb een waterontharder met zoutvat. Het vat is ca 1 m en wordt gevuld met zouttabletten. Is het de lidar geschikt om het het nivo van de tabletten in het vat meten?

  8. Hoi, ik begrijp niet helemaal hoe je de Water Level Gateway dient te bevestigen? In mijn geval gaat het om een vierkante opslagtank voor 500l met een deksel boven in het midden. Moet ik de sensor dan in de deksel monteren en de draad naar buiten laten lopen?

    1. De sensor moet vrij zicht hebben op het oppervlak, dus in de tank onder het deksel. De draad kun je dan inderdaad wegwerken en naar buiten laten lopen. De sensor moet dus het oppervlak kunnen zien zonder obstakels.

  9. Hello Roel,
    ik heb een distancemeter (accoustisch) geinstalleerd in mijn regenput een tweetal jaar geleden en geintegreerd in Home Assistant. Ik ga een vervanging doen met een water level (lidar) gateway. Kan ik de Home Assistant integratie volledig ongewijzigd behouden en kan ik me beperken tot de sensor swap? (MQTT en andere settings neem ik over van de oude sensor)

    1. Hoi Erik,

      Ja dat kan. De firmware is namelijk het zelfde alleen de hardware is anders. Je kunt dus gewoon de instellingen overnemen van de oude naar de nieuwe.

  10. Bedankt voor deze goed werkende waterlevelmeter ! Had initieel de verkeerde besteld (distance meter met ultrasoon sensor). Maar terug inleveren en de correcte bestellen (met TOF sensor) ging zeer vlot.
    Net zoals vele dingen in een huis waar je regelmatig moet naar omkijken, was het zout niveau in de waterontharder iets wat ik regelmatig diende na te zien. Soms was ik dan te laat, soms te vroeg om deze bij te vullen (afhankelijk van het waterverbruik). Nu kan ik het niveau continue monitoring met HA en een melding op de GSM krijgen van zodra het niveau te laag wordt. Weer iets waar ik niet meer hoef aan te denken !

Leave a Reply

Your email address will not be published. Required fields are marked *