Giter VIP home page Giter VIP logo

mi_flower_mate_plugin's Introduction

Mi_Flower_mate_plugin

This plugin is no longer maintained, as I am now using https://www.candlesmarthome.com

A plugin for Domoticz, the open source home automation software, which allows it to easily connect to Xiaomi Mi Flower Mate devices. To be noted : it may also works for other sensors than Xiaomi like E-Greetshopping (https://www.amazon.ca/Greetshopping-Monitor-Moisture-Detector-Suitable/dp/B08X2B18R5) or others that are compliant with Android Flower care App for instance (https://play.google.com/store/apps/details?id=com.huahuacaocao.flowercare&hl=en&gl=US)

These are Bluetooth LE plant monitoring devices which cost about 12 dollars. They last up to a year on a coincell battery, and measure moisture, temperature, light and conductivity. https://wiki.hackerspace.pl/projects:xiaomi-flora

The plugin creates a special switch. Toggle the switch to get fresh data from all sensors. By having a switch to poll for new data, it becomes easy to create timers and other fun integrations in scripts. Remember that frequent polling results in draining batteries of the devices.

The plugin also creates for each sensor 4 devices :

A Temperature device for the air temperature read from the sensor
A Moisture device for the soil humidity percentage read from the sensor
A Light device for reading the number of Lux from the sensor
A Conductivity device for reading the "soil fertility" from the sensor (micro Siemens by centimeter)

The plugin now also has an "automatic" mode, where it will do a bluetooth scan for devices everytime Domoticz starts, and automatically add new devices it finds.

Links

Detailed installation instructions can be found on the Domoticz wiki: https://www.domoticz.com/wiki/Plugins/Mi_flower_mate

Discussion about the plugin can be found here: https://www.domoticz.com/forum/viewtopic.php?f=65&t=22281

Installation (short version)

Install the plugin as usual. See: https://www.domoticz.com/wiki/Using_Python_plugins

You also need the Bluepy library to be installed.

wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
sudo python3 -m pip install bluepy

Alternatively, you can use apt-get, but might install python 3.5 as well. If you are trying to stay on python 3.4, use the wget method above.

sudo apt-get install python3-pip libglib2.0-dev
sudo pip3 install bluepy

In automatic mode, the plugin will do bluetooth scans at startup, and integrate any Mi Flora Devices it finds.

In manual mode you can select which devices to add by entering their mac addresses on the hardware page. To find your Flower Mates' mac-addresses do a bluetooth scan:

sudo hcitool lescan

Thanks to

This plugin builds on the work by Daniel Matuschek, who created a great library for the Flower Mate devices.
https://pypi.python.org/pypi/miflora

It also builds on the original domoticz script created by Tristan:
https://github.com/Tristan79/miflora

mi_flower_mate_plugin's People

Contributors

babaisyou avatar flatsiedatsie avatar lboue avatar szemisun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mi_flower_mate_plugin's Issues

Unable to fetch data

Getting the following error with my new sensors and a fresh install of domoticz (stable) and the current version of the plugin:

2018-06-22 16:42:21.190 EventSystem: Started
2018-06-22 16:42:21.448 (Xiaomi Mi Flower Mate) Initialized version 1.0.0, author 'blauwebuis'
2018-06-22 16:42:21.451 (Xiaomi Mi Flower Mate) Automatic mode is selected
2018-06-22 16:42:21.451 (Xiaomi Mi Flower Mate) Scanning for Mi Flower Mate sensors
2018-06-22 16:42:21.557 (Xiaomi Mi Flower Mate) Already known devices:['C4:7C:8D:63:8F:54', 'C4:7C:8D:63:4A:42']
2018-06-22 16:42:26.730 (Xiaomi Mi Flower Mate) Number of devices found via bluetooth scan = 1
2018-06-22 16:49:59.168 User: Admin initiated a switch command (1/Xiaomi Mi Flower Mate - update Mi Flowermates/On)
2018-06-22 16:49:59.209 (Xiaomi Mi Flower Mate) amount of Flower Mates to now ask for data: 2
2018-06-22 16:50:07.675 (Xiaomi Mi Flower Mate) getting data from sensor: C4:7C:8D:63:8F:54
2018-06-22 16:50:47.886 Error: (Xiaomi Mi Flower Mate) 'onHeartbeat' failed 'BTLEException'.
2018-06-22 16:50:47.886 Error: (Xiaomi Mi Flower Mate) ----> Line 250 in /home/pi/domoticz/plugins/Mi_Flower_mate_plugin/plugin.py, function onHeartbeat
2018-06-22 16:50:47.886 Error: (Xiaomi Mi Flower Mate) ----> Line 102 in /home/pi/domoticz/plugins/Mi_Flower_mate_plugin/plugin.py, function onHeartbeat
2018-06-22 16:50:47.886 Error: (Xiaomi Mi Flower Mate) ----> Line 157 in /home/pi/domoticz/plugins/Mi_Flower_mate_plugin/plugin.py, function getPlantData
2018-06-22 16:50:47.886 Error: (Xiaomi Mi Flower Mate) ----> Line 103 in /home/pi/domoticz/plugins/Mi_Flower_mate_plugin/miflora/miflora_poller.py, function firmware_version
2018-06-22 16:50:47.886 Error: (Xiaomi Mi Flower Mate) ----> Line 47 in /home/pi/domoticz/plugins/Mi_Flower_mate_plugin/miflora/backends/init.py, function enter
2018-06-22 16:50:47.886 Error: (Xiaomi Mi Flower Mate) ----> Line 55 in /home/pi/domoticz/plugins/Mi_Flower_mate_plugin/miflora/backends/bluepy.py, function connect
2018-06-22 16:50:47.886 Error: (Xiaomi Mi Flower Mate) ----> Line 353 in /usr/local/lib/python3.5/dist-packages/bluepy/btle.py, function init

Poller error?

I updated my Domoticz, and now when I use the 'update flowermates' switch in Domoticz, I recieve this errors. Before updating it all worked fine, but now I don't know how to fix it:

2019-10-27 11:07:59.562 (Plantsensor) amount of Flower Mates to now ask for data: 1
2019-10-27 11:07:59.563 (Kappelt gBridge) Message from base
2019-10-27 11:07:59.563 (Kappelt gBridge) Incoming message!{'Verb': 'PINGRESP'}
2019-10-27 11:07:59.517 Status: User: pi initiated a switch command (24/Plantsensor - update Mi Flowermates/On)
2019-10-27 11:08:00.015 (Plantsensor) getting data from sensor: C4:7C:8D:66:E4:3B
2019-10-27 11:08:16.839 (Plantsensor) poller error
2019-10-27 11:08:24.387 Kodi: Restarting I/O service thread.
2019-10-27 11:08:31.042 (Plantsensor) error getting moisture data
2019-10-27 11:08:31.043 (Plantsensor) error getting temperature data
2019-10-27 11:08:31.044 (Plantsensor) error getting light data
2019-10-27 11:08:31.045 (Plantsensor) Error getting conductivity data

Conductivity devices created without unit

Hi,

The conductivity devices are created without any unit, then when someone want to change something (description, icon, name ...) it generates a pop-up in Domoticz asking for a unit before saving modifications. When you add a default unit (ie : µS/cm that seems to be the unit in apps) this is correct and you can save your changes.

Can it be added at the creation of the device ?

Strange error

Hi,

I'm trying to get it to work, but always end up with the following errors in the log

`2018-05-28 21:42:37.073 Error: Expected: myVar = Domoticz.Device(Name="myDevice", Unit=0, TypeName="", Type=0, Subtype=0, Switchtype=0, Image=0, Options={}, Used=1)

2018-05-28 21:42:37.073 Error: (Flower) 'CDevice_init' failed 'TypeError':'an integer is required (got type str)'.

2018-05-28 21:42:37.073 Error: Device creation failed, Device object is not associated with a plugin.

2018-05-28 21:42:42.406 Error: (Flower) 'onStart' failed 'KeyError'.

2018-05-28 21:42:42.406 Error: (Flower) ----> Line 237 in
/home/proha/domoticz/plugins/Mi_Flower_mate_plugin/plugin.py, function onStart

2018-05-28 21:42:42.406 Error: (Flower) ----> Line 67 in /home/proha/domoticz/plugins/Mi_Flower_mate_plugin/plugin.py, function onStart

2018-05-28 21:42:42.406 Error: (Flower) ----> Line 229 in /home/proha/domoticz/plugins/Mi_Flower_mate_plugin/plugin.py, function floraScan

2018-05-28 21:42:42.406 Error: (Flower) ----> Line 126 in /home/proha/domoticz/plugins/Mi_Flower_mate_plugin/plugin.py, function createSensors`

I'm running Domoticz Version: 3.9527, Debian 8. Any idea what could be wrong?
I can't seem to add the flora either automaticly or manually.

wrong soil moisture unit measurement

Hi,
sorry for my poor english.
In first, thanks a lot for this great plugin that simplify the integration of the mi plant in domoticz.

I just want report the wrong unit of measurement used in domoticz for the mi plant.
The Mi plant indicate a percentage and not a centibar (cb) for the soil humidity.

How (where) to change it in the plugin? I don't find anything in miflora_poller.py elsewhere.

Thanks for your answer

Mi_Flower_mate_plugin // Debian 11 / Python3.9

Hi

I tried to upgrade to raspi OS Debian 11 64 bits et mi flora is broken.

i suppose it's because python version is now 3.9 instead of 3.7

someone can confirm et maybe found solution ?

Thanks !

Report FlowerMate Moisture sensor as an humidity sensor

Hello,

Could you help me to report FlowerMate Moisture sensor as an humidity sensor in Domoticz. This is better because it can be exported and recognized by HomeKit.

Currently it is reported as a 'General Percentage' sensor.

lowerMate Moisture sensor exemple

flowermate_moisture

Xiaomi Temp+humidity sensor exemple

xiaomi_humidity_exemple

Regards,
Ludovic

Issue creating new entry

I installed the plugin and when I start it I can see this in the logs (debugging on):

2018-09-16 12:17:58.558 (MIF2) Number of devices found via bluetooth scan = 1
2018-09-16 12:17:58.559 (MIF2) Creating new sensors
2018-09-16 12:17:58.559 (MIF2) Creating new sensors for Mi Flower Mate at C4:7C:8D:66:17:56
2018-09-16 12:17:58.559 (MIF2) Creating first sensor, #2
2018-09-16 12:17:58.560 (MIF2) Creating first sensor, name: #0 Moisture
2018-09-16 12:17:58.560 (MIF2) Creating device '#0 Moisture'.
2018-09-16 12:17:58.560 Error: (MIF2) 'onStart' failed 'KeyError'.
2018-09-16 12:17:58.560 Error: (MIF2) ----> Line 238 in '/home/cristiano/domoticz/plugins/MIFlower/plugin.py', function onStart
2018-09-16 12:17:58.560 Error: (MIF2) ----> Line 68 in '/home/cristiano/domoticz/plugins/MIFlower/plugin.py', function onStart
2018-09-16 12:17:58.560 Error: (MIF2) ----> Line 230 in '/home/cristiano/domoticz/plugins/MIFlower/plugin.py', function floraScan
2018-09-16 12:17:58.561 Error: (MIF2) ----> Line 127 in '/home/cristiano/domoticz/plugins/MIFlower/plugin.py', function createSensors

Sensors are not created.

Can you please help?

MiFlora on remote domoticz ?

Hi

I want to scan 1 mi flora with another domoticz (so in slave)
It's work on slave raspberry but remote access dont send on master domoticz.
did someone manage to do that?

Thank you !

Error in log when polling sensor for data

I added the MAC addresses of my Flower Mates to the configuration and set the device selection to manual.
However when the plugin is trying to get sensor data the following error appears in the log:

2018-05-10 06:59:47.415 (Xiaomi Mi Flower) getting data from sensor: C4:7C:8D:66:31:E9
2018-05-10 06:59:47.430 Error: (Xiaomi Mi Flower) 'onHeartbeat' failed 'ImportError'.
2018-05-10 06:59:47.430 Error: (Xiaomi Mi Flower) ----> Line 247 in /home/pi/domoticz/plugins/Mi_Flower/plugin.py, function onHeartbeat
2018-05-10 06:59:47.430 Error: (Xiaomi Mi Flower) ----> Line 99 in /home/pi/domoticz/plugins/Mi_Flower/plugin.py, function onHeartbeat
2018-05-10 06:59:47.430 Error: (Xiaomi Mi Flower) ----> Line 154 in /home/pi/domoticz/plugins/Mi_Flower/plugin.py, function getPlantData
2018-05-10 06:59:47.430 Error: (Xiaomi Mi Flower) ----> Line 103 in /home/pi/domoticz/plugins/Mi_Flower/miflora/miflora_poller.py, function firmware_version
2018-05-10 06:59:47.430 Error: (Xiaomi Mi Flower) ----> Line 47 in /home/pi/domoticz/plugins/Mi_Flower/miflora/backends/__init__.py, function __enter__
2018-05-10 06:59:47.430 Error: (Xiaomi Mi Flower) ----> Line 48 in /home/pi/domoticz/plugins/Mi_Flower/miflora/backends/bluepy.py, function connect

several bluetooth adaptators

Hi, thanks for the plugin, it works very well, (except when it's out of range, and it crashes the plugin entirely...)

I would like to know if it is possible to add an usb bluetooth on the raspberry pi 3, and also use the bluetooth inside the raspberry pi 3, I explain:

I would like to fetch data for several sensors near the raspberry pi with the inside bluetooth adaptator, (that working great for now) but for the sensors out of range, I would like to use another usb bluetooth adaptator on the raspberry pi with a usb cable to reach them.

so I would like to configure the plugin to use both adaptator. (or even configure 2 new hardwares miflora on domoticz, one with each bluetooth adaptator, a simple way to separate the devices out of range from the others)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.