diff --git a/libs/lib/examples/test_dev_action.py b/libs/lib/examples/test_dev_action.py new file mode 100644 index 0000000000000000000000000000000000000000..1ecd0297c6befa0e32611be58b39e3d86d152920 --- /dev/null +++ b/libs/lib/examples/test_dev_action.py @@ -0,0 +1,23 @@ +""" +Simple message encoding / decoding to test the search method +""" + +from xaal.lib import MessageFactory, MessageType +from xaal.lib import config, core, helpers, engine +from xaal.schemas import devices + +helpers.setup_console_logger() + +mf = MessageFactory(config.key) +source = devices.hmi() +target = devices.lamp_color() + +data = mf.build_msg(source, [target.address], MessageType.REQUEST, 'turn_off', {'smooth': 20}) +msg = mf.decode_msg(data) +assert msg + +print(f"Message: {msg}") +engine.run_action(msg, target) + +method, params = core.search_action(msg, target) +print(f"Method found: {method} params {params} ")