OH3 Problem with RULE migration from OH2.5.1 item State and split does not work

  • Platform information:
    • Hardware: _CPUArchitecture/RAM/storage_RPI 4 ARMHF 2GB SSD
    • OS: _what OS is used and which version_RASBIAN
    • Java Runtime Environment: _which java platform is used and what version_ZULU_11
    • openHAB version: openHAB 3.0.1
  • Issue of the topic: My old OH2.5.1 Rule does not work after migration to OH3 so i need Help with DSL rules !
    I looked around in the Forum to find some answer but all i found does not help understanding the issue.

Thanks for your support…

Mario

  • Please post configurations (if applicable):
    • Items configuration related to the issue
    • Sitemap configuration related to the issue
    • Rules code related to the issue
      // Triggers:
      // - When homeconnect_CoffeeMaker_SIEMENS_TI9555X1DE_68A40E2D2838_operation_state changed to Finished

// context: HOMECON-1
Thread::sleep(3500)
val COFFEETYPE = SiemensKaffeevollautomat_SelectedProgram.split(’\.’).get(4)

logInfo(“SayCOFFEETYPE”, COFFEETYPE )
var String AUSWAHL
AUSWAHL=COFFEETYPE
var String SayText
SayText=“Dein “+ AUSWAHL +” ist fertig !”

logInfo(“SayCOFFEETYPE”, “SayText: {}”,SayText)

{
amazonechocontrol_echo_e09dae9e_G090LF09650409CH_textToSpeech.sendCommand(SayText)
}
  • Services configuration related to the issue
  • If logs where generated please post these here using code fences:

2021-04-11 12:31:55.588 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘HOMECON-1’ failed: ‘split’ is not a member of ‘org.openhab.core.library.items.StringItem’; line 6, column 19, length 53 in HOMECON

That’s an Item, yes? Items don’t have a .split() method (and didn’t inOH2.5 either).
It’s usually the state of an Item that you are interested in, and you’d want to be sure it was string in order to split()it.

SiemensKaffeevollautomat_SelectedProgram.state.toString.split(...

Thanks for the clear answer ! I have changed this and the rule runs like a charme…

Thanks for fast help… i think the documentation is not clear in the definition of itemState and .state, so my mistake was that i removed the .state.toString from the old rule after my old item Name was changed by the migration Task. I was also searching for a some time for the linked channels and items after migration because in OH3 all must linked manually because of the remove of “simple” mode.