Skip to content

Olen/homeassistant-plant

Repository files navigation

🌱 Plant Monitor for Home Assistant

HACS Custom GitHub Release

A comprehensive plant monitoring integration for Home Assistant that treats each plant as a device with its own sensors, thresholds, and health tracking. Automatically fetches species data from OpenPlantbook to configure optimal growing conditions.

Warning

This integration is not compatible with the original built-in plant integration in Home Assistant.


πŸ“‘ Table of Contents


🌿 Overview

Each plant is a device in Home Assistant, grouping all its related entities together:

Plant device overview

Key features:

  • πŸ–₯️ UI-based setup β€” guided multi-step config flow with optional OpenPlantbook search
  • πŸ“Š Per-plant thresholds β€” each threshold is its own entity, adjustable from the UI or via automations
  • 🌀️ Daily Light Integral β€” automatic DLI calculation from illuminance sensors
  • πŸ”„ Live updates β€” change sensors, thresholds, species, or images without restarting HA
  • 🚨 Problem detection β€” configurable per-sensor problem triggers
  • πŸ”Œ Auto-disable β€” sensors without a source entity are automatically disabled

πŸ“¦ Installation

1. Install OpenPlantbook (optional but recommended)

The OpenPlantbook integration automatically fetches species data, thresholds, and images. Without it, you must set all thresholds manually.

  • Install from HACS or manually
  • Register at open.plantbook.io (free)
  • Add your client_id and secret in the integration config
  • Test with the openplantbook.search action

2. Install the Flower Card (optional)

Lovelace Flower Card v2 is the recommended card for displaying plant data. Install via HACS or manually.

3. Install Plant Monitor

Via HACS

  1. Add this repo as a Custom Repository with type Integration
  2. Click Install in the "Plant Monitor" card
  3. Restart Home Assistant

Manual Installation

  1. Copy custom_components/plant/ to your <config>/custom_components/ directory
  2. Restart Home Assistant

After restart, add plants via Settings β†’ Devices & Services β†’ Add Integration β†’ Plant Monitor.


πŸ”§ Setup & Configuration

The config flow guides you through plant setup in four steps:

Step 1: Name & Species

Enter a name for your plant. Optionally enter a species to search OpenPlantbook.

  • If OpenPlantbook is installed and a species is entered, the flow proceeds to species selection
  • If no species is entered (or OpenPlantbook is not installed), the flow skips to sensor selection

Step 2: Select Species (OpenPlantbook only)

If OpenPlantbook found matches, select the correct species from a dropdown list. You can also re-search with a different term if the initial results aren't right.

If the wrong species was selected, you can go back and search again.

Step 3: Select Sensors

Choose which physical sensors to associate with your plant. All sensors are optional and can be added or changed later. Available sensor types:

Sensor Device Class Description
🌑️ Temperature temperature Air temperature
πŸ’§ Soil moisture moisture Soil water content
⚑ Conductivity conductivity Soil nutrient level
β˜€οΈ Illuminance illuminance Light level
πŸ’¨ Air humidity humidity Air moisture
🫧 CO2 carbon_dioxide CO2 concentration
🌑️ Soil temperature temperature Soil temperature

Tip

Sensors without a source entity are automatically disabled. You can add or replace sensors at any time after setup.

Step 4: Set Limits

Configure min/max thresholds for each sensor type. If OpenPlantbook data is available, thresholds are pre-filled automatically. Only thresholds for sensor types selected in the previous step are shown (if no sensors were selected, all thresholds are displayed).

You can also set a custom image URL and display species name on this page.


🌑️ Sensors & Thresholds

All thresholds are their own entities and can be changed from the UI or by automations and scripts. Changes take effect immediately β€” no restart needed.

Threshold entities Threshold config

  • 🌑️ Max/min temperature adapts to your HA unit of measurement (Β°C or Β°F)
  • Threshold values update automatically if you change your HA temperature units

β˜€οΈ Daily Light Integral (DLI)

A Daily Light Integral sensor is automatically created for each plant, measuring the total photosynthetically active light received per day.

DLI sensor

See Wikipedia: Daily Light Integral for background.

Configurable Lux-to-PPFD Conversion

The DLI calculation converts illuminance (lux) to PPFD. The default factor (0.0185) is optimized for sunlight, but different light sources need different factors. Adjust it per plant using the Lux to PPFD factor entity.

For technical details on the DLI calculation pipeline, conversion factors, troubleshooting low readings, and the optional rolling 24-hour sensor, see DLI.md.


πŸ–ΌοΈ Plant Images

The plant image can be set in several ways:

From OpenPlantbook (automatic)

If the species is found in OpenPlantbook, the image URL is fetched automatically. The integration validates that the URL is accessible before using it. If the OpenPlantbook integration is configured to download images, the downloaded files are stored in config/www/images/plants/ by default and referenced as /local/images/plants/.

Custom Images

You can override the image with your own. Supported formats:

Format Example
HTTP/HTTPS URL https://example.com/my-plant.jpg
Local /www/ folder /local/images/plants/my-plant.jpg (file at config/www/images/plants/my-plant.jpg)
Media Source media-source://media_source/local/plants/my-plant.jpg

Note

  • Paths are case-sensitive β€” the filename must match exactly
  • Only media_source/local/ is supported for media source URLs
  • Media source URLs require a compatible Lovelace card (like the Flower Card)

⚠️ Problem Reports

By default, any sensor reading outside its configured threshold triggers a "problem" state on the plant. You can enable or disable problem triggers per sensor type.

