Migrating my rules to Jython

Lol… I think this is the third time I’ve answered this for you :slightly_smiling_face:. Scripts have several things added into the default script scope, which are documented here…

To use them in a module, use core.jsr223.scope to pull them in from the default script scope using something like this…

from core.jsr223.scope import StringType

Don’t be fooled into thinking you need to import these classes! Scripted automation builds a layer of abstraction between your rules, the rule engine, and OH. These class names have changed in OH 3.0. If you use them, this will break your rules when you upgrade and they could also very likely change again in the future. Soon, there will be even more helpful abstraction provided through a Scripting API, which will replace the core helper libraries.

1 Like