আমি কিছু সময়ের জন্য বিভিন্ন হাউস প্ল্যান্টের ডেটা পেতে MiFlora হোম অ্যাসিস্ট্যান্ট ইন্টিগ্রেশনের বিরুদ্ধে মামলা করছি. তবে পথ ধরে আমাকে সীমিত পরিসরের ব্লুটুথ সহ বিভিন্ন বাধা অতিক্রম করতে হয়েছে, ব্যাটারি জীবনের সমস্যা, এবং রিপোর্ট করার জন্য ব্যাটারি মান পেয়ে. আমি অবশেষে মনে হচ্ছে এই সবগুলি ভেঙে ফেলেছি এবং এখন এমন একটি সিস্টেম আছে যা বাড়ির চারপাশে প্রচুর গাছপালা নিয়ে নির্ভরযোগ্যভাবে কাজ করে. আমি নীচে যা ব্যবহার করেছি তা সংক্ষিপ্ত করেছি.
হার্ডওয়্যারের
The first thing to say is that I do have a bluetooth ইউএসবি dongle attached to my home assistant system. This monitors the plants in range directly (i.e. the ones in the same room as the HA box). To monitor more distance devices I have used an ESP32 board with built-in bluetooth module which I have inside a cheap little case and have powered with an old micro-ইউএসবি phone charger
- ইউএসবি Dongle: the one I got is no longer available — due to age — but there are plenty of amazon and elsewhere — just make sure it has support in linux
- ESP32 বোর্ড: আমি একটি পেয়েছিলাম JZK ESP32‑S which is currently £6.49 on amazon
- ESP32 এর জন্য কেস: I found the case for a NodeMCU Wroom-32D (short aerial) fitted my board — this was £4.20 from ইবে
হোম সহকারীর জন্য ইন্টিগ্রেশন
Whilst the basic MiFlora integration is built in to home assistant I found it uses a lot of battery when used natively. পরিবর্তে আমি ব্যবহার Bluetooth Low Energy Monitor 3rd party integration which you can install easily using ল্যাগ
আমি তারপর ইনস্টল ESPHome integration for home assistant to manage my ESP32 BLE repeater
পরিশেষে, to display the plants in a nice way I added a particular fork of the lovelace plant card addon via HACS
কনফিগারেশন
Once BLE Monitor was installed and configured with my bluetooth dongle it picked up the MiFlora sensors within range and listed them in its “devices” drop down as well as listing the devices and entities on it’s card in the HA configuration
The great thing about BLE monitor is that it listens for the sensors to transmit, rather than actively polling them, which would run down their batteries. কীভাবে কখনও, the sensors don’t transmit battery information so to get this we have to actively poll for it. Polling just for this, and passively listening for the other data seems to be the best compromise if you want to have all the data available but also maximise the sensor’s battery life. I have separated my configuration.yaml into multiple separate files to keep things a bit easier to manage so I just have the following line in my configuration.yaml —
সেন্সর: !include sensors.yaml
Then in sensors.yaml I have each plant listed as follows
- প্ল্যাটফর্ম: miflora mac: 'ম্যাক:ঠিকানা:of:পুষ্পিত:সেন্সর:here' name: basil force_update: true scan_interval: 08:00 মধ্যমা: 3 go_unavailable_timeout: 43200 পর্যবেক্ষণ করা_পরিস্থিতি: - ব্যাটারি
Next — to make the plants appear nicely I have a plants config. আগের মতো configuration.yaml-এ একটি লাইন দিয়ে শুরু করতে হবে:
উদ্ভিদ: !plants.yaml অন্তর্ভুক্ত
এবং তারপর plants.yaml আমি নিম্নলিখিত হিসাবে আছে
পুদিনা: সেন্সর: আর্দ্রতা: sensor.ble_moisture_basil battery: sensor.basil_battery temperature: sensor.ble_temperature_basil conductivity: sensor.ble_conductivity_basil brightness: sensor.ble_illuminance_basil min_battery: 15 মিন_উজ্জ্বলতা: 2500 সর্বোচ্চ_উজ্জ্বলতা: 60000 min_temperature: 8 সর্বোচ্চ_তাপমাত্রা: 32 মিন_আর্দ্রতা: 15 সর্বোচ্চ_আর্দ্রতা: 60 min_পরিবাহিতা: 350 সর্বোচ্চ_পরিবাহিতা: 2000
Note the subtle difference between the entity name for the battery compared with the other sensors. The battery entity is coming from the miflora platform in sensors.yaml whilst the other 4 sensors are coming from the BLE integration. There IS a battery entity listed by the BLE integration but this just shows as “unknown” for this plant. This configuration is needed for the plant card to show the plant in a nicely presented way
তারপরে আপনি যে জায়গায় আপনার উদ্ভিদ যোগ করতে চান সেখানে যান এবং লাভলেস প্ল্যান্ট কার্ড যোগ করুন. You will have to “configure” the card manually, but it only takes 3 lines…
টাইপ: কাস্টম:flower-card entity: plant.basil species: বেসিলিক বেসিলিক
Note that the species is listed for 2 reas টার্ন. Firstly it will display the name on the card, কিন্তু আরো ইম্পোর্ট-antly, it will also display a picture of the plant if you have downloaded the plant images and added them into \config\www\images\plants using the latin names — the information on the database is available on the lovelace plant card documentation
প্রসারিত পরিসীমা
পরিশেষে, আমরা পৌঁছতে পারি পরিসীমা প্রসারিত করতে হবে. এর জন্য আমাদের প্রয়োজন ESP32 ডিভাইস. The first thing to do is to get it hooked up to your computer via ইউএসবি এবং একটি মৌলিক ESPHome ইমেজ দিয়ে ফ্ল্যাশ করুন
আমি ব্যবহার ESPHome Flasher এবং cp210x universal windows driver from SiLabs and followed the guide provided by the ESPHome HomeAssistant integration
The config I used for my ESP32 device is below
এসফোম: নাম: jzk-esp-32s platform: ESP32 board: esp32doit-devkit-v1 # Enable logging logger: # Enable Home Assistant এপিআই api: ওয়াইফাই: ssid: !secret wifi_ssid password: !secret wifi_password # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "Esp32 Fallback Hotspot" পাসওয়ার্ড: "random-password-here" external_components: - source: github://myhomeiot/esphome-components esp32_ble_tracker: ble_gateway: ডিভাইস: - mac_address: mac:ঠিকানা:of:পুষ্পিত:সেন্সর:থেকে:monitor:goes:here on_ble_advertise: তারপর: homeassistant.event: event: esphome.on_ble_advertise data: packet: !lambda return packet; myhomeiot_ble_host: myhomeiot_ble_client: - mac_address: mac:ঠিকানা:of:পুষ্পিত:সেন্সর:থেকে:monitor:goes:here service_uuid: '1204' characteristic_uuid: '1A02' update_interval: 4h on_value: তারপর: homeassistant.event: event: esphome.on_ble_advertise data: packet: !lambda |- যদি (x.size() 2) { ESP_LOGE("myhomeiot_ble_client", "payload has wrong size (%D)", x.size()); প্রত্যাবর্তন ""; }; ESP_LOGI("myhomeiot_ble_client", "Battery (%d%%), ফার্মওয়্যার (%গুলি)", এক্স[0], std::string(x.begin(), x.end()).substr(2).c_str()); char buffer[70 + 1]; const uint8_t *remote_bda = xthis.remote_bda(); snprintf(buffer, sizeof(buffer), "043E2002010000%02X%02X%02X%02X%02X%02X14020106030295FE0C1695FE41209800000A1001%02X00", remote_bda[5], remote_bda[4], remote_bda[3], remote_bda[2], remote_bda[1], remote_bda[0], এক্স[0]); return std::string(buffer).c_str();
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 integration which will create a device and entities automatically. Devices pushed in this way do appear to show their batteyr level (thanks to the code at the bottom of the myhomeiot_ble_client section I believe). You then just need to give the device a nice name (and let the entities be renamed too) and then create an entry in plants.yaml with the right entities
হাই,
es gibt doch auch die Version die flora Sensoren via ESP script auszulesen und an den MQTT Broker zu schicken. Finde da leider noch nicht die richtige Beschreibung wie ich dann die in MQTT enthaltenen Daten als Sensor in HomeAssistant publishen kann.
Hier der Link dazu: https://www.barrymercer.co.uk/wordpress/2020/04/27/mi-flora-home-assistant-and-mqtt-gateway/
হাই
হ্যাঁ, I actually use ESP32 repeaters myself now as they are able to use “passive” mode AND collect battery data.
If you have a ইউএসবি bluetooth device then you can pair the MiFlora devices directly to that first and then when you set up the ESP32 it will send the information into HA and it will show up for the correct entities automatically
You need to use the code as I describe in the “Extending range” section.
You also need to have the “Bluetooth Low Energy Monitor” integration installed (via HACS)
If you don’t have a ইউএসবি Bluetooth then there is a way to get the devices to show up in Bluetooth Low Energy Monitor. I can’t remember the link where I read it but I think it’s part of the Bluetooth Low Energy Monitor Wiki or FAQs
If you do it that way then you don’t need to use the manual YAML that Barry uses. His post is from 2020 — I think before Bluetooth Low Energy Monitor could do it or maybe before it even existed.
হ্যালো, thank you for posting this great solution.
Can the esp32 Bluetooth gateway transmit 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 transmit data for any BT devices within range I believe although as mine is currently only used for 1 BT device I can’t confirm 100% — but that is certainly my understanding