You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Everything in a JS Scripting rule in the UI is a JavaScript Class or Object except event which comes over as the raw Java. This means it's exceptionally awkward and counter intuitive to deal with as to treat them the same as, for example, an Item's state one much first know this is happening and then convert the Java State Object to a String.
Your suggestion
Short of fixing this in the JS Scripting add-on, which IIRC isn't possible for UI rules, the next best thing would be if Blockly could convert the State and Command Objects in event to Strings automatically by the contextual info block for "new state of item", "previous state of item" and "received command" (I think the rest are already Strings).
Fixes#1991.
Support conversion of event context types itemState, oldItemState,
itemCommand as String or Number by supplying a mutating block with a
choise of Number / String.
Also-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
Fixes#1991.
Support conversion of event context types itemState, oldItemState,
itemCommand as String or Number by supplying a mutating block with a
choise of Number / String.
Also-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
(cherry picked from commit edc124e)
The problem
Everything in a JS Scripting rule in the UI is a JavaScript Class or Object except
event
which comes over as the raw Java. This means it's exceptionally awkward and counter intuitive to deal with as to treat them the same as, for example, an Item's state one much first know this is happening and then convert the JavaState
Object to a String.Your suggestion
Short of fixing this in the JS Scripting add-on, which IIRC isn't possible for UI rules, the next best thing would be if Blockly could convert the
State
andCommand
Objects inevent
toStrings
automatically by thecontextual info
block for "new state of item", "previous state of item" and "received command" (I think the rest are already Strings).Your environment
Additional information
As more users of OH 4+ adopt Blockly I think this is going to be more and more of a problem.
The text was updated successfully, but these errors were encountered: