I’m experimenting with Jython script support and stumpled upon a bug when trying to register a rule for several items.
The error message I got was:
17:19:08.175 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/homie_monitoring.py': UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 49: ordinal not in range(128) in <script> at line number 26
The script looked like:
(it’s work in progress and contains some non-working code commented out and maybe some unused imports)
se.importPreset("RuleSimple")
se.importPreset("RuleSupport")
from openhab.triggers import item_triggered
from openhab.actions import Telegram
from openhab.log import logging
from openhab import triggers
rlog = logging.getLogger("RULES.Monitor.Homie")
class monitorHomieDevices(SimpleRule):
def __init__(self):
lm_reg = itemRegistry.getItem('homieOnline')
for i in lm_reg.getAllMembers():
rlog.debug("Item added: " + str(i))
triggers = []
#return "homie_online changed!"
#@item_triggered("message_info")
#def sendInfoMessage():
# Telegram.sendMessage("Test:" + str(message_info))
automationManager.addRule(monitorHomieDevices())
Idea of the script is to iterate over all items of a group and add a ItemChangedTrigger for each group member.
u’\xfc’ is the ‘ü’ character. So there is definitely no ‘ü’ in the script and also none in the items names.
However, there was a ‘ü’ in one item’s label:
Switch kueche_online "Küchen-Controller [MAP(ONLINE.map):%s]" (Kueche, homieOnline, rrd_graph) {mqtt="<[local:homie/kueche/$online:state:MAP(binary.map)]"}
Changing the label to “Kuechen-Controller [MAP(ONLINE.map):%s]” solved the issue.
However, the label is for representation only, so there is something seriously wrong, if someone wants to convert the label to python code?!
I wanted to file a bug for this, but I have absolutely no idea, which component is responsible for this?
Is it openhab-core? eclipse-smarthome? openhab2-addons? Or openhab2-jython? (@steve1 ?).