Page 3 of 3

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Tuesday 19 June 2018 16:15
by tonbor
First accept new sensors as a default in settings. Second choose the plugin at the new hardware list.

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Tuesday 19 June 2018 16:33
by NeoMod
corederoma82 wrote:
Tuesday 19 June 2018 11:38
Hi,
after the installation of the script, how I add the sensor in the dashboard?

Thanks
Let me know how it works out for you.

For me, on Pi 3 B+ with latest Domoticz Beta, the plug-in never worked: the auto-scan feature failed to initialize (generic error code did not help troubleshooting the source problem) and BLE was not triggered properly.

Hence, the sensor (actually 4 dummy dashboard items for temp, hum, lux, and fertilizer) was never added to the dashboard.
Even after forcing “Manual Method” and adding the MiFlower MAC Address the plug-in showed errors while attempting a communication.

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Wednesday 20 June 2018 15:31
by tonbor
The script Works perfectly, the plug-in is worthless. Does NOT work at alllllll :cry:

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Wednesday 11 July 2018 16:33
by blauwebuis
For me the plugin works intermittently.

The problem is difficult to pinpoint.
- Was it a problem with too many devices being called at once? Well, I made it so that it only polls one device per heartbeat. But the problem remained.
- Was it a problem with the switch position? Well, I made it into a push-button now. But the problem remains.
- Is it a problem with the BluePy library? There are similar errors in the library's issue que on Github, but they don't seem to get fixed. One option is to switch to another bluetooth library. I tried to BluePy one because of it's simplicity to install, and it integrates well since it's built in python itself. An alternative option is the Bluez/GATT route, but when people have to (still after all this time) update to a new version of Bluez manually, meaning they have to compile it. This is how the manual script works.
- It could also be a problem with the Domoticz python framework. Python Plugins are not allowed to wait for things. And a plugin of this nature has to wait for the device to be found/communicated with. This could cause the time-out issue. But I simply don't know enough about how the plugin system works internally.

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Wednesday 11 July 2018 17:42
by NeoMod
I don't know about the plug-in (as I said, for me has never worked) but for the other points:

- Try to use Bluez library: easy to install if you are on STRETCH (it's already on the debian repo, nothing more to do than a simple apt-get install bluez) or to manually compile otherwise. It's stable and don't create any problems.
- I have 6 bluetooth devices working fine so I don't thing it's a problem "how many devices" are you trying to pull data from.
- Python framework seems good to me: I'm using other plugins and they are working flawless. But also, I'm using a Python script to pull data from my Mi Flower devices and a simple cronjob to control the timing. So far so good.

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Wednesday 11 July 2018 18:50
by tonbor
11 devices and no problem with the python script and Stretch.

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Tuesday 07 August 2018 0:03
by mariuszwojciuk
Frucoboti wrote:
Thursday 17 May 2018 1:22
Hello,

I always get this error:

2018-05-17 01:15:59.613 User: Admin initiated a switch command (693/Huerto - Flip to update Mi Flowermates/Off)
2018-05-17 01:15:59.630 (Huerto) onCommand called for Unit 1: Parameter 'Off', Level: 0
2018-05-17 01:15:59.630 (Huerto) amount of Flower Mates to now ask for data: 1
2018-05-17 01:16:03.050 (Huerto) getting data from sensor: C4:7C:8D:66:14:E2
2018-05-17 01:16:03.058 Error: (Huerto) 'onHeartbeat' failed 'ImportError'.
2018-05-17 01:16:03.058 Error: (Huerto) ----> Line 247 in /home/pi/domoticz/plugins/Mi_Flower_mate_plugin-master/plugin.py, function onHeartbeat
2018-05-17 01:16:03.058 Error: (Huerto) ----> Line 99 in /home/pi/domoticz/plugins/Mi_Flower_mate_plugin-master/plugin.py, function onHeartbeat
2018-05-17 01:16:03.058 Error: (Huerto) ----> Line 154 in /home/pi/domoticz/plugins/Mi_Flower_mate_plugin-master/plugin.py, function getPlantData
2018-05-17 01:16:03.058 Error: (Huerto) ----> Line 103 in /home/pi/domoticz/plugins/Mi_Flower_mate_plugin-master/miflora/miflora_poller.py, function firmware_version
2018-05-17 01:16:03.058 Error: (Huerto) ----> Line 47 in /home/pi/domoticz/plugins/Mi_Flower_mate_plugin-master/miflora/backends/__init__.py, function __enter__
2018-05-17 01:16:03.058 Error: (Huerto) ----> Line 48 in /home/pi/domoticz/plugins/Mi_Flower_mate_plugin-master/miflora/backends/bluepy.py, function connect

This is on a Rasp3. Bluetooth from raspbian discovers the Mi Flora device, so I supose that Domoticz should discover it too.
I have tested with manual or automatic, with no luck.
When button is pressed turns virtual switch off, and get then the error.

Someone?
Workaround:
Change settings Flora Device from automatic to manual scan and at first device type macaddress of nearest device (i have first dev less than 1m).
for example: C4:7C:8D:XX:XX:XX,C4:7C:8D:XX:XX:XX,C4:7C:8D:XX:XX:XX

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Tuesday 07 August 2018 9:36
by blauwebuis
Thanks Marius! That really seems to confirm that this is a timeout issue, and thus is more about the way that the plugin system works (plugins are not allowed to wait for anything).