logo smart home family kruse

Kruse Smart Home

Easy living in our smart home & Garden

Create a plant sensor card within Home Assistant

Create a Xiaomi Flower Care plant sensor card within Home Assistant

13 March 2023


1. Introduction

xiaomi logoThere are multiple options available to create a Xiaomi Flower Care plant sensor card for a Home Assistant dashboard. This article describes setting up a plant information card which looks as shown below.

This card is based on the Lovelace Flower Card by Olen, which embeds additional functionality. This plant sensor card can make use from the Open Plantbook database to fetch plant information via the OpenPlantBook integration. Additionally the Alternative Plant Component is used, also called Plant monitor.

Related articles:

  1. The Flower Care Plant Sensor from Xiaomi
  2. Integrating the Xiaomi Flower Care plant sensor with Home Assistant

2. Requirements

The following is required to setup the plant sensor card:

The next sections assume above requirements have been met.

3. Assure you have an Open Plantbook account

Although not necessary for using the Lovelace Flower Card we make use of Open Plantbook in this article to automatically fetch plant data, plant image and bandwidth of the plant sensor measurements in which the plant will be happy.

If no Open Plantbook account yet follow the steps below:

  1. Go to the Open Plantbook website.
  2. At the upper tight click on “Sign in” and then on “Create account”.
  3. Enter your credentials and click register.
  4. You can now immediately login. No confirmation emails are sent.

4. Install the OpenPlantbook integration

To make it possible to fetch data from the Open Plantbook database the OpenPlantbook integration needs to be installed in Home Assistant and configured.

  1. See the OpenPlantbook integration instructions how to install. The integration will be shown as follows:
  2. Setup and configure the integration as indicated by the instructions.
  3. Remember the path where the images are stored (click on configure in the integration to see the image path). In our case the path is ‘/config/www/images/miflora/’

5. Adding the plant to Home Assistant

Before we can create a Lovelace plant sensor card with plant information we need first to setup a Home Assistant device with the plant properties.

  1. Check if plant info is available on Open Plantbook
  2. In Home Assistant go to Settings > Devices & Services and click on the ‘Add integration’ button.
  3. Type ‘plant’ in the ‘Search for a brand name’ field and select ‘Plant Monitor’
  4. The ‘Configure a plant dialog’ will be shown.
    a. Enter the plant name (usual name of the plant)
    b. Enter the species (the latin name, also used to search inf in Open Plantbook
    c. Enter the Xiaomi Flower Care Plant Sensor to use
    d. Enter optionally a humidity sensor nearby as the plant sensor does not measure this.
    Click the submit button.
  5. If one or more species are found on Open Plantbook it can be chosen which one is correct

    Click on submit.If no species found the ‘Set limits’ dialog described in the next step will be shown.
  6. The ‘Set limits’ dialog will be shown. In this case with data pre-filled from Open Plantbook, including the image.

    For every property it has a min and max value stated. These will be use to flag warnings if the measured values are outside the range. The image from Open Plantbook will be copied to the image folder configured in the OpenPlantBook integration.

    Click on submit.

    If the plant has not been found at Open Plantbook you need to enter the requested data by yourself. It will be pre-populated with default data for you to change if needed. Search the web for plant info and modify the default settings.

    The plant image needs to be stored in the folder configured in the Openplantbook API integration. In our case it is the folder path ‘\local\images\miflora\<image name>.jpg’. The image size used in the Lovelace flower card is small, so to speed up the performance of the dashboard it is wise to compress the image (we used jpeg 60%) and scale the image down. When ready click on submit.

  7. Add the area of the plant and click on Finish.

    Note: initially ‘Unknown device’ might be shown. When selecting the area drop down it will update the dialog with thew plant name.
  8. The plant has now been setup for use in the lovelace card and automations.

6. Rename the plant to include the sensor number

To make it easier to see which plant sensor is used for a plant we rename the plant device to include ‘(sensor x)’ and have this also shown on the Lovelace Flower Card.

This sounds straightforward, but there are 3 locations where you can change the plant name, each having a different impact:

  1. the device name of the plant
    Will be shown on the first line of the Lovelace Flower Card, see item 1 in the image below. Additionally this gives also the option to include the plant sensor number in the device entity IDs, making it easier to find the correct entities when creating dashboards and automations.
  2. embedded in the plant monitor device options
    Will be shown on the second line of the Lovelace Flower Card, see item 2 in the image below.
  3. as shown in the plant monitor integration
    Only shown in the Plant monitor integration as shown in image above. No impact on the Lovelace flower card.

We have chosen to go for only option one in this article, for which the following steps need to be followed:

  1. Select the plant from the plant monitor integration.
  2. Update the device name by clicking on device
  3. Select & copy the name in the header
  4. Click on the edit settings button in the upper right
  5. Paste the name with Ctrl-V or right mouse button into the name field and add ‘(sensor x)’. Click on the update button.
  6. Click rename to change the entity IDs to include also the plant sensor number
  7. Refresh the device screen to show the updated info. Measurements will be shown shortly. The device sensors will now have an entity ID like for example:
    The device overview screen will now show the sensor number included also for the device name.
  8. The Lovelace flower card will also show this device name:

If you change the name later it might not be reflected in the Flower Card. A reload of the Plant monitor integration for the plant will give an error:
The only way to reset this error we have found is to restart Home Assistant.

7. Create the Lovelace Flower Care card

Perform the steps below to create a Flower Card card similar as shown above.

  1. Go to the Home Assistant dashboard where you want to add the Flower Care card and put it into edit mode.
  2. Click on the add card button and type manual in the ‘Search cards’ field.
  3. Remove existing info from the code editor and copy/paste the yaml code below.

    The order of the bars can be changed by changing the order in the Yaml code above.
  4. Replace the entity marked red above by your plant entity name. You can find this for example by searching for your plant on the entity overview screen (Settings > Devices & Services > Entities).
  5. If correctly done the preview shows how your card will look. Click on Save.
  6. Exit the dashboard edit mode.

8. Useful links

Below are links to sites or the Home Assistant community forum which might help you in creating your own dashboard cards with plant sensor information.

Article by <a href="https://smarthome.familykruse.eu/author/iamjwk/" target="_self">Jan-Willem</a>

Article by Jan-Willem


Writen by the website owner


Submit a Comment

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