I would like to migrate the following rule to Jyhton, but unfortunately I do not know how. I am grateful for any help!
rule "A Lacross sensor stopped reporting"
when
Member of LacrossDeviceStatuses changed to UNDEF
then
val telegramAction = getActions("telegram","telegram:telegramBot:xxxxx")
telegramAction.sendTelegram("LaCrosse sensor stopped reporting")
end
from core.rules import rule
from core.triggers import when
from core.actions import Telegram
@rule("lacrosse alive", description="blablabla")
@when("Member of LacrossDeviceStatuses changed to UNDEF")
def sensoren_alive(event):
sensoren_alive.log.info("LaCrosse sensor stopped reporting")
Telegram.sendTelegram("andi", "LaCrosse sensor stopped reporting")
unfortunately I get the following error message:
2019-12-30 20:02:56.652 [ERROR] [ion.module.script.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/python/personal/alive.py': ImportError: cannot import name Telegram in <script> at line number 3
Thank you Rich. Unfortunately the problem is still there, there seems to be a problem with the import.
2019-12-30 20:31:33.214 [ERROR] [ion.module.script.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/python/personal/alive.py': ImportError: cannot import name Telegram in <script> at line number 3