Monitor your plants with Home Assistant

I love to have a lot of plants in my apartment, but unfortunately I sometimes forget to water them. So why not using modern technology to make sure, I don’t ever forget it again.

What you need

  • A Raspberry Pi or a Linux-PC with a supported Bluetooth LE interface.
  • Bluez
  • Mi Plant flower sensor for every plant
  • Home assistant


Home assistant

First you should install Home Assistant and make sure everything works well. Home assistant provides good documentation how to setup the platform.

Bluetooth software

The Linux bluetooth software might not yet be installed on your system.

Check communication with the plant sensor

The easiest way to make sure your PC can read data from the sensor is using the hcitool command line tool.

hcitool lescan
LE Scan ...
XX:XX:XX:XX:XX:XX (unknown)
XX:XX:XX:XX:XX:XX Flower mate

It might list a lot of other devices. Just make sure, it can also see the “Flower mate” device. If you can’t see this device, the distance between the flower sensor and your PC might be too large. Try moving the plant near your PC and check if it works then.

Integrate polling into Home Assistant

First, you need to poll the data from the sensor in Home Assistant:

  platform: miflora
  mac: xx:xx:xx:xx:xx:xx
  name: Flower 1
  force_update: false
   - moisture
   - light
   - temperature
   - conductivity

As the MAC address, you need to use the address that is shown in the hcitool lescan output.

Notify yourself when you come home

It doesn’t make much sense to send you a notification during the day that you should water the flowers. You might have forgotten it already when you come home. So let’s just send a notification when you come home.

Setup presence detection

Home Assistant documentation how to do this. There are a lot of different device trackers. Have a look and decide what works best for you.

Setup notifications

The next step is sending a notification to you. For this guide I use Pushetta, but Home Assistant provides a large number of notification mechanisms. Have a look at them and select the one that fits best for you.

An example notifier configuration might look like this:

  name: pushetta
  platform: pushetta
  channel_name: mychannel
  api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Define the automation

Now comes the new rule:

  alias: Alarm me to water plants
    platform: state
    entity_id: device_tracker.myname
    from: 'not_home'
    to: 'home'
    condition: numeric_state
    entity_id: sensor.flower1_moisture
    below: 20
    service: notify.pushetta
      message: 'Water Flower 1!'

What does this do? First it checks it check, if you came from (device tracker changes from not_home to home) and check then if the moisture is below a well-defined threshold. The value might be a bit different for your plant, you need to adjust this. If the moisture is too low, it sends a notification via Pushetta.

You can combine multiple plants in the condition statement or create an automation for every single plant. I personally prefer the latter as I then know exactly which plant I should water.

Long-term monitoring

It often helps to have long-term data available to optimize not only watering, but also fertilize in the right intervals. While you can store the whole history within Home assistant, it isn’t really optimized for this use case. Therefore I recommend to use InfluxDB for this. This is a time-series database specifically designed to store sensor data over a long period. To visualize the data, I use Grafana. With this, you can create nice reports like this:

Low costs temperature & humidity sensors

The first thing you usually start when you implement environment measurements is temperature and humidity. These are not only important for the personal comfort, but also easy to measure. Most people use DHT sensors for this. They are cheap and easy to connect to an Arduino, ESP8266 or Raspberry Pi. There are also tons of software snippets and libraries around, which makes integration very easy. How do they differ? Are there alternatives?


This sensor is the smallest of the 3 DHT versions. It has a blue color and it is the smallest of the 3. It is also the cheapest. Humidity and temperature resolutions is only full degree/%.
It can be directly soldered onto a PCB or simply plugged into a breadboard, which makes it great for initial prototypes.


This one looks similar to the DHT11, but is larger and white. Its resolution is 0.1°/0.1%. It also can be directly soldered onto a PCB or plugged into a breadboard.

AM2301 (DHT21)

This is the largest version. It comes with cables. This makes solder-free prototyping a bit challenging, but if you already have soldering equipment, this shouldn’t be an issue. The bulky design and cables makes it a good choice for bigger designs. It is especially useful if your circuit uses a lot of energy and heats up its environment.


How accurate are these sensors? As the DHT11 has only 1°/1% resolution, you might expect a lower accuracy. However, don’t mistake resolution for accuracy. We could also read the data sheets. However, I recommend checking out Robert’s page. He did a lot of measurements and found out that the DHT11’s performance is similar to the DHT22.
However, I would still recommend the AM2301 or DHT22 for another reason. While the absolute accuracy might not be perfect, the increases resolution still is helpful. There isn’t a lot of visible noise on the measurement. This helps you to understand trends a bit better. Especially in modern buildings, temperature changes very slowly. Even if you turn off the heating, it might take hours until the temperature is down by a single degree. With a 0.1% temperature resolution you see these trends much better than with 1%.

Have a look at these measurements:
It is easy to see there there is a slight downward trend in the 0.1% sensor data (green line), but it is hard to figure out if there is any trend in the 1% sensor data (orange line).


I’ve read some remarks on the internet about defective sensors. For a long time I never had issues, but when I moved a prototype on a breadboard to another room, the measurements looked like this:
Screenshot 2016-08-01 09.58.35
This is clearly not correct. The new measurements show so much noise that they are basically useless. It seems that the sensor had been damaged somehow. I’m not sure, if the reason was ESD or anything else happened.


I would not recommend the DHT11 for any real-world measurements in home automation as the 1°/1% resolution is problematic. Depending on your use case, choose between the DHT21 and DHT22. Make sure you mount the sensor away from any part that dissipates heat. Otherwise your measurements will be completely wrong!

Teardown: Mi Thermometer/humidity sensor

Many people know Xiaomi for their smartphones. They are becoming more and more popular also in Europe. However, in their home market in China they sell also smarthome components. As many of these systems they use a central hub that connects to and controls sensors and actuators. One sensor that I personally found very interesting is the Mi temperature/humidity sensor. With it’s diameter of only 36mm, you can install it almost everywhere.

One thing, you will notice is that the build quality is very good. The case is plastics, but still feels very well made.

Is this sensor locked to the Xiaomi smart hub or can you use it also in DIY environments? Let’s open it and see how it works.


The device is powered by a small CR2032 cell. Let’s hope this one lasts at least a year. But let’s check the main board which will tell us more about how this thing works:


It also looks very well-designed and assembled. The main processor is a JN5169 from NXP. It is a Zigbee controller. Do you remember Zigbee? While today most new designs use Bluetooth LE, Zigbee is still there. And it works quite well, so why not use it. The only thing that makes it a bit harder to use is the fact that no PC comes with an integrated Zigbee interface. That means you need to have an additional Zigbee controller connected to your PC, Raspberry Pi or Arduino to read data from this sensor. Is it easy to integrate? We don’t know yet, but we will look into this in the future.