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.
- If you installed the “SSH server” add-on from the built-in add-on, then remove that one first.
- Install the “SSH & Web Terminal” add-on.
This is in the Official add-ons repository.
- Configure the
Use a complex password here as it checks against Have I Been Pwned database.
sslon the Web Terminal if you use it.
If you use this, make sure you have valid keys that you are pointing to.
- Start the “SSH & Web Terminal” add-on.
- Check the logs of the “SSH & Web Terminal” add-on to see if everything went well.
- Open the Web Terminal.
https://hassio.local:7681/ if you have not changed anything from default settings.
- Reboot the host.
- Once rebooted, open the Web Terminal.
- 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.
YAML1234567891011➜ ~ bluetoothctlAgent registered[bluetooth]# scan onDiscovery started[CHG] Controller B8:27:EB:Q7:X0:36 Discovering: yes[NEW] Device C4:7C...[NEW] Device C4:7C:8D:67:2E:99 Flower care[NEW] Device 3E:8A...[NEW] Device D8:0F...[NEW] Device C4:7C:8D:67:2D:91 Flower care[NEW] Device 50:32...
- Now you have everything you need to add the sensors to your config.
- Edit you configuration.yaml file and add the following:
YAML1234567891011121314151617181920212223242526sensor:- platform: mifloramac: 'C4:7C:8D:67:2D:91'name: Ficus Elastica - Rightforce_update: falsescan_interval: 1800# median: 3monitored_conditions:- moisture- light- temperature- conductivity- battery- platform: mifloramac: 'C4:7C:8D:67:2E:99'name: Schefflera Actinophylla - Leftforce_update: falsescan_interval: 1800# median: 3monitored_conditions:- moisture- light- temperature- conductivity- battery
- Restart your Home Assistant instance and you should get the sensors to appear.
- To add them to the UI, I added the following to my lovelace config file:
YAML12345678910111213141516171819202122232425262728293031views:- title: Living Room RPicards:- type: entitiesentities:- entity: sensor.ficus_elastica_right_moisturename: Moisture- entity: sensor.ficus_elastica_right_light_intensityname: Light Intensity- entity: sensor.ficus_elastica_right_conductivityname: Conductivity- entity: sensor.ficus_elastica_right_temperaturename: Temperature- entity: sensor.ficus_elastica_right_batteryname: Batterytitle: Right Ficus Elastica Plantshow_header_toggle: false- type: entitiesentities:- entity: sensor.schefflera_actinophylla_left_moisturename: Moisture- entity: sensor.schefflera_actinophylla_left_light_intensityname: Light Intensity- entity: sensor.schefflera_actinophylla_left_conductivityname: Conductivity- entity: sensor.schefflera_actinophylla_left_temperaturename: Temperature- entity: sensor.schefflera_actinophylla_left_batteryname: Batterytitle: Left Schefflera Actinophylla Plantshow_header_toggle: false
- 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:
YAML12345678910111213- alias: Plant Notificationtrigger:- entity_id: sensor.ficus_elastica_right_moistureplatform: numeric_statebelow: '20'- entity_id: sensor.schefflera_actinophylla_left_moistureplatform: numeric_statebelow: '20'action:- service: persistent_notification.createdata:message: Water the plants!title: Plants needs some TLC!