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
$(...) selector misses states #109
Comments
Just confirmed, this issue is still present in the newest version of the adapter. I could reproduce it this way:
function doIt() {
log(`selector found ${$("device{shortmac=D3:D2:EA}").length} states`);
}
doIt();
setTimeout(doIt, 30000);
Expectation: Actual: I believe this has to do with this part of the code, where ioBroker.javascript/lib/sandbox.js Line 384 in de794a8
Once that has been done, changes to the objects and channels collections are no longer reflected in the $-selector. I think this should be moved outside the |
Still open? |
Do you also delete the g-homa.0 object?
I, too, think that this is an issue. Both are filled here, once in adapter lifetime and never updated: https://github.com/ioBroker/ioBroker.javascript/blob/master/lib/sandbox.js#L572 The context comes from main function so they could be cleaned in onObjectChanged easily. I am not 100% sure on what changes to do that, though... because the way devices and channels are filled they do not really describe objects of type device/channel but parent/grandparent of a state (i.e. [addtional_part].device.channel.state, no matter what the structure really looks like). Not sure if that is intended? But given that this code seems to exist for a long time, I am a bit hesitant to change it, maybe people rely on that behaviour? What do you think? For the current system one probably would have to clean the caches for every object addition / deletion. |
I don't remember but I think I just deleted everything of the adapter. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days. Please check if the issue is still relevant in the most current version of the adapter and tell us. Also check that all relevant details, logs and reproduction steps are included and update them if needed. Thank you for your contributions. |
I don't recall a fix for this. |
I'd still like to get some kind of comment (from the core devs or anybody else) on that issue... currently the device/channel filters do not really care for the object structure at all but assume a fixed device.channel.state structure. Is that intended? One result is that a selector for "device" will fail if the device does not have channels. Also both filters will find non existing objects (i.e. for a state Changing that would be a breaking change and would also make the code a lot more complex (or at least require a huge change). So the easier way to go would be to just delete the whole cache for every object change and let it be as it is (and wait till someone notices and complains 😉). (If the object structure would be honoured by the cache a more intelligent clean up would be possible, but currently that would be to error prone IMHO - at least that is the conclusion I reached when I looked at it more closely, which is ~6 months past now, already). |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days. Please check if the issue is still relevant in the most current version of the adapter and tell us. Also check that all relevant details, logs and reproduction steps are included and update them if needed. Thank you for your contributions. |
Maybe we should add some label on this issue? It is far from solved and should be discussed. |
What label shuts the bot up? @Apollon77 |
Enhancement - or simply one post every 3months |
I think we should add one more. Enhancement is not correct if an issue is a bug. |
A reminder every three months has its perks, too. 😄 |
a new lable "confirmed bug" and have that in stalebot excluded? |
Here is another case for easyly reproducing the problem if you have a an Amazon Echo and Alexa2 adapter running |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days. Please check if the issue is still relevant in the most current version of the adapter and tell us. Also check that all relevant details, logs and reproduction steps are included and update them if needed. Thank you for your contributions. |
The problem has been known for so very long now and still no solution in sight? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days. Please check if the issue is still relevant in the most current version of the adapter and tell us. Also check that all relevant details, logs and reproduction steps are included and update them if needed. Thank you for your contributions. |
Wanna try to solve it and make a PR? :) |
I still see the question if that is intended or should be changed unanswered and code is not changed. The device/channel selectors currently do not select objects of type device or channel. Is that intended or not? If it is not, it should be changed and then in onObject change it is easy to update channel/device cache from object type. If it is intended and device/channel should select grandparent / parent no matter what type of object they are (and IIRC even no matter if they exists at all) the most feasible thing to to in onObject change is probably to delete the cache and recreate it the next time. But with adapters changing objects every few minutes this could mean a lot of additional workload which might even lead to the conclusion that the cache should be stripped altogether and only the required parents / grandparents should be calculated as needed and not cached. So for me still this question needs to be answered before it makes sense to fix the bug. The change from grandparent/parent to device/channel is of course a breaking one. But it would make sense, in my eyes. |
In my eyes changes to channels or devices and such needs to be reflected in adapter ... means yes it is an bug, but noone had time so far to fix it ... So PRs welcome until someone else finds time. The question is more: What else might be missing beside channel/devices? Is enums updated? |
Disclaimer: This is a very old bug report. I'm not sure if its still relevant, but I'm leaving it here until we have confirmed that it works or not.
https://forum.iobroker.net/viewtopic.php?f=22&t=5665
The text was updated successfully, but these errors were encountered: