Hello, newbie to coding so I apologise for any obvious questions. I am just starting to explore the possibilities of OpenHAB and I want to learn the scripting and coding aspects. My problem is I do not know what I need to learn. For example what language is used for writing widgets? Example below is from thermostat widget
slots:
default:
- component: f7-block
config:
class: thermostat
style:
flex-shrink: 0
–f7-block-margin-vertical: 0px
–f7-block-padding-vertical: 0px
–f7-block-padding-horizontal: 0px
padding-left: 0px
padding-top: “=props.size ? ‘’: ‘100%’”
width: “=props.size ? Number(props.size)+‘px’ : ‘100%’”
height: “=props.size ? Number(props.size)+‘px’ : ‘100%’”
background: “=props.colorThermostat ? props.colorThermostat : ‘var(–f7-toggle-inactive-color)’”
border-radius: 50%
border: 2px solid rgb(64, 60, 77)
Where can I find descriptions of what these items relate to and properly understand their syntax. I am getting lost in a world of Java, Python, Jython, f7 etc.
Please do what Rainer suggests. To answer your specific questions though:
Part of openHAB
Language
Notes
core software
Java
You don’t have to write in Java to use openHAB but Rules will interact with some Java stuff on occasion
persistence config
Custom Domain Specific Language (DSL)
See the persistence docs
.items files
Custom DSL
See the Items docs
.things files
Custom DSL
See the Things docs and specific binding docs
.sitemap files
Custom DSL
See the sitemaps docs
Transformations
JavaScript
JavaScript, also called ECMAScript 5.1
See the JavaScript Transformation docs for more details
REGEX
Regular Expressions
In openHAB they work a little different from standard; the expression must match the full string and the first group is what is returned.
Map
Same format as .ini files
XSLT
eXtensible Sylt Sheet Langauge Transformation
XPath
A query language for XML formatted documents
JSONPATH
A query language for JSON formatted documents
Rules
Rules DSL
Custom language similar to XTend
One of the two default languages and the language of .rules files and when selecting Rules DSL as a language for a Script Action or Script Condition.
JavaScript
See above
One of the two default languages.
Python
Jython 2.7
Requires an add-on to be installed.
Groovy
Requires an add-on to be installed.
Blockly
Graphical programming environment similar to Scratch
defined JavaScript underneath the blocks.
Pages
JavaScript, Vue, F7, CSS
While these are the languages they are not really exposed directly to the users as is. Instead they are exposed to the user in YAML.
UI “code” tabs
YAML Ain’t Markup Language
Almost of the configs done through the UI will have a “Design” view and a “Code” view. When clicking on the “Code” view, the configuration is presented encoded in YAML.
JSONDB
JSON formatted database
All the configuration done through the UI gets saved encoded as JSON. You’ll only see this if you interact with the REST API or open the JSONDB files.
So, the code you pasted in above is a YAML encoding of the openHAB defined JSON data which is used to create and set the properties on F7 UI widgets.
It seems really complicated and overwhelming but no one needs to know all of the above. If you stick to the UI you probably only ever have to mess with two or three of the above.