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

[enhancement]: common path format for iobroker file resources #2710

Open
1 task done
klein0r opened this issue Apr 30, 2024 · 4 comments
Open
1 task done

[enhancement]: common path format for iobroker file resources #2710

klein0r opened this issue Apr 30, 2024 · 4 comments

Comments

@klein0r
Copy link
Contributor

klein0r commented Apr 30, 2024

No existing issues.

  • There is no existing issue for my request.

Description

Let's say I want to pass a file path to another adapter (e.g. with sendTo). What's the best way to describe a ressource-path (meta id + filepath). This could be useful to tell telegram or pushover to send an image. Or attach a file to an email (via Blockly).

Example: 0_userdata.0 is the id of the meta object and a file the file camera/backyard.jpg has been updated (e.g. with the new httpGet blocks + writeFile. How should we extend the other adapters to give them a resource name (id + path).

Why?

To implement a common way in other adapters for file handling.

How?

Maybe via an object?

{
  id: '0_userdata.0`,
  filepath: 'camera/backyard.jpg',
}

or as a resource string? e.g.

iofile://0_userdata.0/camera/backyard.jpg

or as urn (RFC 2141)? e.g.

urn:iofile:0_userdata.0:camera/backyard.jpg

In that case a parser of those string would be helpful (adapter utils?). The cli uses the first part as the id. But we have to ensure that this is not "normal text" and follows a specific pattern.

iobroker file write ~/cam.jpg 0_userdata.0/camera/backyard.jpg

Maybe we should also extend readFile (and writeFile?) to also accept those resource identifiers.

@klein0r
Copy link
Contributor Author

klein0r commented Apr 30, 2024

Example

Screenshot 2024-04-30 at 15 25 31

@Apollon77 Apollon77 added the refinement 🔍 Needs refinement with core developers label May 2, 2024
@Apollon77
Copy link
Collaborator

Good question, we will discuss in core group

@Apollon77
Copy link
Collaborator

Ok, we favor the idea of having a resource path, our proposal is "iob://namespace/path"

We will create todos for controller to also offer convenience methods to use this in later version

@Apollon77
Copy link
Collaborator

WIP idea ...

  • iobfile://namespace/path/to/file -> file
  • iobobject://adapter.x.path.to.object[/common.enabled] -> JSON of the result
  • iobstate://adapter.x.path.to.state[/val] ... or JSON object

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

No branches or pull requests

3 participants