openHAB 3.0 Milestone 4 discussion

One important usage of this forum is solution sharing. How can this be done if everything is migrated to the new UI ? For example, your design patterns.

Another aspect is migration. I’ve migrated from OH2 to OH3 with no problems besides DateTimes. If everything is in jsondb is it easy to migrate ? And take backup ?

I would love to also make the jump to the new UI.

One important usage of this forum is solution sharing. How can this be done if everything is migrated to the new UI ? For example, your design patterns.

In the main UI you can export the configuration and share this. On each rule, thing etc. you ahve a page “Code” that shows the configuration of your thing/rule. You can copy this and share it here with others. Also for old ITEM configuration files, theyy can be imported on OH3 on an admin page, so also the old design patterns can be shared.

Another aspect is migration. I’ve migrated from OH2 to OH3 with no problems besides DateTimes. If everything is in jsondb is it easy to migrate ? And take backup ?

Before updating to OH3 you should perform an backup in any case. So copy the userdata, conf and addons folder to another location in case you need them or the OH3 installation fails. As you mentioned the main change in the rules is the Joda time to ZonedDateTime. All other stuff from your rules should still run, unless if in jsondb or on a rules file.

1 Like

Just remember v1 & v2 addons do not work with OH3.

Design Patterns are a generic way to solve common problems in OH. As such they are, with only a couple of exceptions, independent of the programming language rules are written in and how the rules are written (text based or through the UI).

All of the DPs have a Pyton example already added and I’ve started providing JavaScript YAML examples (Time of Day is the only one I’ve posted so far). In each case I try to write the example in a way that shows off the strength of the Language so, for example, the YAML/JavaScript Time of Day example is written to use Ephemeris and uses Item metadata.

With the exception of Items right now, everything in MainUI has a code tab that shows the entity encoded as YAML for sharing in the forum and elsewhere. The entity can be edited in the code view by hand if desired as well (great fit cases where one needs to copy/paste/edit a bunch of Things for example).

I’m not migrating and am instead rebuilding so I don’t know. I think there are some namespaces in the JSONDB fingers that need to be changed.

Backups are the same as ever. In fact they are even better as the JSONDB file are backed up automatically for you on every change so if you encounter a corruption (e. g. the machine crashed while writing out one of the files) there will be a backup created a moment before the failed write.

And the JSONDB files are just text and can be checked in to source control. I do this myself.

1 Like

@buschif4 & @rlkoshak - would you be able to share how OH automatically generates the pages for the semantic model? Is it based on the item groups? In the past there have been two common approaches to group items together into a zone:

  1. Use of group.
  2. Use of the naming convention.

Is there any new changes to the item syntax?

Thanks,

1 Like

See [wiki] Getting Started with OH3: rewriting the tutorial - 6. Model your home with Items & link Channels. The model is based on group membership and Item tags. And it’s way more involved, and subsequently way more powerful than the Group tag on sitemaps.

It would be great if you actually went through the whole Getting Stated tutorial and add comments and make edits as you go. [wiki] Getting Started with OH3: rewriting the tutorial - 1. Introduction

No, not even for the model which was something supported even in OH 2.5 but was only used by HABot.

Any updates with:

EventHandler] - Dispatching event to subscriber ‘org.openhab.core.automation.internal.module.handler.ItemStateTriggerHandler@18c1509e’ takes more than 5000ms.

I’m still getting it with last snapshot - 2039
Openhab is almost unusable.

Cannot confirm it to be unusable. I have moved my productive environment to SNAPSHOT 2039 and see no issues so far…

After Openhab start, in few minutes I can’t change manually state of my lights :confused:, other rules also hangs.

Absolutely not my experience. Rules running as expected and response to switching lights is absolutely fine, even controlling them via Alexa skill…

Hello,
i always get this error:

script execution of rule with UID 'ephemeris-1' failed: An error occurred during the script execution: Could not invoke method: org.openhab.core.model.script.actions.BusEvent.postUpdate(org.openhab.core.items.Item,org.openhab.core.types.State) on instance: null in ephemeris

how do i know which rule is ephermis-1 ??? and what is there all about?

I’ve reverted to 2037 - looks much better for now.

There is an issue to address that and use the rule name instead of UID in those errors. In the mean time you can query the REST API for the rule with that UID and you should be able to tell from the JSON you get back which rule is the problem.

I would expect you have a rule names or containing “ephemeris” in the name.

@rlkoshak How do I query the rule Id via rest?

Much more complex and less legible than just copy/paste files to this forum… A bulk export/import would be welcome.

Just open thé rules page to see the mapping rule name / rule UID,

Go to Developer Tools -> API Explorer and scroll down to the Rules section. They are interactive docs so you can issue the query from there.

It’s no more or less legible than the .things file syntax and .rules file syntax. Don’t confuse familiarity with legibility.

And it’s not more complex than opening a text editor, opening the .rules file, and copy and paste the rule into the forum.

The steps are literally just open MainUI, browse to the rule, click on “code”, copy and paste the rule into the forum. There’s only one extra click.

I’ve already opened an issue for import of the YAML files.

I don’t know if there is an issue for bulk import/export. I’m not sure it makes a lot of sense. If you are working with bulk like that it may make more sense to use the raw JSON and REST API, the JSONDB files themselves, or just stick to your text based configs in the first place. But a feature request can be made by anyone.

I’m having some trouble converting my OH2 DSL rules over to OH3 when they use Ephemeris.

The OH2 rule is:

rule "Weekend Morning" 
when
          Time cron "0 30 07 ? * * *"
  then
        if ((Morning_Scene.state != ON) && ((Holiday_Scene.state == ON) || Ephemeris.isWeekend || Ephemeris.isBankHoliday) {
                Morning_Scene.sendCommand(ON)
        }
end

And my corresponding OH3 rule is:

triggers:
  - id: "1"
    configuration:
      cronExpression: 0 30 7 * * ? *
    type: timer.GenericCronTrigger
conditions:
  - inputs: {}
    id: "2"
    label: Not work day
    configuration:
      type: application/vnd.openhab.dsl.rule
      script: (Holiday_Scene.state == ON) || Ephemeris.isWeekend ||
        Ephemeris.isBankHoliday
    type: script.ScriptCondition
  - inputs: {}
    id: "4"
    configuration:
      itemName: Morning_Scene
      state: ON
      operator: "!="
    type: core.ItemStateCondition
actions:
  - inputs: {}
    id: "3"
    configuration:
      itemName: Morning_Scene
      command: ON
    type: core.ItemCommandAction

But the rule fails with the less than helpful message

[ERROR] [e.automation.internal.RuleEngineImpl] - Failed to execute rule 'Weekend_Morning': null

Any suggestions?

The only code here is in the conditions. That’s the most likely source of the error. I can think of a few ways to debug this.

  1. First make sure Morning_Scene is properly defined. I’m assuming you selected the Item through the UI so it’s probably fine but if you edited the YAML in the code tab it might have a typo or something.

  2. Simplify the script condition. Just check for Holiday_Scene first. If that works add in the isWeekend and then the isBankHoliday. That should tell you which call is failing or if there is something fundamentally wrong with the script over all if Holiday_Scene.state == ON fails.

There is nothing obviously wrong with the rule over all. But I’ve no experience writing Rules DSL in MainUI so there may be something I don’t know that is acting weird. We need to find which of those three calls is failing to determine if a bug needs to be filed I think.