flatsiedatsie / Mi_Flower_mate_plugin

A plugin for Domoticz, the open source home automation software, which allows it to easily connect to Xiaomi Mi Flower Mate devices
GNU General Public License v3.0
13 stars 5 forks source link

Unable to fetch data #3

Closed m0rph13 closed 5 years ago

m0rph13 commented 6 years ago

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

m0rph13 commented 6 years ago

Moving the first sensor closer to the RPi makes the above problem go away after a full restart of RPI.

So, whenever a sensor is out of range, the plugin crashes and will not work until RPi/Domoticz is restarted..

asquelt commented 5 years ago

i confirm. poller is not wrapped in try/expect, so if the poller fails the whole plugin goes down.

flatsiedatsie commented 5 years ago

Thanks! @asquelt could you propose code to fix it?

asquelt commented 5 years ago

i did a quick fix, just wrapping arround with try/expect. but i went for vacation and after few weeks entire Domoticz has stalled. so there must be a deadlock somewhere and entire plugin needs to be audited for that. i haven't had time since then to look into that.

flatsiedatsie commented 5 years ago

Could you share the wrapped version?

adrienvia commented 5 years ago

@asquelt and @flatsiedatsie

I do have the same problem with the sensor out of range, how did you manage to fix it? without a crash of all the plugin each time it is too far ?!

flatsiedatsie commented 5 years ago

I just tried to add a fix. Let me know if it solves the problem.

adrienvia commented 5 years ago

arf, I just did à git pull, and now I have new problem :P

2018-12-17 20:34:39.867 Error: (Mi_flower_mate) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/Miflora/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'. 2018-12-17 20:34:39.867 Error: (Mi Flora) Module Import failed, exception: 'TabError' 2018-12-17 20:34:39.867 Error: (Mi Flora) Import detail: File: /home/pi/domoticz/plugins/Miflora/plugin.py, Line: 164, offset: 28 2018-12-17 20:34:39.867 Error: (Mi Flora) Error Line ' nValue = 0 2018-12-17 20:34:39.867 '

lboue commented 5 years ago

See PR #7

flatsiedatsie commented 5 years ago

Thanks!

adrienvia commented 5 years ago

thanks it worked, and I think the plugin does not crash entirely now if the captor is out of range.

flatsiedatsie commented 5 years ago

Great to hear!