[Solved] MQTT Command ‘0’ not supported by type ‘OnOffValue’

In MainUI go to Settings → Items → + icon to add Item

You can paste part or a whole .items file there to import. You can also just type in a bunch of new Items there, it checks the syntax as you type.

You can also get to this screen from Developer Tools → Add Items from Text Definition

This is covered at a high level in the Getting Started Tutorial: Semantic Model | openHAB

Definitely go through that tutorial.

You’re not using a mixed configuration. You are creating an example which you can then immediately delete if you don’t need it any more. All of your functional configuration would be in .things files in that case.

The problem was when there was a Link between an Item and a Channel and one deletes the Item or the Channel without first deleting the Link. This is harder to do now and in the rare cases where it might occur (usually because you are doing stuff with the REST API manually instead of using MainUI) there are commands in the Karaf console that can clean that up.

Future proof doesn’t really exist. Everything will stop being supported at some point. The currently built in JavaScript (ECMAScript 5.1, Nashorn) is probably first to go. It’s already deprecated in Java 14 and no longer exists in any version of Java after that. Java 14 is nearing end of life so OH will have to move. Jython doesn’t really have upstream support any more so at some point it will break and we won’t be able to fix it.

I am currently using the JS Scripting add-on and creating 100% UI based rules. It’s JavaScript (ECMAScript 2021 to be precise) and with the helper library that it comes with it’s way more powerful than Rules DSL but just about as easy to use.

If you are not a programmer, I recommend using Blockly. A lot of users are converting their old Rules DSL rules to Blockly actually. It’s easier to understand and build for most and has far more capabilities.

But even before that I recommend looking at the Marketplace. Why code a rule when you can just install and configure it? There is a growing library of rule templates, some very low level (Debounce [3.2.0;3.4.9]), some simple (To Today [3.2.0;3.4.9)), and some a complete suite (Scene Control Suite - Scene Modification).

Nothing is YAML based. The only place you see YAML is in MainUI which converts JSON to YAML because YAML is way easier for a human to read and understand. But OH stores and internally uses JSON. But you as the rules coder never really have to look at YAML unless you want to (e.g. to duplicate something using copy/paste/edit) or you need help from the forum (we like when people post the YAML instead of screenshots).

You’d code in the web based editor which has syntax highlighting and some code completion and a lot of the stuff you are used to from VS Code too. This is one of my JS Scripting Script Actions.

This full rule appears in MainUI as

But that isn’t really helpful. To see the YAML translation of the JSON that actually makes up the rule click on the Code tab.

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: HomeEnergyMeter_ElectricmeterkWh
    type: core.ItemStateChangeTrigger
  - id: "2"
    configuration:
      itemName: HomeEnergyMeter_Access
    type: core.ItemStateChangeTrigger
  - id: "3"
    configuration:
      itemName: HomeEnergyMeter_Rate
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "4"
    label: Calculate the power bill and update the Item
    configuration:
      type: application/javascript;version=ECMAScript-2021
      script: >
        var logger = log('Power Bill Estimate');


        var curr = items.getItem('HomeEnergyMeter_ElectricmeterkWh').rawState;

        var rate = items.getItem('HomeEnergyMeter_Rate').rawState;

        var access = items.getItem('HomeEnergyMeter_Access').rawState;

        var estimate = (curr * rate) + access;

        items.getItem('HomeEnergyMeter_CurrentBillEstimate').postUpdate(estimate.toString());

        logger.debug('Calculated bill = ${}', estimate);
    type: script.ScriptAction

Here’s a Blockly Script Action.

1 Like