本文整理汇总了Python中domogik.mq.message.MQMessage._action方法的典型用法代码示例。如果您正苦于以下问题:Python MQMessage._action方法的具体用法?Python MQMessage._action怎么用?Python MQMessage._action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类domogik.mq.message.MQMessage
的用法示例。
在下文中一共展示了MQMessage._action方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set
# 需要导入模块: from domogik.mq.message import MQMessage [as 别名]
# 或者: from domogik.mq.message.MQMessage import _action [as 别名]
def set(self, plugin, key, value):
"""
Send a xpl message to set value for a param
@param technology : the technology of the item
@param key : the key to set corresponding value,
@param value : the value to set
"""
msg = MQMessage()
msg._action = "config.set"
self.cli.request("dbmgr", msg.get(), timeout=QUERY_CONFIG_WAIT)
示例2: query
# 需要导入模块: from domogik.mq.message import MQMessage [as 别名]
# 或者: from domogik.mq.message.MQMessage import _action [as 别名]
def query(self, plugin, key, element="", nb_test=QUERY_CONFIG_NUM_TRY):
"""
Ask the config system for the value. Calling this function will make
your program wait until it got an answer
@param plugin : the plugin of the item requesting the value,
must exists in the config database
@param element : the name of the element which requests config, None if
it's a technolgy global parameter
@param key : the key to fetch corresponding value, if it's an empty string,
all the config items for this technology will be fetched
"""
msg = MQMessage()
msg._action = "config.get"
msg._data = {"plugin": plugin, "key": key, "element": element, "hostname": get_sanitized_hostname()}
ret = self.cli.request("dbmgr", msg.get(), timeout=QUERY_CONFIG_WAIT)
if ret is None:
return None
else:
if "value" in ret._data.keys():
return ret._data["value"]
else:
return None