ioBroker/ioBroker.node-red

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

FlorianSchulze opened this issue · 12 comments

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

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

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.

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.

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.

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).

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?

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?

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. :)

@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.

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.

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?