This topic can be used to discuss problems/experiences/questions on the openHAB 3.0 Milestone 2 - see details at https://github.com/openhab/openhab-distro/releases/tag/3.0.0.M2.
Getting an error adding the testing package.
deb https://openhab.jfrog.io/openhab/openhab-linuxpkg testing main
But unstable works:
deb https://openhab.jfrog.io/openhab/openhab-linuxpkg unstable main
to be sure I run and tried all the other tricks from Stackoverflow:
sudo rm /var/lib/apt/lists/* -vf
then on:
sudo apt-get update
I get:
Ign:7 https://openhab.jfrog.io/openhab/openhab-linuxpkg testing InRelease
Hit:8 https://openhab.jfrog.io/openhab/openhab-linuxpkg testing Release
Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/openhab.jfrog.io_openhab_openhab-linuxpkg_dists_testing_main_binary-i386_Packages
E: The package lists or status file could not be parsed or opened.
Some highlights on the frontend side for this release:
Scripts
You can now use the UI to write āscriptsā, which are rules that donāt have any triggers or conditions but a simple script action to execute your own code. When you create a script youāre just asked for an ID, label, description, and the language you prefer:
openHAB has support for ECMAScript (aka. JavaScript) and its Rule DSL by default but you can now add more languages by installing automation add-ons - a new add-on category; Groovy is the first language you can install but Iām sure there will be more.
Since Scripts are actually Rules, you can trigger them from other (UI-based) rules with the āRun Rulesā action. You can also run them on-demand, either while editing them, or with the ārun rulesā action in widgets that support it.
The Settings menu has been modified a bit to carve out the automation-related menu entries into a new āAutomationā group.
When youāre editing a Script (or an inline Script of a rule condition or action) you have several keyboard shortcuts that you can use:
- Ctrl-D: disable/enable the rule
- Ctrl-S: save the rule
- Ctrl-R: run the rule (ignoring the eventual triggers and conditions)
- Ctrl-B: switch back and forth to the Blockly view and the Code view (only for Blockly rules, see below)
You might see more options in that Automation area in the future, like Scenes - just set the desired items to the state you want and easily reset these items to these predefined states in bulk - it will still be a rule but with a separate UI to configure it.
Blockly
openHAB 3.0.0.M2 has experimental support for Blockly as an alternative way to write your JavaScript script conditions and actions in rules (and now standalone āScriptsā) that you edit via the UI.
There are a number of limitations:
- Blockly is only available in Script rules, actions and conditions when you select ECMAScript as your language of choice;
- when you start writing your own JS code, you cannot switch to Blockly - you have to start from scratch to build your rule with Blockly. Just erase the code and you will see the button appearing again;
- when you start designing a rule with Blockly, you can have a preview of the JavaScript code that will be generated, but you cannot edit it - the only way you can go back to writing your own code is to delete everything in the Blockly view and switch back to the Code view (with Ctrl-B or the button on the lower-right corner).
There are only a few blocks in the openHAB category currently to interact with your system, so itās quite limited - but in many cases reading and writing items will be enough at least for now!
Itās bound to be expanded, but there are only so many hours in a day. I can imagine being able to call thing actions or making HTTP requests, and more, and there is much to do in that area - if youāre willing to contribute new blocks, and can understand a little JavaScript, please step up, contributors especially in that area would be appreciated! Iāll be glad to assist you in how to write them.
Autocompletion Everywhere
Many of the Code views you see throughout the UI now have āsmartā autocompletion to help you write your code - whether itās Things (a new way of configuring them in the UI), rules, pages or widgets, you can hit Ctrl-Space on your keyboard and chances are, you will get some hints:
Itās not perfect, and there are still ongoing issues with it, but overall it works pretty well and will help you configure stuff way easier when you choose to edit a little bit of YAML instead of clicking through the UI - just hit Ctrl-Space when in doubt and you might get the insight you need.
By the way - previously the errors in a YAML code editor would be displayed in an area below which would take a lot of screen real estate; now the errors are shown with wavy underlines and tooltips:
Widget Variables
Using variables and expressions has been expanded to sub-properties, like classes or CSS attributes, and there are now āinputā widgets in the System, Standard (standalone), System (list item) libraries that can be used to receive text, numbers, dates and the like. For example have a look at the Keypad widget as a first example of what these facilities combined together can do:
@RGroll is also making a Weather widget that youāll want to check out too:
Misc
There are a lot of other improvements, check them out here!
Hope you like this release - next one will likely focus on giving you a nice home page!
Thumbs up for blockly. Iām sure this can be used as intermediate step, when basic rules are not enough but youāre not able (or just too lazy) to develop a script.
@Kai can you please add my new remoteopenhab binding as new binding in the release notes?
Edit : working now
Error while upgrading
Rpi4 8g Running opehabian - openhabian-pi-raspios64beta
Yes this is untested beta software and no I donāt rely on it to be working. Someone has to test
installed openhab package post-installation script subprocess returned error exit status 1
apt-get upgrade --yes
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
openhab openhab-addons rpi-eeprom
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 253 MB of archives.
After this operation, 12.1 MB of additional disk space will be used.
Get:1 https://openhab.jfrog.io/openhab/openhab-linuxpkg testing/main arm64 openhab all 3.0.0~M2-1 [82.0 MB]
Get:2 http://archive.raspberrypi.org/debian buster/main arm64 rpi-eeprom arm64 10.2-1 [386 kB]
Get:3 https://openhab.jfrog.io/openhab/openhab-linuxpkg testing/main arm64 openhab-addons all 3.0.0~M2-1 [170 MB]
Fetched 253 MB in 1min 53s (2,229 kB/s)
apt-listchanges: Reading changelogs...
(Reading database ... 52682 files and directories currently installed.)
Preparing to unpack .../openhab_3.0.0~M2-1_all.deb ...
Unpacking openhab (3.0.0~M2-1) over (3.0.0~M1-1) ...
Preparing to unpack .../openhab-addons_3.0.0~M2-1_all.deb ...
Unpacking openhab-addons (3.0.0~M2-1) over (3.0.0~M1-1) ...
Preparing to unpack .../rpi-eeprom_10.2-1_arm64.deb ...
Unpacking rpi-eeprom (10.2-1) over (10.1-1) ...
Setting up openhab (3.0.0~M2-1) ...
Installing new version of config file /etc/openhab/services/addons.cfg ...
Installing new version of config file /etc/openhab/services/runtime.cfg ...
[openHAB] Performing post-update tasks for version 3.0.0:
Replacing: String org.eclipse.smarthome.i18n to org.openhab.i18n in file /var/lib/openhab/config/org/openhab/i18n.config
Moving: From /var/lib/openhab/config/org/eclipse/smarthome/audio.config to /var/lib/openhab/config/org/openhab/audio.config
Replacing: String org.eclipse.smarthome.audio to org.openhab.audio in file /var/lib/openhab/config/org/openhab/audio.config
Moving: From /var/lib/openhab/config/org/eclipse/smarthome/voice.config to /var/lib/openhab/config/org/openhab/voice.config
Replacing: String org.eclipse.smarthome.voice to org.openhab.voice in file /var/lib/openhab/config/org/openhab/voice.config
Replacing: String org.eclipse.smarthome.folder to org.openhab.folder in file /var/lib/openhab/config/org/openhab/folder.config
Replacing: String org.eclipse.smarthome.threadpool to org.openhab.threadpool in file /var/lib/openhab/config/org/openhab/threadpool.config
Replacing: String org.eclipse.smarthome.autoupdate to org.openhab.autoupdate in file /var/lib/openhab/config/org/openhab/autoupdate.config
Replacing: String org.eclipse.smarthome.lsp to org.openhab.lsp in file /var/lib/openhab/config/org/openhab/lsp.config
Replacing: String org.eclipse.smarthome.rulehli to org.openhab.rulehli in file /var/lib/openhab/config/org/openhab/rulehli.config
Replacing: String org.eclipse.smarthome.core to org.openhab.core in file /var/lib/openhab/jsondb/org.openhab.core.config.discovery.DiscoveryResult.json
Replacing: String org.eclipse.smarthome to org.openhab.core in file /var/lib/openhab/jsondb/org.openhab.core.config.discovery.DiscoveryResult.json
Replacing: String org.eclipse.smarthome.core to org.openhab.core in file /var/lib/openhab/jsondb/org.openhab.core.items.Item.json
Replacing: String org.eclipse.smarthome to org.openhab.core in file /var/lib/openhab/jsondb/org.openhab.core.items.Item.json
Replacing: String org.eclipse.smarthome.core to org.openhab.core in file /var/lib/openhab/jsondb/org.openhab.core.items.Metadata.json
Replacing: String org.eclipse.smarthome to org.openhab.core in file /var/lib/openhab/jsondb/org.openhab.core.items.Metadata.json
Replacing: String org.eclipse.smarthome.core to org.openhab.core in file /var/lib/openhab/jsondb/org.openhab.core.thing.link.ItemChannelLink.json
Replacing: String org.eclipse.smarthome to org.openhab.core in file /var/lib/openhab/jsondb/org.openhab.core.thing.link.ItemChannelLink.json
Replacing: String org.eclipse.smarthome.core to org.openhab.core in file /var/lib/openhab/jsondb/org.openhab.core.thing.Thing.json
Replacing: String org.eclipse.smarthome to org.openhab.core in file /var/lib/openhab/jsondb/org.openhab.core.thing.Thing.json
Deleting Directory: /var/lib/openhab/config/org/eclipse/smarthome
Deleting Directory: /var/lib/openhab/config/com/eclipsesource
dpkg: error processing package openhab (--configure):
installed openhab package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of openhab-addons:
openhab-addons depends on openhab; however:
Package openhab is not configured yet.
dpkg: error processing package openhab-addons (--configure):
dependency problems - leaving unconfigured
Setting up rpi-eeprom (10.2-1) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for systemd (241-7~deb10u4) ...
Errors were encountered while processing:
openhab
openhab-addons
Updating FireMotD available updates count ...
E: Sub-process /usr/bin/dpkg returned an error code (1)
FAILED
Working now after
[01:24:56] openhabian@openHABianDevice:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up openhab (3.0.0~M2-1) ...
[openHAB] openHAB was not running so will not start after upgrade.
[openHAB] Please use the command:
sudo /bin/systemctl start openhab.service
Setting up openhab-addons (3.0.0~M2-1) ...
Updating FireMotD available updates count ...
[01:25:29] openhabian@openHABianDevice:~$ sudo systemctl status openhab.service
ā openhab.service - openHAB instance, reachable at http://openHABianDevice:8080
Loaded: loaded (/usr/lib/systemd/system/openhab.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/openhab.service.d
āāoverride.conf
Active: active (running) since Tue 2020-11-03 01:16:16 CET; 9min ago
Docs: https://www.openhab.org/docs/
https://community.openhab.org
Main PID: 2968 (java)
Tasks: 171 (limit: 4915)
CGroup: /system.slice/openhab.service
āā2968 /usr/bin/java -Dopenhab.home=/usr/share/openhab -Dopenhab.conf=/etc/openhab -Dopenhab.runtime=/usr/share/openhab/runtime -Dopenhab.userd
Nov 03 01:14:16 openHABianDevice systemd[1]: Starting openHAB instance, reachable at http://openHABianDevice:8080...
In the past Iāve noticed that when running an Action Script directly (e.g. by triggering a Rule using the play button or running the rule from another rule) that some things are missing from the context. The mode impactful missing thing is access to the Actions. For example:
var Log = Java.type("org.openhab.core.model.script.actions.Log");
Log.logError("Experiments", "This is an OH error log");
Log.logWarn("Experiments", "This is an OH warn log");
Log.logInfo("Experiments", "This is an OH info log");
Log.logDebug("Experiments", "This is an OH debug log");
This run just fine when the rule i triggered by an Item event. But if itās triggered by pressing play or triggering it from another rule I get a Class not found exception on org.openhab.core.model.script.actions.Log.
Is this also the case with these scripts? If so itās a pretty significant limitation and need to be mentioned. If not than āwoohoo!ā
@denominator There is an open issue on this. My finding ist that this error only occurs if OH3 is running when trying to upgrade. If oh3 is stopped the upgrade process works fine.
@Kai can you please add my new remoteopenhab binding as new binding in the release notes?
Good point, we had missed to tag that PR with the milestone when merging. I have added it manually to the release notes now.
@Lolodomo May I ask you in return to do a small PR to fix the table in the docs? Thanks
I noticed the Z-Wave Thing documentation there is not current. We just checked and the new documentation is in the binding repo. The old docs reference the old database site.
examples:
Yes, unfortunately - they are just rules so they suffer from the same problems. This is probably fixable and should be addressed. The ālogā block in Blockly is translated to code that instantiates what you call a ānative loggerā (from org.slf4j.LoggerFactory
, which works) in openHAB 3.0 my getting started notes: Rules - by the way, your notes were helpful as a reference.
Hello,
first of all, thank you for that awesome Milestone! Itās fantastic. I am playing around with the new version and have one question. Is it or will it be possible to import existing thing and item files?
Thank you for your work and help!
johannes
Itās already possible to import existing Item files.
After clicking the + icon on the Items page select āAdd Items from Textual Definitionā and you can paste the contents of a .items file there and it will load them into JSONDB. NOTE: You then will need to remove the .items file. You donāt want OH to have the same Item defined in both places.
There is no equivalent for .things files (yet?). But for that case you would probably want to rediscover the Things anyway.
Thank You, for items thats fantastic, but for my knx thing file it is a desasterā¦ I have to manual add every knx device and the channels withe the adressesā¦ Is there no other possibility for things than readding them by the UI?
You can keep on using the .things files you already have. Support for .things and .items files donāt go away.
Thank you Rich, I know it, but I thought that a managment in the internal database is better.
An other question is, how can I take a look with frontail in the oh log?
Install openHABian or install and configure Frontail manually and then point your browser to where Frontail is running. Frontail isnāt actually a part of openHAB. Itās a separate service.
One thing you could try is request http://oh2:8080/rest/things
on your openHAB 2 instance. This will dump every thing in JSON format. Itās ugly but you can pretty-print it for instance with Best JSON Pretty Print Online, so you can identify individual things more easily - itās an array of objects like
[
{
...
},
{
...
}
]
You have to extract every one of those objects, and in OH3 you can go to Developer Tools (on the left), API Explorer, expand āthingsā then the green āPOST /thingsā entry. On the right click on Try it out, and paste the things you extracted from above under āthing dataā, overwriting the example. Then click on the Execute button. This should add the thing to the internal DB.
Iām not guaranteeing this will work 100% but you can try with one thing and see how it goes.
If you know a scripting language like Python it wouldnāt even be too hard to write a program with a simple loop to do all this for you.
The .things syntax is a little more convoluted than the .items syntax (itās also far less documented) so writing a Nearley grammar for it so to parse them into JS objects is even more of an headache. Itās also not a flat list, there are blocks and so on. For reference the grammar for the .items syntax is here: openhab-webui/bundles/org.openhab.ui/web/src/assets/items-lexer.nearley at main Ā· openhab/openhab-webui Ā· GitHub. Thereās also one for sitemaps here: openhab-webui/bundles/org.openhab.ui/web/src/assets/sitemap-lexer.nearley at main Ā· openhab/openhab-webui Ā· GitHub
If anyone wants to give it a shot, though, that would be awesome
Since Blockly is integratedā¦ will NodeRed also be part of OH3 in the future?