Upgrade to 2.5.5 and having issues with JSR223

From something in the helper libraries or something of yours?

just having
from org.openhab.core.library.types import PercentType
caused the playsound to error

Sureā€¦ and I understand why it would! So, this must have been a personal module?

No it was an openhab module. I havenā€™t created any personal modules in openhab

None of the Jython helper library modules have that import. Which module are you seeing withā€¦

run the code below and it will fail. comment out from org.openhab.core.library.types and it runs
sorry I donā€™t know what it was for anymore my testswitch has grown pretty long over time

scriptExtension.importPreset(ā€œRuleSupportā€)

scriptExtension.importPreset(ā€œRuleSimpleā€)

from core.triggers import ItemCommandTrigger, ItemStateChangeTrigger, ItemStateUpdateTrigger, CronTrigger

from org.openhab.core.library.types import PercentType

from core.actions import Audio

class Update_Power_CheckRuleon(SimpleRule):

def __init__(self):

    self.triggers = [

        TriggerBuilder.create()

                .withId("MyTrigger")

                .withTypeUID("core.ItemStateChangeTrigger")

                .withConfiguration(

                    Configuration({

                        "itemName": "My_TestSwitch_1",

                        #"state":"ON"

                    })).build()

    ]

def execute(self, module, input):

    Audio.playSound ("doorbell.mp3",PercentType(100));

automationManager.addRule(Update_Power_CheckRuleon())

do you know what help library iā€™d need to import a config file like below

import config as _cfg

Thanks for any help you have on thisā€¦Greg

Thanks for all the help Iā€™ve got this one working now.
The playsound is just if anyone else has the problem coming for 2.4 it could be the issue

OKā€¦ so it was a personal module after all, so it all makes sense! Just shout if you need anything else!

Itā€™s an openahb module not mine see below.
image

org.openhab.core.library.types.PercentType is an OH package, but you are importing it in a personal moduleā€¦

Instead, useā€¦

from core.jsr223.scope import PercentType

ā€¦ rather than going after it directly. If this is in a script, then no import is needed, since PercentType is included in the default script scope. Either way, it is MUCH easier to use the decorators for creating rules.