Configure via Settings β†’ Devices & Services β†’ Plant Monitor β†’ Your Plant β†’ Configure β†’ Plant properties.

Hysteresis

All threshold checks include a hysteresis band equal to 5% of the min–max range. This prevents rapid flapping between OK and PROBLEM when a sensor value hovers near a threshold.

A plant enters PROBLEM when a value crosses its threshold, but does not return to OK until the value clears the threshold by the band amount. For example, with moisture min=20 and max=60 (range 40, band 2.0):

  • Moisture drops below 20% β€” enters PROBLEM
  • Moisture rises to 21% β€” stays in PROBLEM (below min + band = 22%)
  • Moisture rises to 23% β€” clears to OK

The band scales proportionally with your configured thresholds. No configuration is needed β€” hysteresis is always active.

Note

When a sensor becomes unavailable, the hysteresis state resets. The next valid reading is evaluated fresh against the thresholds.


πŸ”„ Replacing Sensors

You can replace the physical sensor backing a plant measurement at any time β€” no restart needed.

From the Configuration menu (recommended)

  1. Go to Settings β†’ Devices & Services β†’ Plant Monitor β†’ Your Plant β†’ Configure
  2. Select Replace sensors
  3. Change the sensor entity for any sensor type, or clear a field to remove it
image image

Using the plant.replace_sensor action

You can also use the plant.replace_sensor action directly via Developer Tools β†’ Actions:

Replace sensor

action: plant.replace_sensor
data:
  meter_entity: sensor.rose_illumination
  new_sensor: sensor.ble_sensor_12_illumination

To remove a sensor, call the action with an empty new_sensor.

Tip

Use generic entity IDs for physical sensors (e.g. sensor.ble_sensor_1_moisture) and descriptive IDs for plant sensors (e.g. sensor.rose_moisture). This makes it easy to swap hardware without confusion.

Adding a sensor to an existing plant

If you set up a plant without a particular sensor (e.g. you didn't have a CO2 or humidity sensor at the time), that plant sensor entity is automatically disabled. To add the sensor later:

  1. Go to your plant's device page
  2. Find the disabled sensor entity (e.g. "CO2") and enable it
  3. Use Configure β†’ Replace sensors to assign your physical sensor, or use the plant.replace_sensor action

Important

You must enable the plant sensor entity before replacing it β€” Home Assistant hides disabled entities from the entity picker in the UI.


🌻 OpenPlantbook Integration

Requires the OpenPlantbook integration to be installed.

During Setup

When adding a new plant, the config flow searches OpenPlantbook for the species you enter. Matching species are displayed in a dropdown. The selected species' thresholds and image are pre-filled in the limits step.

Note

The OpenPlantbook API does not include your private user-defined species in search results. See "Force Refresh" below for how to fetch data for private species.

Changing Species / Refreshing Data

Go to Settings β†’ Devices & Services β†’ Plant Monitor β†’ Your Plant β†’ Configure β†’ Plant properties.

  • Change species: Enter the new species exactly as the pid in OpenPlantbook (including punctuation). New thresholds and image are fetched automatically.
  • Force refresh: Check this box to re-fetch data from OpenPlantbook without changing the species. Useful for private species not found during initial search. When checked, both the image and display species name are updated.

Note

If the current image points to a local file or non-OpenPlantbook URL, it is not replaced unless "Force refresh" is checked.


πŸƒ Lovelace Card

The Lovelace Flower Card is designed to work with this integration.

Flower card light Flower card dark

The card supports both Β°C and Β°F:

Temperature units


πŸ’‘ Tips & Tricks

For practical tips, template examples, and workarounds β€” including fixing sensors with wrong device_class, auto-watering automations, and problem notifications β€” see TIPS.md.


❓ FAQ

I added the wrong sensors β€” after removing and re-adding the plant, old values still show

Home Assistant remembers old entity configurations. Instead of removing and re-adding a plant, use Configure β†’ Replace sensors (or the plant.replace_sensor action) to swap sensors. See Replacing Sensors.

I can't select the correct sensor type (e.g. Moisture, Humidity) from the dropdown

The sensor dropdowns filter by device_class. Some integrations don't set the correct device class on their sensors.

Solutions:

  1. Report the issue to the physical sensor's integration maintainer
  2. Add the plant without that sensor, then use the plant.replace_sensor action (it doesn't filter by device_class)
  3. Create a template sensor with the correct device class:
template:
  - sensor:
      - name: "Soil Moisture"
        unique_id: "soil_sensor_moisture"
        state: "{{ states('sensor.soil_sensor_soil_moisture') }}"
        unit_of_measurement: "%"
        device_class: "moisture"
My local image path doesn't work

Local images must be in your HA www folder, referenced with the /local/ prefix. The path is case-sensitive.

Path Works?
/local/images/plants/my-plant.jpg βœ… (file at config/www/images/plants/my-plant.jpg)
/local/images/plants/My-Plant.jpg (wrong case) ❌
/mnt/nas/photos/plant.jpg (filesystem path) ❌
file:///config/www/images/plants/my-plant.jpg (file URI) ❌

You can also use media-source:// URLs. See Plant Images.

I removed a sensor but it comes back after restart

When you remove a sensor using Configure β†’ Replace sensors (or plant.replace_sensor with an empty new_sensor), the change is persisted to the configuration. If sensors reappear, update to the latest release.


β˜• Support

If you find this integration useful, consider buying me a coffee: