MiFlora Sensor Plant Database

UPDATE 3:
Please have a look at this thread from @slaxor.

UPDATE 2:
I have removed the link to the google doc because people still requested access and it was pretty annoying :slight_smile:

UPDATE:
Please have a look at this post. The Xiaomi Database was completely scraped and there is a nice custom card to visualise the plant data: MiFlora Sensor Plant Database - #22 by iantrich


ORIGINAL POST:

I’ve had the idea of starting a collaborative plant database for the MiFlora plant sensor.

I’ve added 5 plants I currently have in my home and the according values (based on experience) for moisture and a link to the image of the plant from Wikipedia. Values for conductivity are currently empty because I’ve never fully understood what it does.

Maybe it’s possible in the future to automatically fetch the image and values directly from Homeassistant when setting up a plant monitor.

Feel free to contribute.

28 Likes

My view is that conductivity is to determine if you need to add fertilizer to the soil, or replace the soil altogether.

Perhaps it’s possible to tap into the mi flora database and pick some values? There used to be a database for the parrot flower power device, but it seems to have shut down.

Isn’t it possible to somehow retrieve the database from Xiaomi? The MiFlora app already have a great amount of plants already laid out with all the values. Sadly I don’t have the knowledge to even know where to start getting that info into HA…

So far as I can tell, that information isn’t stored locally on the device (the database doesn’t show anything). It must be stored in their cloud.

Maye it’s stored on device with miapp <= 5.0.0? Like for the token for some devices ?

Not a programmer, but some things I found that may be useful:

Decompiled Android app: http://www.javadecompilers.com/data/22.05.18/5234289d435797051e8dcf5b4d2ba0f8/FlowerCare-5.3.0-APKTurbo.com_source_from_JADX.zip
Mirror: https://mega.nz/#!RRtXUARS!6b3eeNa5XfJvhj6lRa_o_DciShwdZdOMnSvhkGtybYQ
Looks like a key file: https://hastebin.com/ufuneyokaf.java
Some work already done figuring out the JSON request: Xiaomi Mi Plants Monitor Flower
Related Android apps:
https://play.google.com/store/apps/details?id=com.xiaomi.smarthome
https://play.google.com/store/apps/details?id=com.huahuacaocao.flowercare
https://play.google.com/store/apps/details?id=com.chug.northconnectedhome

1 Like

That was the database I checked – didn’t see anything.

we’ll try to contribute for some plants.

any luck so far on polling https://api.huahuacaocao.net/api ?

Hey @ggravlingen @petrepa @bachya @thundergreen @benji @benovic, it’s been a while. The database is now about 40 plants and i made a feature request in the forum. Maybe you’d like to contribute and upvote: Integration of user generated Flower/Plant database into plant monitor component

Thanks

2 Likes

Upvoted! Have you checked pypi and github IF there are any libraries that would support this? It would make it easier to implement as HA requires logic of components to be put in separate libs. HA only sends data between the user and the lib (in somewhat simplified terms.)

@benji, @jones
I have managed to reverse energier the API, i have written code to dump all data.
I still need to write code to download the images.

I’m still a bit unsure how to share this? (currently its in a sqlite database file).

Are there any services that are free where i could host the data and make it searchable in a good way?

2 Likes

Great work!

I am unaware of any services like that. However, I would be happy to write something up to display the db and host it with some API access. Is that legal? Perhaps it’s best to query the official API via component for that data. Let me know.

I have no idea what is legal or not, on the other hand this might increase the amount of units they sell they should be happy? :slight_smile:
Common for all requests:

POST
https://eu-api.huahuacaocao.net/api/v2
X-Hhcc-Region: EU

To login:

X-Hhcc-Token: 
X-Real-Ip: 192.168.0.1
Content-Type: application/json; charset=utf-8
Content:
{
    "data": {
        "email": "email",
        "password": "password"
    },
    "extra": {
        "app_channel": "google",
        "country": "CN",
        "lang": "en",
        "model": "",
        "phone": "samsung_SM-G955F_26",
        "position": [
            null,
            null
        ],
        "version": "AS_3044_5.4.6",
        "zone": 1
    },
    "method": "GET",
    "path": "/token/email",
    "service": "auth"
}

Extract data.token from the response
From now on use that value in the X-Hhcc-Token header.

Search:

{
    "data": {
        "alias": "a", <- Search string
        "count": 40, <- Start position
        "lang": "en",
        "limit": 20 <- Max count
    },
    "extra": {
        "app_channel": "google",
        "country": "CN",
        "lang": "en",
        "model": "",
        "phone": "samsung_SM-G955F_26",
        "position": [
            null,
            null
        ],
        "version": "AS_3044_5.4.6",
        "zone": 1
    },
    "method": "GET",
    "path": "/plant/alias",
    "service": "pkb"
}

to get all details:

{
    "data": {
        "lang": "en",
        "pid": "abelia chinensis" <-- pid from the search function
    },
    "extra": {
        "app_channel": "google",
        "country": "CN",
        "lang": "en",
        "model": "",
        "phone": "samsung_SM-G955F_26",
        "position": [
            null,
            null
        ],
        "version": "AS_3044_5.4.6",
        "zone": 1
    },
    "method": "GET",
    "path": "/plant/detail",
    "service": "pkb"
}

The code i have written is in C# if any one wants it please tell me and i will share it.

5 Likes

Oh wow! Brilliant! Imagine to configure a plant from the Hass UI in the Browser including a search box where you can enter a plants name, a list of matching results and then you pick the right plant and all the info gets fetched automatically.

Sadly I’m no good with python, so i can’t add the needed components to Home Assistant.

Thanks so much for your work reverse engineering the database AnderssonPeter :smile:

I managed to rip and dump the database and its images using a quick python script. It’s up on GitHub now, hopefully it’s of some use to this community and helps see that sensor really achieve its potential :smiley:

4 Likes

Can’t wait! (I’m not a programmer so unfortunately I can’t implement it)

I would like to try and do something with this. I don’t really know how it would be best implemented. Anyone have any ideas? I was thinking maybe adding a config option for the plant sensor that would be “plant type” and if used it would automatically get all the info on max and min moisture etc from the db. But I don’t know how to best present the different plants to choose from… Would one also like to add an entity image from the images in the db?

3 Likes

I recon it would be best in the plant sensor and then an attribute in the sensor would be plant type (as a drop down) with a catch for for plants that don’t exist or for customised options. You should then be able to to customise image (default being from db), plant name (for UI) etc

I will be happy to help test from a use case basis but no idea how to integrate into HA

You don’t happen to have that script to share?