Yeah, well, i guess i could explain it a bit more in the app settings:
The expressions are just javascript expressions, with some wrapped around BLL stuff.
I have buildin extra modules and methods, and the posibility to create own custom functions to be used in the expressions.
But its basicly just JavaScript executions, just as you could do within HomeyScript. But more customisable and usable within way more flowcard for putting stuff in variables etc., PLUS you can use all that either within textarguments in flowcards from other apps that include BLL coding, or in BLL expression fields, like in Device Capabilities, Google Services, FTP client, Simple (Sys) Logging, BLL itself, etc.
Well, just see/learn how JavaScript expressions work. And see the BLL app settings (and there links) for info on the included modules and methods.
Where other properties exists, like in the AVD field reflections, those properties are shown in the popup infobutton next to the field, as examples, $value
and $values
.
Now, in my answer
Correction, technicly better should have been $value === true ? 'Off course' : 'off course not'
That is just a basic javascript expression returning based on the value of the first object, in this case the variable containing the value, and if true
(or “filled” with a object or value other than undefined
, null
, 0
or false
) it will display the first given value after the questionmark, if it is an undefined
, null
, 0
or false
it will return the last value, the one after the :
.
So, for example, if you want a button for a dimmer, that will be On if the dimmer is 1% or more, you could create a buttonfield with on/off, and use this Javascript expression: $value > 0.00 ? true : false
.
Or if you want to create a Sensor Textfield for a dimmertext:
$value == 1.00 ? 'Full on' : $value > 0.50 ? 'Half on' : $value > 0.00 ? 'Low on' : 'Off'
Also, everything know to the javascript engine on Homey, like the default Date
object or the default Math
, is available. Basicly everything thats available in HomeyScript, is available in BLL expressions, except the added stuff in HS like Homey
or the tag stuff.
Here is a site about JavaScript, and explaines, among other things, the Primitive Expressions.
It’s perhaps a bit advanced or deep, but contains some good info and enough “images”/examples, that might trigger creative solutions or ideas.
Expressions and Operators - JavaScript: The Definitive Guide, 7th Edition [Book].