Open Mayki07 opened 5 years ago
@Mayki07 please enable Debug log per device and attach log where your scene is activated.
Hi everyone! Any update? I have the same issue
@Napalmcold Can you gather and attach log with debug enabled?
Just stumbled upon this thread. have the same problem. logs below. there seem to be a very long delay in the middle (5 seconds) then another 2 delays afterward... any idea what can be the issue?
2019-12-22 20:01:15.215 (Bedside Light (Xiaomi)) Pushing 'onCommandCallback' on to queue
2019-12-22 20:01:15.235 (Bedside Light (Xiaomi)) Processing 'onCommandCallback' message
2019-12-22 20:01:15.236 (Bedside Light (Xiaomi)) Calling message handler 'onCommand'.
2019-12-22 20:01:15.236 (Bedside Light (Xiaomi)) onCommand called for Unit 2 cmd 'Off' Level '25' Color ''
2019-12-22 20:01:15.236 (Bedside Light (Xiaomi)) Call command: ['./MyBulb.py', '10.0.0.65', '*****', '--power', 'OFF']
2019-12-22 20:01:15.535 (Bedside Light (Xiaomi))
A couple more observations. I run the mybulb.py script directly - and it works reasonably fast. then I run it again from domoticz, and I see the light bulb react quickly, but then domoticz takes a few more seconds until it updates, this slows down any scene or automation considerably
OK - further debugging put the culprit in this line in plugin.py in the BulbStatus init function. I just put some debug messages around and saw what takes time. It seems that
any idea why it takes 5-6 seconds?
There is a dev branch exist. https://github.com/deennoo/domoticz-Xiaomi-Led-Lamp/tree/dev. You can try dev version of Domoticz with that version of plugin. In dev (Beta) version a bug with side-projects initialization of python is fixed so after that no need to use external script at all.
I am waiting the next release of Domoticz to merge dev branch to master.
Ah - much appreceated. I think I"ll wait for the next release then... dont want to mess my house too much :-)
just tried it on the latest domoticz. seems much improved. I will test more. beware that the latest domoticz breaks support in ubuntu 18 (but someone compiled a fix...)
OK - still have some problems with the development branch. in some cases, it works really fast, but in others it can take up to 5-10 seconds for the light to turn on, in this time it blocks the domoticz queue - so nothing else works until it get released. it seems that the problem happens the first time I turn the light on or off after a few minutes then there is a big delay. subsequent switching on or off immediately afterward are very quick, but then after a few minutes it happens again. any idea?
update: I put some debug messages after the " self.MyBulb.off()" and " self.MyBulb.on()" lines in the oncommand section and the printouts are coming pretty fast. but the light doesnt actually turn on or off until I see the onHeartbeat code get executed which appear after 10 seconds or so - at least this is how it seems.
another update - here is the log. note the 5 seconds gap from the moment the oncommand is run, until the onheartbeat finished. not sure if this is related or not, I thought the self.MyBulb.on() should have done the trick....
last update for today : maybe sensor_measurement takes a lot of time? its the last printout before the we get stuck for a few seconds. should we move the heartbeat to a different thread? (not on the oncommand thread.
couldn't resist update: its not sensor_measurement, it looks like the domoticz update is taking the time. any idea why?
2020-04-28 19:11:45.631 (Parents Right Bedside Light (Xiaomi)) Pushing 'onCommandCallback' on to queue
2020-04-28 19:11:45.646 (Parents Right Bedside Light (Xiaomi)) Processing 'onCommandCallback' message
2020-04-28 19:11:45.646 (Parents Right Bedside Light (Xiaomi)) Calling message handler 'onCommand'.
2020-04-28 19:11:45.646 (Parents Right Bedside Light (Xiaomi)) onCommand: Unit 2 cmd 'On' Level '99' Color ''
2020-04-28 19:11:45.663 (Parents Right Bedside Light (Xiaomi)) onCommand: mybulb is set to on
2020-04-28 19:11:45.663 (Parents Right Bedside Light (Xiaomi)) onHeartbeat called, fetch True
2020-04-28 19:11:45.663 (Parents Right Bedside Light (Xiaomi)) sensor_measurement
2020-04-28 19:11:45.992 (conbee II deconz) Pushing 'onHeartbeatCallback' on to queue
2020-04-28 19:11:45.631 Status: User: Admin initiated a switch command (251/Parents Right Bedside Light (Xiaomi - CCCW)/On)
2020-04-28 19:11:50.714 (Parents Right Bedside Light (Xiaomi))
I continued to investigate, and remove all the onheartbeat code completely, and the issue still happening, ist on the "self.MyBulb.off()" and " self.MyBulb.on()" lines in the oncommand section - the commands just takes 5-6 seconds (at least the time between the log before and after). this does not seem to happen if I use the Xiaomi program from the phone. any idea?
Try to update miio library in python: pip install -U python-miio
I did, using the latest now... if I run it from command line, it work immediatly. if I run it from domoticz, it gets delay....
I actually implemented a virtual button using dzvents running linux command line (python-miio) and it works great in terms of responsiveness, but of course I dont have the feedback and its quite an ugly implementation. any suggestion on what to investigate next? its pretty annoying to debug as it happens only after a short while.
Sorry, but i flash Tasmota on it....doesn't use this plugin anymore.
Frok it ans make it yours, i will update domoticz forum about this
I have four light bulbs added to the Domoticz. I have created a script for DzVents.
If I execute a command, the time delay between each bulb is about 8 seconds. The same thing when I create a scene to turn all the bulbs on and off at once, the time delay between the bulbs is 8-10 seconds. Is there anything we can do about it?