本文整理汇总了Python中MasterSql.update_enocean_log方法的典型用法代码示例。如果您正苦于以下问题:Python MasterSql.update_enocean_log方法的具体用法?Python MasterSql.update_enocean_log怎么用?Python MasterSql.update_enocean_log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MasterSql
的用法示例。
在下文中一共展示了MasterSql.update_enocean_log方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import MasterSql [as 别名]
# 或者: from MasterSql import update_enocean_log [as 别名]
#.........这里部分代码省略.........
"""
Callback called each time a knx_read packet is received.
"""
daemons = self.sql.get_daemons(db);
slave_name = self.get_slave_name(json_obj, daemons);
if slave_name is None:
return None;
slave_name = slave_name.split('.')[0];
self.knx_manager.send_knx_read_request_to_slave(slave_name, json_obj);
connection.close();
def monitor_ip(self, json_obj, connection, db):
"""
Callback called each time a monitor_ip packet is received.
A new local network scan is performed and the result stored in the database
"""
self.scanner.scan();
self.sql.insert_hostlist_in_db(self.scanner._HostList, db);
self.hostlist = self.scanner._HostList;
connection.close();
def monitor_bluetooth(self, json_obj, connection, db):
"""
TODO
"""
connection.close();
return None;
def monitor_enocean(self, json_obj, connection, db):
"""
Callback called each time a monitor_enocean packet is received.
Stores the data in enocean_log table.
"""
daemon_id = self.sql.update_enocean_log(json_obj, db);
doList = self.enocean_manager.update_room_device_option(daemon_id, json_obj, db);
connection.close();
if doList:
self.scenario.setValues(self.get_global_state(db), self.trigger, self.schedule, connection, doList);
self.scenario.start();
return None;
def send_to_device(self, json_obj, connection, db):
"""
Retrieves the good device in the database and builds the request to send.
"""
hostname = '';
dm = DeviceManager(int(json_obj['data']['room_device_id']), int(json_obj['data']['option_id']), DEBUG_MODE);
dev = dm.load_from_db(db);
if dev is None:
connection.close();
return ;
if 'daemon_name' in dev:
for host in self.hostlist:
if dev['daemon_name'] == host._Hostname:
hostname = host._Hostname;
break;
function_writing = int(dev['function_writing']);
if (function_writing > 0):
try:
self.functions[function_writing](json_obj, dev, hostname);
except Exception as e:
self.logger.error(e);
connection.close();
def upnp_audio(self, json_obj, dev, hostname):
cmd = UpnpAudio(dev['addr'], int(dev['plus1']));