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.
- Mi Plant flower sensor for every plant
- Home assistant
First you should install Home Assistant and make sure everything works well. Home assistant provides good documentation how to setup the platform.
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:
sensor platform: miflora mac: xx:xx:xx:xx:xx:xx name: Flower 1 force_update: false monitored_conditions: - 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 detectionHome Assistant documentation how to do this. There are a lot of different device trackers. Have a look and decide what works best for you.
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:
notify name: pushetta platform: pushetta channel_name: mychannel api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Define the automation
Now comes the new rule:
automation: alias: Alarm me to water plants trigger: platform: state entity_id: device_tracker.myname from: 'not_home' to: 'home' condition: condition: numeric_state entity_id: sensor.flower1_moisture below: 20 action: service: notify.pushetta data: 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.
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: