Example #1
0
``core.actions`` module. The action methods are static methods on those classes
(don't try to create instances of the action classes).

.. warning:: In order to avoid namespace conflicts with the ``actions`` object
    provided in the default scope, don't use ``import core.actions`` or
    ``from core import actions``.

See the :ref:`Guides/Actions:Actions` guide for details on the use of this
module.
"""
import sys
from core import osgi

__all__ = []

oh1_actions = osgi.find_services(
    "org.openhab.core.scriptengine.action.ActionService", None) or []
oh2_actions = osgi.find_services(
    "org.eclipse.smarthome.model.script.engine.action.ActionService",
    None) or []

_module = sys.modules[__name__]

for s in oh1_actions + oh2_actions:
    action_class = s.actionClass
    name = str(action_class.simpleName)
    setattr(_module, name, action_class)
    __all__.append(name)

try:
    from org.openhab.core.model.script.actions import Exec
    from org.openhab.core.model.script.actions import HTTP
``core.actions`` module. The action methods are static methods on those classes
(don't try to create instances of the action classes).

.. warning:: In order to avoid namespace conflicts with the ``actions`` object
    provided in the default scope, don't use ``import core.actions`` or
    ``from core import actions``.

See the :ref:`Guides/Actions:Actions` guide for details on the use of this
module.
"""
import sys
from core import osgi

__all__ = []

OH1_ACTIONS = osgi.find_services(
    "org.openhab.core.scriptengine.action.ActionService", None) or []
OH2_ACTIONS = osgi.find_services(
    "org.eclipse.smarthome.model.script.engine.action.ActionService",
    None) or []

_MODULE = sys.modules[__name__]

for action in OH1_ACTIONS + OH2_ACTIONS:
    action_class = action.actionClass
    name = str(action_class.simpleName)
    setattr(_MODULE, name, action_class)
    __all__.append(name)

try:
    from org.openhab.core.model.script.actions import Exec
    from org.openhab.core.model.script.actions import HTTP