New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Method GET #13
Comments
Hello. The logic is like: want to get properties - use get-node and get full json, want to execute command - use command-node and specify the exact command or send custom json with list of commands. Regards |
Would it be possible to get a preview of the node? |
What do you mean? Regards |
Sorry. I'm not sure exactly how to make it work. The commands have gone, but I don't know how to get the current status. |
Poll the device using get-node. And turn on autopolling option to get changes in properties each time they have changed |
I have autopolling turned on, but it doesn't return anything.
My test code `[
]` |
Empty payload... I'm confused a bit. Do the commands work properly? By the way, I looked through different integrations of that device and everything looks ok in defFile. At list the same as in python-miio: |
And to be sure: did you update nodes to version 0.5.11 and paste new defFile from the latest version to target folder? |
Yes, I have version 0.5.11 installed. I also had to add zhimi.airp.vb4.js to node-mihome to make the node work. Now all sent commands work, but do not return data about the current state. This data is important to me because of the homekit. |
Anything changes in msg.payload from get-node if you turn off friendly name option and delete your mihome credentials? |
Prop type set to MiProtocol. Cloud Auth turned off and data deleted. Returning
|
Very strange
very strange. When saw pull request from you, I thought that you had tested your device Anyway, let's try to adjust defFile a bit. In constructor section:
Then save updated defFile, reboot NR and come back with the result |
Tried and failed. I tried to rebuild according to zhimi.airpurifier.vb2 and also failed. |
Did I understand you correct: empty msg.payload from get-node either on init or on change after any commands? What I see from that test: it doesn't matter from where to get the list of properties - from miot server using "this._miotSpecType = 'urn:miot-spec-v2:device:air-purifier:0000A007:zhimi-vb4:2'" or from local array in defFile using " this._miotSpec = {...}" Then you can come back to defFile from v.0.5.11 with _miotSpec array and without _miotSpecType. There possibly could be several reasons:
Second reason is not in place here, because you can set the value of that properties through command-node... by why the device doesn't answer with current value...unclear at the moment. Let's try this:
Then save => reboot NR => come back with the result (msg.payload from get-node |
Amazing, now it's working. Thank you very much for your help. I will debug the code and send. |
Great! But I still hope that it was connection issue and we could come back to larger list of properties to monitor (consider me a perfectionist) :) Let's try all the properties except some not needed I hope. Try to put this list to defFile: this._miotSpec = { this._propertiesToMonitor = [ |
Could it be related to this? (node:326) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 properties listeners added to [Xiaomi Smart Air Purifier 4 Pro]. Use emitter.setMaxListeners() to increase limit |
no idea( |
Verified. It returns only 11 values. |
Maybe this is limitation of exact device? |
After much testing I managed to get these features working. After adding
|
Thank you so much for your tests👍🏻 I will update defFile according to this. Moreover, I will add setMaxListeners(100) in devices.js to eliminate limitation in event emitter. I'll try to release 0.5.12 with all these updates in place tomorrow. |
I tested again today. These values work and return.
The source code refers to a limit of 15 properties.
In documentation python-miio has this function for a complete listing.
It would be good to include node-mihome directly in the code and get rid of the dependency. It will simplify development and modifications. Now I have to edit the node-mihome code as well. |
Could you give reference on that? I didn't find this in node-mihome code. |
I though about that, but came to a conclusion that it's against the general idea of my plugin: the idea was to make an implementation of the lib and protocol in NodeRed, but not rewriting the lib. Maintaining lib + plug-in will take much more time and effort. Unfortunately I cannot afford that. Moreover, 99% of users do not face the limitations that node-mihome lib has. In that particular case 15 properties is more than enough for HomeKit, Yandex etc. Regards |
I understand. Node-mihome lib hasn't received an update in 2 years. I'm toying with the idea of sequentially calling get_properties to get all values. |
Updated and released. |
Is there a problem with the GET method?
I'm trying to figure out how to get it working.
Retrieving the current status would be very helpful.
The text was updated successfully, but these errors were encountered: