Migrating to OH3: Success and Challenges

Upgrading to OpenHAB 3 has been an exciting journey! I’m thrilled to share that 99% of my OH 2.5 setup works seamlessly in M3. The transition has been smoother than I anticipated, which is a huge relief after all the research and preparation. However, there’s one area where I’m hitting a snag—my heating automation rules. I’ve managed to fix the ScriptServiceUtil error, but I’m stuck with an issue in the rule that controls my heating system. Let me walk you through what’s happening.

The Setup

I have several heating-related items defined in my system, including switches for heat needs on different floors and target temperature settings. Here’s a snippet of the relevant items:

plaintext
Switch BF_Heat_Need “Basement heat need” (gHneed)
Switch GF_Heat_Need “Ground floor heat need” (gHneed)
Switch FF_Heat_Need “First floor heat need” (gHneed)
Group:Number gHeatingTargetTemp (gHeating)
Number BF_Target_Temp “Basement target temp [%.1f °C]” (gHeatingTargetTemp)
… (and others)

The Rule

The problematic rule is designed to react when any heating need switch changes state. Here’s the relevant part of the rule in OH3:

plaintext
triggers:

  • id: “0”
    configuration:
    groupName: gHneed
    type: core.GroupStateChangeTrigger
    conditions:
    actions:
  • inputs: {}
    id: script
    configuration:
    type: application/vnd.openhab.dsl.rule
    script: |
    // context: heating_mode-4
    BF_Heating_Pump.sendCommand(gHneed.state)
    GF_Heating_Pump.sendCommand(GF_Heat_Need.state)
    FF_Heating_Pump.sendCommand(FF_Heat_Need.state)
    type: script.ScriptAction

The Issue

When I manually set GF_Heat_Need to “ON” to test the system, I encounter this error:

plaintext
2020-11-28 10:59:25.982 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘heating_mode-4’ failed: An error occurred during the script execution: Could not invoke method: org.openhab.core.model.script.actions.BusEvent.sendCommand(org.openhab.core.items.Item,java.lang.String) on instance: null in heating_mode

It seems like something isn’t initialized properly, but the error message isn’t giving me much to go on. I’ve tried manually assigning values to the XX_Heat_Need variables, but the issue persists.

Seeking Help

Has anyone else encountered similar issues when migrating rules from OH 2.5 to OH 3? I’d greatly appreciate any insights or suggestions on how to resolve this. I suspect it might be related to how the script actions are handled in OH3, but I’m not entirely sure. Any tips or pointers would be invaluable!

On a positive note, I’m really impressed with how OH3 has improved upon its predecessor, especially the enhanced rule engine and better integration capabilities. It’s just a matter of ironing out these kinks, and I’m confident the community can help me get through this!

Cheers,
[Your Name]