DIY وسائل الإعلام الرئيسية الشعار

الموقع النهائي لتصميم وإنشاء مسرح منزلي الخاص ومرحبا فاي الإعداد الخاصة.

2مستشعرات نباتات MiFlora في مساعد المنزل

I’ve been suing the MiFlora Home Assist­ant integ­ra­tion to get data on vari­ous house plants for a while. How­ever along the way I’ve had to over­come vari­ous hurdles includ­ing lim­ited range of bluetooth, bat­tery life issues, and get­ting the bat­tery val­ues to report. I finally seem to have cracked all of these and now have a sys­tem that works reli­ably with lots of plants around the house. I’ve sum­mar­ised what I’ve used below.


The first thing to say is that I do have a bluetooth USB dongle attached to my home assist­ant sys­tem. This mon­it­ors the plants in range dir­ectly (بمعنى آخر. تلك الموجودة في نفس غرفة صندوق HA). To mon­it­or more dis­tance devices I have used an ESP32 board with built-in bluetooth mod­ule which I have inside a cheap little case and have powered with an old micro-USB شاحن الجوال

  • USB دونجل: the one I got is no longer avail­able — due to age — but there are plenty of amazon and else­where — just make sure it has sup­port in linux
  • لوحة ESP32: لدي JZK ESP32‑S which is cur­rently £6.49 on amazon
  • الحال بالنسبة لـ ESP32: I found the case for a NodeM­CU Wroom-32D (short aer­i­al) fit­ted my board — this was £4.20 from موقع ئي باي

تكامل مساعد المنزل

Whilst the basic MiFlora integ­ra­tion is built in to home assist­ant I found it uses a lot of bat­tery when used nat­ively. بدلاً من ذلك ، أستخدم ملف Bluetooth Low Energy Mon­it­or 3بحث وتطوير party integ­ra­tion which you can install eas­ily using بطئ
ثم قمت أيضًا بتثبيت ESPHome integ­ra­tion for home assist­ant to man­age my ESP32 BLE repeater
أخيرا, to dis­play the plants in a nice way I added a par­tic­u­lar fork of the lovelace plant card addon via HACS


Once BLE Mon­it­or was installed and con­figured with my bluetooth dongle it picked up the MiFlora sensors with­in range and lis­ted them in its “devices” drop down as well as list­ing the devices and entit­ies on it’s card in the HA configuration
The great thing about BLE mon­it­or is that it listens for the sensors to trans­mit, rather than act­ively polling them, which would run down their bat­ter­ies. ومع ذلك, the sensors don’t trans­mit bat­tery inform­a­tion so to get this we have to act­ively poll for it. Polling just for this, and pass­ively listen­ing for the oth­er data seems to be the best com­prom­ise if you want to have all the data avail­able but also max­im­ise the sensor’s bat­tery life. I have sep­ar­ated my configuration.yaml into mul­tiple sep­ar­ate files to keep things a bit easi­er to man­age so I just have the fol­low­ing line in my configuration.yaml —

Then in sensors.yaml I have each plant lis­ted as follows

Next — to make the plants appear nicely I have a plants con­fig. كما كان من قبل سطر واحد في التكوين. yaml لتبدأ به: 

ثم في النباتات. yaml لدي ما يلي

Note the subtle dif­fer­ence between the entity name for the bat­tery com­pared with the oth­er sensors. The bat­tery entity is com­ing from the miflora plat­form in sensors.yaml whilst the oth­er 4 sensors are com­ing from the BLE integ­ra­tion. There IS a bat­tery entity lis­ted by the BLE integ­ra­tion but this just shows as “unknown” for this plant. This con­fig­ur­a­tion is needed for the plant card to show the plant in a nicely presen­ted way
ثم انتقل ببساطة إلى المكان الذي تريد إضافة نباتك إليه وأضف بطاقة نبات الحب. You will have to “con­fig­ure” the card manu­ally, but it only takes 3 lines…

Note that the spe­cies is lis­ted for 2 REAS فيرفكس. Firstly it will dis­play the name on the card, ولكن أكثر استيراد وantly, it will also dis­play a pic­ture of the plant if you have down­loaded the plant images and added them into \config\www\images\plants using the lat­in names — the inform­a­tion on the data­base is avail­able on the lovelace plant card documentation

توسيع النطاق

أخيرا, نحن بحاجة إلى توسيع النطاق الذي يمكننا الوصول إليه. لهذا نحتاج إلى جهاز ESP32. The first thing to do is to get it hooked up to your com­puter via USB وفلاشها بصورة أساسية ESPHome
لقد استخدمت ESPHome Flash­er و cp210x uni­ver­sal win­dows driver from SiL­abs and fol­lowed the guide provided by the ESPHome Home­As­sist­ant integration
The con­fig I used for my ESP32 device is below

Then save and update to your esp32 device via wifi. The ESP32 device will pick up the data from the miflora sensor and will ‘push’ it via wifi to the BLE integ­ra­tion which will cre­ate a device and entit­ies auto­mat­ic­ally. Devices pushed in this way do appear to show their bat­teyr level (thanks to the code at the bot­tom of the myhomeiot_ble_client sec­tion I believe). You then just need to give the device a nice name (and let the entit­ies be renamed too) and then cre­ate an entry in plants.yaml with the right entities

وجدت هذا مفيدا? يرجى إعلامنا عن طريق إسقاط التعليق أدناه. إذا كنت ترغب في الاشتراك يرجى استخدام الرابط الاشتراك في القائمة في اعلى اليمين. يمكنك أيضا مشاركة هذا مع أصدقائك باستخدام الروابط الاجتماعية أدناه. في صحتك.

اترك رد

2 تعليقات


مرحبًا, thank you for post­ing this great solution.
Can the esp32 Bluetooth gate­way trans­mit data more than one bluetooth device or or do you have to provide one ESP 32 for each Bluetooth device we want to extend the range for?

غرفترجون سكيف

Hi Tony
The ESP will trans­mit data for any BT devices with­in range I believe although as mine is cur­rently only used for 1 BT device I can­’t con­firm 100% — but that is cer­tainly my understanding