Skip to content
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

Do not run with js-controller 5.0 #276

Closed
GermanBluefox opened this issue Mar 30, 2023 · 9 comments
Closed

Do not run with js-controller 5.0 #276

GermanBluefox opened this issue Mar 30, 2023 · 9 comments

Comments

@GermanBluefox
Copy link
Member

image_2023-03-30_12-19-59

@Apollon77
Copy link
Member

Yes, seems https://github.com/sbormann/ioBroker.iqontrol/blob/master/main.js#L1673 was always wrong but silently ignored in the past, not we check a bit better there and so the type do not match

@sbormann
Copy link
Collaborator

obj = {...await this.getObjectAsync(objId, {type: 'state'}), ...await this.getObjectAsync(objId, {type: 'channel'}), ...await this.getObjectAsync(objId, {type: 'device'}), ...await this.getObjectAsync(objId, {type: 'enum'})};

Changed it that way. Could you please try with the actual github-version of iqontrol if it works now?

@Apollon77
Copy link
Member

@sbormann If you want to get an object getObjectAsync(id) is completely sufficient. The options are just needed for special behaviour if you e.g. ewant to limit it to a certain user or such. in your case in fact the options have no meaning because if you try to filter the type then this is not supported by getObject at all (and also had never). Right now you should get back 4 times the same object .... is this intended?

@sbormann
Copy link
Collaborator

Hi, getForeignObject(id) does not deliver all types of objects. For example type instance is only delivered, if you call it getForeignObject(id, "instance"). So if the new js-controller doesent accept this any longer, how can i archieve this?

Here is my test:
image

I call get ForeignObject in 3 different ways:
a - without any option
b - with option "instance" as string
c- with option {type: "instance"} as object

a and c are the same, as you said.
But b is different and contains the instances, which are missing in a and b (for example system.adapter.iqontrol.0).

@foxriver76
Copy link
Member

You are mixing lots of stuff like getForeignObject vs getForeignObjects

@sbormann
Copy link
Collaborator

yes, but in my opinion it makes sense. sometimes i need a specific object, sometimes all of them.

Is there any documentation how to use these functions? it's really time consuming to do it all by try'n'error.

@Apollon77
Copy link
Member

As @foxriver76 already sdtated: getObject/getForeignObject (no "S" at the end!!) is just accessing the pure object via ID and works irrelevant of the object type! YOu aloways get the object if it is a valid ID.

getForeighObjects expects a Pattern as first parameter and allows to filter objects types as second parameter ("state" if not provided). But this only exists on that one method.

https://github.com/ioBroker/ioBroker.js-controller/blob/master/packages/controller/doc/classes/AdapterClass.md#getforeignobjectsasync

@sbormann
Copy link
Collaborator

Ok, thank you, i think i got it now.
I did not know the documentation you sent me, many thanks for that.
And therefore i did not know that there is a difference in the syntax of getForeignObject and getFreignObjetcs.
I uploaded the corrected version on github for testing.

Many thanks!

@Apollon77
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants