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

Object folder names starting with "/" dash do not work in the workflow #338

Open
FlorianSchulze opened this issue Oct 10, 2022 · 12 comments

Comments

@FlorianSchulze
Copy link

Having folders named like "/ABL" can be selcted - but that leads to a "not exists" message and it does not work. In the screenshot find the datastructure, i connect "...0./ABL-10115184.transactionActive" -- does not work. Renaming the path to "...9´0.ABL-10115184.transactionActive" works.

Screenshot 2022-10-10 at 14 53 53

Screenshot 2022-10-10 at 14 54 18

@Apollon77
Copy link
Contributor

I think we need to allow "escaping of the / by e.g. / ... then we could persists a /

@baeckerman83
Copy link

I have the same problem and think this is because the node red iobroker nodes replaces the / with . everytime and there is no chance to disable this in the node.
Why do you need to replace slash with dot? Is it possible to remove this. Because slash is allowed for keys in JS Objects.

@Apollon77
Copy link
Contributor

Why do you need to replace slash with dot?

because it is that way in the node/adapter since years and changing this would be breaking.
The reason is that "/" is often used in node-red (from mqtt) to separate levels in datapoints. ioBroker uses "." for this.

SO we need to find a way to allow to persist "/" when a "/" is wanted.

@baeckerman83
Copy link

Ok I understand, I asked, because I had a look at the code and would like to help.
Then should your idea be used to escape a / with a / so that // be persistent (1)?
Or better then / as persitent (2)?

the replace Regex for the (1) could be: replace(/?<!/)//g, '.')
and for the (2) replace(/(?<!\)//g, '.')

I have seen that in the code there more then one places where the replace is done. I also had this problem with my wallbox and checked it there, with both solutions it looks like that it is working.

@Apollon77
Copy link
Contributor

The idea to have // be replcaed to / only and used that way could an idea ... that would be easier then a backslash-escape I think. Like the idea

@mickym2 What do you think as one of the power users?

I'm happy if you can do a PR then we can check that way (I also need to check code to find all places - only idea could be to centralize it (if it is the same in all places but that would be a bonus).

@mickym2
Copy link
Contributor

mickym2 commented Jan 7, 2023

I am not sure - if this could have any side effects. I tested an mqtt topic with // and this creates an empty folder oder additional hierarchy. If a / should be allowed then it should only possible when the new option format is switched to the iobroker format. The question is not only that the subscription pattern is working - more important would be how the msg.topic would be created to be still unique. The msg.topic should then have also a double // which is however in conflict with mqtt.
My question would be is it not possible to support / only when iobroker notation is selected?

@baeckerman83
Copy link

I thought about the problem, I don't know it it can also come in other constellation. But for the creater of the issue it also occurs also with a dot in front of the slash.
Could this be a solution? To only allows ./ as notation? Because I think this is a special notation in this case. Or did you have other users which have problems with the slash?

@FlorianSchulze
Copy link
Author

I thought about the problem, I don't know it it can also come in other constellation. But for the creater of the issue it also occurs also with a dot in front of the slash. Could this be a solution? To only allows ./ as notation? Because I think this is a special notation in this case. Or did you have other users which have problems with the slash?

The problem is in iobroker, other adapters from where we deal with data, stick to the rules of iobroker. In there, "/ABC" is a valid name. This name can not be changed, as it identifies for example an external device, in my case a charging station.

My current solution is a full mapping via local variables and a longer JS syncing the two "worlds".

Short version: No, that would not solve the problem. :)

@baeckerman83
Copy link

@FlorianSchulze yes I have the same charging station adapter and it looks the same like your example. /Wally is the Name of my Wallbox in the object tree.
So in Node red it is 0./Wally.1.status as example. Now I have changed the code of this Adapter locally to also allows 0./Wally.1.status and not changing this to 0..Wally.1.status

Or you have another problem with the same adapter. Then I think we must write in German because I haven't understand yet.

@FlorianSchulze
Copy link
Author

Same Problem. Again, the root cause is that node-red does not support names as iobroker does. The adapters using the iobroker specification and build names "/Wally" do a correct job. Just in Node.Red you are not able to work with these objects. If this is not a problem in red, what is one? ;)
And yes, we found local solutions - but first that is the wrong way and guess most users will not be able to do that.

@gitpower2017
Copy link

I have the same problem with the adapter "Renault 0.0.21".
There is action/... and charge/...
The / is replaced with a . every time.
Is there a workaround for the problem?

@FlorianSchulze
Copy link
Author

FlorianSchulze commented Aug 20, 2023 via email

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

5 participants