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

iobroker out node should create folder objects #206

Closed
mickym2 opened this issue Aug 7, 2021 · 25 comments
Closed

iobroker out node should create folder objects #206

mickym2 opened this issue Aug 7, 2021 · 25 comments

Comments

@mickym2
Copy link
Contributor

mickym2 commented Aug 7, 2021

Currently an hierachie is created for non existing objects, if I specify a msg.topic in iobroker.out node.
The interim hierachies were correctly shown in admin 4 as folders if there are child objects. As admin 4 didn't check if an hierarchy level is represented by an object - it was always possible to create any object type on any hierarchy level.

With admin 5 you cannot create any child objects - as you have to create all parent objects manually. So it would be useful that all hierachies which are created by an iobroker out node, should be explicitely creates as folder objects.

@mickym2
Copy link
Contributor Author

mickym2 commented Aug 10, 2021

So if the iobroker out node does not create a folder object in case of errors the log will contain warnings like this:

`

ode-red.0 2021-08-10 22:02:18.991 warn This object will not be created in future versions. Please report this to the developer.
node-red.0 2021-08-10 22:02:18.992 warn This object will not be created in future versions. Please report this to the developer.
node-red.0 2021-08-10 22:02:18.990 warn Object 0_userdata.0.controll-own.0.logic.states.fensterOffen is invalid: obj.common.type has an invalid value (undefined) but has to be one of number, string, boolean, array, object, mixed, file, json
node-red.0 2021-08-10 22:02:18.990 warn Object 0_userdata.0.controll-own.0.logic.states.fensterOffen.wohnzimmer is invalid: obj.common.type has an invalid value (undefined) but has to be one of number, string, boolean, array, object, mixed, file, json
node-red.0 2021-08-10 22:02:18.991 warn Object 0_userdata.0.controll-own.0.logic.states.fensterOffen.schlafzimmer is invalid: obj.common.type has an invalid value (undefined) but has to be one of number, string, boolean, array, object, mixed, file, json
node-red.0 2021-08-10 22:02:18.991 warn Object 0_userdata.0.controll-own.0.logic.states.fensterOffen.buero is invalid: obj.common.type has an invalid value (undefined) but has to be one of number, string, boolean, array, object, mixed, file, json
node-red.0 2021-08-10 22:02:18.990 warn This object will not be created in future versions. Please report this to the developer.
node-red.0 2021-08-10 22:02:18.989 warn This object will not be created in future versions. Please report this to the developer.
node-red.0 2021-08-10 22:02:18.989 warn This object will not be created in future versions. Please report this to the developer.
node-red.0 2021-08-10 22:02:18.990 warn This object will not be created in future versions. Please report this to the developer.
node-red.0 2021-08-10 22:02:18.988 warn Object 0_userdata.0.controll-own.0.logic.alarm.battery is invalid: obj.common.type has an invalid value (undefined) but has to be one of number, string, boolean, array, object, mixed, file, json
`

@mickym2
Copy link
Contributor Author

mickym2 commented Aug 10, 2021

Perhaps it is possible that the iobroker system (or JS) creates automatically folder objects, if object type is undefined.

@Apollon77
Copy link
Contributor

These errors do not come from missing folder objects. It is more that the relevant real objects do not have a type ... question is now if we should derive the type from the value (which might be problematic iv datatype changes) or if we better should use "mixed"

@mickym2
Copy link
Contributor Author

mickym2 commented Aug 11, 2021

OK - I was able to copy a tree, when iobroker out is configured to write "writeable" objects and with ACK-Flag without warnings and errors in the log. However the main problem is still the problem that folder objects have to be created or iobroker out creates no folder objects for each hierachy level. See the following screenshot with the source and the target tree created reading the objects with the objects list node and the iobroker out node

source = mqtt.1.*

image

target = 0_userdata.0.testcopy

image

So even if the source has folder objects now - writing to the target path does not create folder objects on each level.

@Apollon77
Copy link
Contributor

All ok, but the error slisted in first post and the "create folder objects where missing" are two separate topics and so should be two issues? ;-))

@mickym2
Copy link
Contributor Author

mickym2 commented Aug 11, 2021

I don't think so. As the iobroker out normally write states the problem are the missing folder objects in an id (as path), specified in msg.topic. The same happens if I specify an id for a state in admin. So if folder objects would be created automatically by the system, it wouldn't be necessary that the iobroker out node creates explicitely objects or folders.

@Apollon77
Copy link
Contributor

@mickym2 WHaat do you think, should the node automatically create the folder objects or should it be configurable?

@mickym2
Copy link
Contributor Author

mickym2 commented Mar 9, 2022

In my opinion it needs not to be configurable as in long term i guess it is intended to have on each hierarchy level an object and not how it is the case now. If a user doesn't want to create non existing states - this option is already available.
For point of view of NodeRed it should be completely transparent.

The folder objects should be created automatically but should have the lowest priority. Means if later a state, device or channel object should be written with the iobroker out node to an existing folder object, this can be replaced by any other object type. As mentioned in the threads discussion - I would also think that it would be no problem if you restrict the NodeRed Adapter to create objects under only under 0_userdata - but must not follow rules as it would be necessary for other adapter name spaces.

