This guide assumes you already have a working and running Home Assistant server. If you don't, be sure to visit our Set up Home Assistant with a Raspberry Pi guide first.

Check Your Add-Ons

Start out by logging in and opening up your Home Assistant dashboard and checking that the File editor is installed. 

As part of the setup, you should have an add-on either called configurator or File editor with a wrench icon next to it. Go ahead and select it.

If you don't see it, it may not be installed. You can find it under Settings → Add-ons  Add-on Store  File editor and go through the installation procedure.

If you already have it, but it's just not showing up, be sure it is started and the option to show in the sidebar is selected.

Adding the Sensor

In order to add the Water Level Sensor to Home Assistant, you'll want to add the following code to your configuration. This will create an MQTT sensor that listens on the funhouse/catbowl/state topic. It will translate the value it recives to one of the state labels. Feel free to update the states to your liking.

  - name: "Cat Water Bowl"
    unique_id: "funhouse_catwater"
    state_topic: "funhouse/catbowl/state"
    icon: mdi:bowl
    value_template:  >-
      {% set states =  {
          'empty' : 'Add Water',
          'low' : 'Water Low',
          'full' : 'Full'
      } %}
      {{ states[value] if value in states else 'Unknown' }}

Click the save button at the top.

From the Developer Tools menu, you can check that the configuration is valid and click on Restart to load the configuration changes you made. You can just click Quick reload to reload any changes you made.

With the latest releases of Home Assistant, a LoveLace dashboard was added. If you haven't edited the Dashboard, it should automatically appear.

Otherwise, you may need to manually add a Sensor card to the dashboard.

The Cat Water Bowl sensor should appear under your sensors.

Adding Notifications

This project wouldn't be complete without having Home Assistant notify you of when the bowl gets low or empty. Home Assistant uses Persistent Notifications as its main way of notifying you, which is what we'll be showing you how to add.

Start by going to the File Editor again and click the folder icon at the top.

Open the automations.yaml file.

Add the following code. This will create 2 notification triggers. The first is when the state goes from full to low. The second is when it goes from any state to empty. Feel free to customize the messages.

- id: water_low_notif
  alias: "Cat Water Low"
  - entity_id: sensor.cat_water_bowl
    from: "full"
    platform: state
    to: "low"
    service: persistent_notification.create
      title: "Water is Low"
      message: "Cat's water is low. Consider filling it."

- id: water_empty_notif
  alias: "Cat Water Empty"
  - entity_id: sensor.cat_water_bowl
    platform: state
    to: "empty"
    service: persistent_notification.create
      title: "Water is Empty"
      message: "Cat's water is empty. Fill the bowl and give your cat some love."

Once that's added, go ahead and check the configuration and restart the server as you did before. If you made changes to the water bowl code above, you may need to update this code to reflect those changes.

To test alerts, you may need to temporarily increase the UPDATE_INTERVAL in your sensor code so it checks more frequently. 


If you see the icons, but there is no data, it is easiest to start by checking the MQTT messages. Adafruit has a guide on how to use Desktop MQTT Client for, which can be used for the Home Assistant MQTT server as well.

Go ahead and configure a username and password to match your MQTT server and connect. Under subscribe, you can subscribe to the # topic to get all messages.

If you are seeing messages from the sensor, you may want to double check your Home Assistant configuration.

If you don't see any messages, you will want to follow the debugging section on the Coding the Water Sensor page.

This guide was first published on May 14, 2021. It was last updated on Jun 18, 2024.

This page (Home Assistant Configuration) was last updated on Mar 08, 2024.

Text editor powered by tinymce.