Closed nullsibnelf closed 3 months ago
see https://github.com/ioBroker/ioBroker.vis-2#special-bindings
So it can only be used in the js part according to the docs, which means something like this would work {t:1;widget.data.oid}
But yes, then your specific use case would not be possible currently.
Crazy, that nobody never tryed to use this before. Thought I did something wrong. Thanks!
BTW: I dont get the "only in js part". There is this js-part - that does this exactly mean? I'm relatively new to IoBroker, could you do a screenshot where to find this? Or is this related to the Scripting-Section in the mainmenu? (TS, JS, Blockly ect)
I haven't written these docs and I also think it is a bit confusing. From my understanding: You have the assignment part (the part with the :
to assign value of an state) and the js/code part of a binding (where the output is generated). So you unfortunately cannot do like {val:widget.data.oid;val}
as it won't be evaluated as an assignment.
You could try it with prepend/append html:
prepend: Ht outdoor: <span class="{wert:dp.0.val; wert == "true" ? "red" : "green"}">
append: </span>
(or instead of class="[...]" => style="color:[...]")
Will be possible in next version like
widgetOid
- use the oid of the widget to assign the widgets value in the assignment section, like {t:widgetOid.val;t}
I am not sure if there are edge case widgets where this will not work for, it depends on the fact, that the oid
is called oid
by the widget developer.
No existing issues.
Related problems
Using widget.oid in bindings dosn't work.
Description
Hi,
I tried many variants, since weeks now, and I cant belive, that it isn't possible to use values of the same widget in a binding. I asked in the IoBroker-Forum, and they sent me here - to create a issue.
I want to do a binding to the value of the Object ID, to color the text depenend on the level. I could write the object ID, but with 100 strings, I have to write it 100 times. When there is a way to point to the ObjectID, I could use the same code to all Strings - just copy paste.
I'm using vis2. Picture for illustration:
Additional context
No response