Comments (51)
My Fan is still in the basement but it is getting warmer and warmer here everyday so i will probably bring it back up soon and then i can continue to work on the plugin :)
from homebridge-xiaomi-fan.
Ok, guys let me see if i can provide a quick workaround for that now over the weekend. I plan greatly improve this plugin and i already have ideas for that. But before i do that i want to do some major changes to my other homerbidge plugin, in the meantime i will try to invest some time next weekend to at least provide a quick solution for the timeout issues. I know that summer is coming so the fans will not be used a lot again 😄
from homebridge-xiaomi-fan.
Like i said, i will have a deep look into it again soon and hopefully can make some progress.
from homebridge-xiaomi-fan.
Thanks for the info. Will check that out!
from homebridge-xiaomi-fan.
I have also noticed the delay in the Home app but i did not yet have time to investigate this. Probably something with the fan ping so it should not be hard to fix...
from homebridge-xiaomi-fan.
Summer is slowly coming here so i will soon bring the fan back from my basement and then i can hopefully fix the issue.
from homebridge-xiaomi-fan.
Update 0.9.0 should fix the "timeout" and "not responding" issues. Did some small tests locally and everything looks pretty good. Did not try yet how it will behave after a longer time so it would be good if you guys could let me know if everything works correct and if after a longer run everything is still stable.
So right now i cache the latest known status and do not wait anymore till i get a response from the fan. This does not block HomeKit anymore, but in some minor cases when the request to the fan takes to long it might show the incorrect status (this should happen very rarely).
I have plans to improve the plugin even more and add new features so stay tuned :)
from homebridge-xiaomi-fan.
Yes, i plan to fix it. I currently just struggle to get the miio events working. As soon as i get them working this should be an easy fix...
from homebridge-xiaomi-fan.
any progress on this? your plugin is the better but just this issue needs a fix to make it really shine.
from homebridge-xiaomi-fan.
Not yet, but i am on it.
from homebridge-xiaomi-fan.
You have to enter the following line in the homebridge option file /etc/default from your instance:
DEBUG=* homebridge -D
This activates the debug mode.
With me it can still take some time until I come to the test of the Plugin since I have still another building site at present which I must finish first.
from homebridge-xiaomi-fan.
It looks more like an issue to me with the fan just responding so slow. Maybe it is due to slow network connection. I can see that the request is send to the fan, it just takes a long time to get an response.
Anyway if i figure out how to use the events then the status will be much better since then i do not have to fetch the status from the fan each time when you open the Home app.
from homebridge-xiaomi-fan.
In my case - so called Smartmi Standing Fan 2S EU version - “not responding” issue, at least in the older plugin (homebridge-mi-fan), influenced only the accessories bound to the same room as the fan. All the other rooms weren’t reporting anything suspicious. What made me wonder is that after moving the fan to another room in the HomeKit, the accessories from that particular room started to suffer from the not responding issue (they were still operable though after opening each device individually), whether the devices from the previous location started to work perfectly. That made me think that the issue happens exactly in the moment of displaying the room with the fan in the Home app, so it had to be somehow connected with the fan polling performed by HomeKit when showing the fan icon.
I have found out that every time the plugin makes multiple miio get_prop requests (separately for each characteristics) which seems to be too much for the fan, which responds with a significant - like 1-2 sec - lag, of course with multiple separate responses. That is done every time the Fan accessory is displayed in the Home app. The response delay is long enough to make HomeKit assume that the network is down, so from now on it binds the “not responding” state to all the accessories which haven’t been yet initialized (the ones that were lucky enough and have finished loading their characteristics successfuly aren’t affected).
I have found out the above today, so it’s maybe too early to be sure 100% and I do not know if it is related to this one plugin here (it might, as the issues are similiar) but I am pretty convinced that the issue is caused during polling via HomeKit. If so, the root cause of the problem might be the fact that the plugin totally lacks of caching and every time requests the values from the fan (which means 7-8 requests in case of just displaying the fan icon in the Home app, the fan responds too slowly to handle it before HomeKit assumes timeout) rather than reading all the values once in a while with single request and then providing them per request from local cacheas well as updating them through events. Other idea is that the polling should be performed in asynchronous way but it isn’t, making the whole HomeKit request stall. I dunno, I have very limited knowledge about nodejs and homebridge-plugins (yet?)
Since frew hrs I am testing a quick workaround (for the older plugin), I have took the plugin and deleted all the code responsible for non-critical (from my pov) stuff: temperature and humidity which are totally absent, but also parental lock, led bulb and buzzer which I don’t need. As the number of characteristics and services is reduced, it results in reduced number of requests when displaying the icon in Home as well. This time it’s enough for polling to complete before times run out and all the accessories are accessible (including the fan which since then is working without any significant lag). It seems to work without hangs until now, which hadn’t happen in the past.
Obviously, that’s only a lame workaround - it reduces plugins functionality and the success still isn’t guaranteed and may depend on configuration and network conditions. It is still race between slow polling and HomeKit timeout.
from homebridge-xiaomi-fan.
You are right that the issue is related to a slow response from the fan. Pooling is never a good way to get status from a device, especially when the device like this fan is powered with a battery. The network interface from the fan needs to somehow preserve battery so it goes to sleep when not used for some time. I guess even the fan without the battery behaves that way because it is basically the same fan just without the battery.
The correct solution here is to get the events to work. Till now i did not get them to work, and my post in the miio github repo got no response. This makes me believe that maybe the events are not working because of the above reasons. If that is the case the only real way would be like you say to cache some things instead doing a live update. This would of course fix the "not responding" issue but in the other way it could introduce new issue where the status is incorrect.
Nevertheless, summer is slowly coming here and i will bring my fan back from the basement and work for the best solution.
from homebridge-xiaomi-fan.
Thanks for the info. Will check that out!
Hi Merdok - been having the same issue, let me know if there’s anything I can do to help! Running a 2s, 2, and 1, so happy to help test things :)
from homebridge-xiaomi-fan.
That sounds strange... Didn't experience such issues. Could you maybe post the homebridge log from that particular time if you have it, or could you replicate this issue and save the log?
That could give me some insight on what may cause this.
from homebridge-xiaomi-fan.
Maybe @Nastras can also give some input at the next opportunity. We know each other.
I'm not able to to run debug at the moment.
By the way how can I debug a 2nd Homebridge Instance? 😱😅
from homebridge-xiaomi-fan.
@merdok Faster than expected. Hope this helps.
I noticed that the log is taking long on this point when the switch for the fan is also not responding.
2019-08-14T11:14:09.303Z thing:miio:85578936 <- Handshake reply: <Buffer ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff>
Heres some of the log. Not filtered much. Hope this helps anyway.
Let me know. Thx a lot.
from homebridge-xiaomi-fan.
Thanks a lot for your brain work. 👍
Slow network connection is not a topic here. ;) More than enough speed in the house. 🤣
I just noticed by now, that you are also in Germany. Maybe you want to join?
https://forum.smartapfel.de/forum/thread/1128-xiaomi-mi-smart-ventilator-fan/?postID=62820#post62820
Or are you already in the community?
Thanks again @merdok
from homebridge-xiaomi-fan.
You have to take every possibility into account and since i cannot reproduce the issue, there must be a difference between my and your setup. The obvious one is that we have different fans, so it could also be as simple as the fan is responding to slow because to much request are getting to it.
Ja, komme auch as Deutschland :) Danke für den Link werde da mal reinschauen.
from homebridge-xiaomi-fan.
I tested the plugin now. With me everything works except the buzzer function.
For move control it also works when the fan swing is stopped via the Xiaomi app. There should be a switch or slider that switches between the different modes. from 30% 60% ...
I have the first model with Battery:
https://www.gearbest.com/living-appliances/pp_391577.html
from homebridge-xiaomi-fan.
Which would also be nice if there were entries in the log.
from homebridge-xiaomi-fan.
What model exactly do you have? Your does not have a buzzer?
What logs do you mean?
from homebridge-xiaomi-fan.
Does that name help? The first genaration of xiaomi fans.
ZhiMiDCVariableFrequencyFan
By log I mean the journalctl.
There stood with me only nullen instead of a report which was switched etc.
sudo journalctl -n 30 -fau homebridge-xiaomi-fan
By buzzer we mean beep tones that can be heard during mode change, right?
If so, it has them.
from homebridge-xiaomi-fan.
No, sorry i have no idea what that name means. You need to check the homebridge log, there i log the the model.
You would need to start homebridge in debug mode to get the full log.
Yes, that is he buzzer. Maybe just on your model it has a different name.
from homebridge-xiaomi-fan.
@DJay-X I have the same problem with two S2 fans (2019 generation). Network isn't the problem, running a fast mesh system here. They won't update across iOS devices and timeout.
from homebridge-xiaomi-fan.
I was not able to test it the last weeks.
My fan it the ZRFFS01ZM. At least that's what's on the bottom label. Its the all white, natural wind, fixed build in battery and smartmi on the front.
I get another Fan (S Series) without battery, silver stand, in a couple of days. Will also give it a shot with that.
Meanwhile I rolled back to the https://github.com/YinHangCode/homebridge-mi-fan and there is no delay or timeout at all. So something must be somehow different.
from homebridge-xiaomi-fan.
I don’t think it has something to do with what production year the fan is. I had to return to that other plugin too.
from homebridge-xiaomi-fan.
Any chance that this will be fixed in the future? I really would like to use this plugin as the other still adds a temperature and humidity sensor with values being zero. This then leads to strange answers when asking Siri what temperature it is in the room.
from homebridge-xiaomi-fan.
Great, if I only could help but my programming skills are quite limited :(
from homebridge-xiaomi-fan.
I do not quite understand why the events are not working. I saw many examples where people are using this exactly the same way i try but it just doesn't want to work for me... There must be something i am missing.
from homebridge-xiaomi-fan.
With events you mean changes coming from the fan by e.g. pressing one of the buttons or using the mi app?
from homebridge-xiaomi-fan.
Both of them, basically this is needed to notify the plugin when something with the fan changes. Right now only the plugin can request data from the fan and it needs to be done by pooling. With events the pooling would be not necessary anymore and whenever something changes the fan could notify the plugin about that.
from homebridge-xiaomi-fan.
@merdok Anything else happen with the plugin?
from homebridge-xiaomi-fan.
My fan is currently hidden in the basement due to winter :p I will for sure continue to work on this.
The problem is that the issue with the miio plugin events is still not resolved. I even opened an issue in their github repo but without response... I still need to find a way to somehow get the events to work.
from homebridge-xiaomi-fan.
It's a pity that you haven't made any progress because your plugin has potential 😉
from homebridge-xiaomi-fan.
👍👍👍
from homebridge-xiaomi-fan.
I also have the same slow response issue :(
from homebridge-xiaomi-fan.
It seems like this Humidifier suffers from the same issue. nt0xa/homebridge-mi-humidifier#21
from homebridge-xiaomi-fan.
You are right that the issue is related to a slow response from the fan. Pooling is never a good way to get status from a device, especially when the device like this fan is powered with a battery. The network interface from the fan needs to somehow preserve battery so it goes to sleep when not used for some time. I guess even the fan without the battery behaves that way because it is basically the same fan just without the battery.
I agree.
That’s the usual cost of using devices without native Homekit support.
However, I still feel that the root cause of the non working plugins lies somewhere else. As far as I understand, when the accessory is being connected to the HomeKit, the device state must (or at least should...) be polled, at least once, to sync HomeKit with the real state. But plugins seems to lag from the very beginning, starting from the initial polling.
I own numerous Homekit devices around the house and few of them has surely slower responses than the fan, in particular the Bluetooth stuff doesn’t seem to be that responsive, but some WiFi appliances as well (due to distance from the router or even need to query the cloud in case of some stuff connected via homebridge), but they still don’t cause the HomeKit failure in any way, the fact they are waiting for the value doesn’t make the whole HomeKit query freezee until reception.
That is why assume that the root cause is somewhat connected to the way the plugin interacts with HomeKit, e.g. it’s not informing it that we should wait a little longer, but instead it reports the failure - or even some faulty stuff, as the HomeKit freezees globally.
from homebridge-xiaomi-fan.
Any hope of getting this plugin up and running properly? :=)
from homebridge-xiaomi-fan.
The humidifier plugin facing the same issue has been already fixed. Unluckily, the commit with the fix is not trivial and it looks like some significant parts of the code had to be rewritten from scratch. Anyway, the humidifier fix which is truly working (checked on my own) might be helpful or at least inspiring in fixing the fan.
from homebridge-xiaomi-fan.
I have european variant of Xiaomi Smartmi Standing Fan 2S. I was very interested in making the fan work, so I have thought about reducing the general plugin’s overhead assuming it may be reduced to a level not affecting whole HomeKit.
I have took the second plugin, homebridge-mi-base as a base as it is possibly suffering from the same bug as yours, but the overhead is a little less intense, causing devices to be displayed as timed out in a random moments and then back again as ok, and making whole HomeKit lagged... but still working and if you are patient, you still we able to control devices. In case of this plugin here, in my case the overhead leads to a full deadlock of the whole home in a short time until stopping the instance.
Basing on the plugin for similiar Chinese variant, I have simplified the fan speed control so it ignores the natural wind mode state and proceeds to regular mode - that was due to the fact that the normal/wind mode logic was somehow broken leading to total freeze of the fan - it becames unacessible even through xiaomi app - and need of restting the token (or waiting until battery runs out I guess...).
I have removed temperature and humidity sensors, which doesn’t seem to be onboard in this model (and also requires polling, so increases overhead...). I am also disabling all the minor extras like led, buzzer or parental lock, each service means more concirrent requests, which the fan can’t process.
Those steps reduced the lag to an acceptable level - I mean, no more Time Outs in HomeKit, all seems to be responsive.
I was very disappointed with the lack of Manual controls per. 5 degree as I loved the excellent idea from your plugin! Inspired, I have added a possibility to manual move the fan to my lite version of homebridge-mi-fan plugin - please note it is a momentary switch so it does not continously request the sluggish fan for its state, so they shouldn’t increase the lag. I really love the feature.
Well, you can check my lite version at;
https://github.com/esgie/homebridge-mi-fan
or install directly from github via
npm install -g esgie/homebridge-mi-fan
Maybe someone will find my concept of avoiding the bads useful until the issue is truly fixed. I am not exactly a node.js guy so makin pg a fix is out of my reach, but at least I am able to use the fan in a basic scope without serious issues and affecting whole HomeKit, even if the functionality is slightly reduced.
Please note the removed libs for traditional fans, they won’t work, only 2S. my config (including custom options for enabling/disabling manual controls).
{
"platform": "MiFanPlatform",
"deviceCfgs": [
{
"type": "ZhiMiFan2S",
"ip": "192.168....",
"token": "...",
"fanDisable": false,
"fanName": "Smartmi Standing Fan 2S",
"ledBulbDisable": true,
"buzzerSwitchDisable": true,
"fanLockPhysicalControlsSwitchDisable": true,
"fanSwingModeSwitchDisable": false,
"fanRotationSpeedDisable": false,
"manualSwingDisable": false,
"manualSwingName": {
"right": "Fan RIGHT",
"left": "Fan LEFT"
}
}
]
},
`
from homebridge-xiaomi-fan.
Will do 🙂
from homebridge-xiaomi-fan.
Hey, I’m using your plugin as well. I encountered timeout problems since then. After installing your plugin everything i thought everything is working well. I can control my ventilator with Siri, Home App and Eve.
But the first few seconds the plugin is not responding and is showing “updating” and is timing out with the message “no response”.
Sadly some other devices included in HomeKit with Homebridge are timing out as well since installing your plugin.
I tried playing with the polling rate, but it didn’t change the behavior.
I am using the 2019 2S. (za4)
from homebridge-xiaomi-fan.
Awesome! Thanks for looking into it, @merdok :)
from homebridge-xiaomi-fan.
I will give it a try and will report back if i run in to bugs.
Thanks for your quick response and this fix.
Edit: looking good so far. MiHome and Apple Home app get the correct actions back and the home app is snappy again. Perfect
Now let’s hope this stays that way.
Looking forward for the bigger updates. Honestly I can’t imagine how this perfect plugin could get any better.
Edit on next morning:
Everything is running fine. But I noticed, if I set natural mode in the MiHome app, and want to control the fan from Apple home, it changes to standard mode. I can’t get it to start in natural wind mode from within the Home App. I can’t change it from there. I have to go back into the MiHome App.
Is this a known behavior?
Edit: hopefully the last one.
Ok, I missed, that the Rotation direction switch is the Switch for natural and standard mode. But this one is not working in Apple home, at least for me. 🤔 If i switch it within Eve app, it stays that way, even after switching the fan on and of from Apple home. So now it is working good enough for me. Thanks
from homebridge-xiaomi-fan.
The fan should actually start in the last selected mode, no matter where it was set. And yes i had to use the rotation direction to selected beetwen standard and natural because the Home app does not provide a dedicated switch for that, and since the rotation direction is anyway not used by the xiaomi fan i used that for the mode.
from homebridge-xiaomi-fan.
Yes, now it does start the last used mode.
At the beginning it did not. I think this was somehow my mistake. After rebooting everything it worked fine.
After using it one day now I noticed the commands get somehow lost. I have to command Siri two times to get the right thing to do. It feels like I have to wake the plugin up and after that the second command gets through. The same behavior is true if I use shortcuts to control the fan. I send the command, wait a few seconds and send it again.
The home app mostly gets everything right on first try.
from homebridge-xiaomi-fan.
Anyone else has to repeat “start the fan” when talking to Siri almost every time?
from homebridge-xiaomi-fan.
No, everything is working fine with Siri. 0.9 is perfect so far.
from homebridge-xiaomi-fan.
Related Issues (20)
- Could you please add new device? HOT 3
- dmaker.fan.p15 isn't working. HOT 4
- Static IP HOT 2
- Feature request: Reverse natural mode HOT 1
- [Improvement] Switch to miio fork HOT 5
- Cannot control Fan zhimi.fan.za3 HOT 3
- Smartmi Fan 3 not working HOT 2
- Standing Fan 2: NO RESPONSE HOT 2
- iOS 16 Beta 8 - fan doesn't show left right and natural mode HOT 4
- iOS 16: all switches in the group have the same name HOT 3
- Error: Network communication is unavailable, device might be destroyed HOT 5
- no connection after a while HOT 6
- new device support HOT 2
- Any chance this should work with Viomi Standing floor fan? HOT 3
- Cannot connect to smart standing fan 2 HOT 8
- Start/stop swing HOT 3
- Control Elements don't show their name in the home app HOT 1
- Support for dmaker.fan.p39? HOT 3
- Feature request: Disable humidity/temperature sensor HOT 1
- Remove unwanted sub switches HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homebridge-xiaomi-fan.