Skip to content

Getting Xiaomi Mi Flora plant sensors working on HASSio

Xiaomi has a great line of pretty high quality but very inexpensive hardware that you can use in your smart home.  Right now I’m using their plant, door, water, and temperature sensors, as well as their curtain motors.  These plant sensors seem to be the only Xiaomi sensor that I have that is not ZigBee.  So recently, I got another Raspberry Pi (3B+) to be able to pull in my Mi Flora plant sensors from my living room.  There are a ton of tutorials on how to get HASSio loaded on an SD card, so I’ll assume you have Home Assistant up and running.

Here are the steps I used to get my sensors displaying in Home Assistant via the MiFlora component.

  1. If you installed the “SSH server” add-on from the built-in add-on, then remove that one first.
  2. Install the “SSH & Web Terminal” add-on.
    This is in the Official add-ons repository.
  3. Configure the username and password/authorized_keys options.
    Use a complex password here as it checks against Have I Been Pwned database.
  4. Activate ssl on the Web Terminal if you use it.
    If you use this, make sure you have valid keys that you are pointing to.
  5. Start the “SSH & Web Terminal” add-on.
  6. Check the logs of the “SSH & Web Terminal” add-on to see if everything went well.
  7. Open the Web Terminal.  
    https://hassio.local:7681/ if you have not changed anything from default settings.
  8. Reboot the host.
  9. Once rebooted, open the Web Terminal.
  10. Type bluetoothctl to enter the bluetooth controller and then scan on to begin the scanning.
    You will begin to see the list of devices appearing on the scanner.
  11. Now you have everything you need to add the sensors to your config.
  12. Edit you configuration.yaml file and add the following:
  13. Restart your Home Assistant instance and you should get the sensors to appear.
  14. To add them to the UI, I added the following to my lovelace config file:

  15. To make sure I don’t forget about the plants, I’ve added an automation to remind me when it’s time to water my plants:
Published inHome AssistantHome Automation

10 Comments

  1. Charles Caure Charles Caure

    Hi and thanks for your guide!
    I read somewhere that you can install max one mi flora on hassio but I see you have two mi flora installed. How does they work together?

  2. DK DK

    It works fine, I actually have three

  3. eliobou eliobou

    Hello, I run Hassio on Raspberry Pi 3B+ and I have “-bash: bluetoothctl: command not found” when running bluetoothctl command. What can I do ?

  4. DK DK

    Did you follow the instructions and run terminal through elevated privileges?

  5. Anonymous Anonymous

    Hi,
    How do you set commands on elevated privileges on HassOS ?

  6. Dima Dima

    Hey. i added two sensors to my HA. before I found your instructions. but my second sensor shows “unavailable”. can you suggest something?

  7. DK DK

    Do another Bluetooth scan and make sure that sensor is broadcasting an address. I have 4 sensors hooked up to one ESP32 and it’s very reliable.

  8. Dima Dima

    Thanks. I don’t know how, but my 3 sensors are working now. I didn’t do anything, just waited a couple of days

  9. Joe Joe

    Hi, thanks for the guide! I’m planning on putting together a dozen or two of these sensors and feeding the information into a heatmap of moisture and light levels throughout my garden in Lovelace. The only thing Google turned up was something on Azure marketed to large-scale agriculture. Do you know where I should start to create something like that in HA?

  10. DK DK

    I’m not familiar with a Lovelace heatmap card, but it’s likely someone has made a custom card. In any case, you can make your system, after the data is in HA, you can send it to influxdb and use Grafana to make the heat map, and then you can import a Grafana graph back into Lovelace.

Leave a Reply

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