@Apollon77
Copy link
Contributor

Please check Github

@mickym2
Copy link
Contributor Author

mickym2 commented Mar 11, 2022

There is no difference - no folder object was created in the new tree.

image

If I create manually a folder object and tried to write a state to the original folder object with the iobroker out node - this does not work and I got the following error in the log:

image

@Apollon77
Copy link
Contributor

Hm ... ok ... warte ... aktuell wurdd es nur gemacht wenn ein neues Objekt angelegt wurde ... GitHub ist aktualisiert ... dann wirds immer geprüft. Am bersten vor restart debug log einschalten , dann sollte man es auch sehen

@mickym2
Copy link
Contributor Author

mickym2 commented Mar 11, 2022

Hmm - ich sehe zwar das an einer anderen Stelle, wohl ein fehlendes Objekt erstellt wurde

2022-03-11 13:48:13.443 - debug: node-red.0 (23978) Create folder object for 0_userdata.0.stromverbrauch

2022-03-11 13:48:13.465 - debug: node-red.0 (23978) Create folder object for 0_userdata.0.dimmer

2022-03-11 13:48:13.468 - debug: node-red.0 (23978) Create folder object for 0_userdata.0.stromverbrauch.shellies

2022-03-11 13:48:13.757 - debug: node-red.0 (23978) Create folder object for 0_userdata.0.stromverbrauch.shellies.shellyplug-s-01E405_0

Aber der Großteil bei den Neuanlagen wird nur der state erstellt.
NR Debug Log.txt

Ich hab das Log hier mal angehängt - da es wenn man den Text hier reinkopiert auch in CodeTags komisch aussieht.

Auch beim Beschreiben eines vorhandenen States ....

image

image

... funktioniert das - aber die Objekte darüber werden nicht angelegt.

@Apollon77
Copy link
Contributor

Hm ... ok, hab mal was umgebaut ... kannst bitte nochmal versuchen? und bitte wieder debug log

@mickym2
Copy link
Contributor Author

mickym2 commented Mar 11, 2022

Leider keine Veränderung.
iobroker.current.log

@Apollon77
Copy link
Contributor

Apollon77 commented Mar 11, 2022

Wtf .. ;-)I added debug ... Hoffentlich wissen wir danach mehr ... nochmal debug bitte

@mickym2
Copy link
Contributor Author

mickym2 commented Mar 11, 2022

OK hab jetzt mal alles drin gelassen:
2022-03-11 15:50:48.253 - Start Installation
2022-03-11 15:51:52.980 - Alles OK durchgelaufen

danach Adapter Neustart

@Apollon77
Copy link
Contributor

Klick im Admin mal reload bitte ... laut ihm sind die objekte da :-))

Ich hab nochmal was optimizert das nicht zuvieles mehrfach versucht wird ... von daher bitte nochmal checken ...oder mal baum "Löschen" und ganz neu anlegen lassen. Noch ein letztes Debug log wäre cool

@mickym2
Copy link
Contributor Author

mickym2 commented Mar 11, 2022

Es tut mir leid - auch wenn das Log was anderes behauptet. Die Objekte sind nicht da!!!

Habe Browsercache gelöscht, alten Objektbaum gelöscht, Browser zu und auf. An dem liegt es nicht.
CurrentLog.txt

image

@Apollon77
Copy link
Contributor

Also das letzte Log zeigt das node-red nicht neu gestartet ist nach dem GitHub update! ... scheinbar wurde nur der Flow neu laufen gelassen? Kannste bitte mal adapter restarten?

@mickym2
Copy link
Contributor Author

mickym2 commented Mar 11, 2022

Selbes Bild wie vorher - keine Objekte vorhanden.
CurrentLog.txt

Adapterneustart: 2022-03-11 19:55:19.734

@Apollon77
Copy link
Contributor

Also jetzt blicke ich nix mehr

Mach mal bitte an einer Shell:

iob object get 0_userdata.0.mwReImport.mqtt.1.zigbee2mqtt.temperatur.kueche

@mickym2
Copy link
Contributor Author

mickym2 commented Mar 11, 2022

`pi@MWHome:~ $ iob object get 0_userdata.0.mwReImport.mqtt.1.zigbee2mqtt.temperatur.kueche

The object 0_userdata.0.mwReImport.mqtt.1.zigbee2mqtt.temperatur.kueche was not found!`

Hier kann man das schlechter als im Forum lesen deshalb nochmal der Screenshot

image

Bei einem existieren Objekt - also State - bekomme ich dann auf der Kommandozeile den JSON String, der die Objektdefinition enthält.

@Apollon77
Copy link
Contributor

Please another github update ... think found the issue ... make sure it restarts please

@mickym2
Copy link
Contributor Author

mickym2 commented Mar 11, 2022

Perfect - 100% done. :) -

image

CurrentLog.txt

Auch das nachträgliche Umwandeln eines Folder Objektes in einen State funktioniert wieder. Klasse!!!

Auch die Folder Objekte wurden von der list Node ausgefiltert!

Fine! Excellent! 1000 Thanks!

@Apollon77
Copy link
Contributor

Released in 3.0.0

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

2 participants