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

[things] Add ability to retrieve all things #89

Closed
janwo opened this issue Feb 6, 2022 · 1 comment · Fixed by #132
Closed

[things] Add ability to retrieve all things #89

janwo opened this issue Feb 6, 2022 · 1 comment · Fixed by #132
Assignees
Labels
enhancement New feature or request

Comments

@janwo
Copy link

janwo commented Feb 6, 2022

Dear community,

in order to analyze all things in my scripts, I need something like things.getAll().

See https://www.openhab.org/javadoc/latest/org/openhab/core/thing/thingregistry 🚀

Are you planning to integrate it?

@rkoshak
Copy link
Contributor

rkoshak commented May 24, 2022

This probably doesn't need to be implemented as part of the library itself. You can do the following right now:

const thingRegistry = osgi.getService('org.openhab.core.thing.ThingRegistry');
const allThings = thingRegistry.getAll();

That will give you a Java Set I think. If you need to you can convert it to a JS Array

const jsAllThings = utils.javaSetToJsArray(allThings);

If I'm wrong and it's a List, well there's a javaListToJsArray function too.

@florian-h05 florian-h05 changed the title Add ability to retrieve all things [things] Add ability to retrieve all things Jun 3, 2022
@florian-h05 florian-h05 added the enhancement New feature or request label Jun 3, 2022
@florian-h05 florian-h05 self-assigned this Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants