本文整理汇总了Python中MasterSql.get_daemons方法的典型用法代码示例。如果您正苦于以下问题:Python MasterSql.get_daemons方法的具体用法?Python MasterSql.get_daemons怎么用?Python MasterSql.get_daemons使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MasterSql
的用法示例。
在下文中一共展示了MasterSql.get_daemons方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import MasterSql [as 别名]
# 或者: from MasterSql import get_daemons [as 别名]
#.........这里部分代码省略.........
sdx1 = glob.glob('/dev/sd?1')[0];
if not (os.path.exists(sdx1)):
return;
os.system('mount '+sdx1+' /etc/domoleaf/mnt');
path = '/etc/domoleaf/mnt/backup/';
filename = 'domoleaf_backup_';
os.system('mkdir -p '+path);
t = str(time.time());
if '.' in t:
t = t.split('.')[0];
filename += t+'.sql';
os.system("mysqldump --defaults-file=/etc/mysql/debian.cnf domoleaf > "+path+filename);
os.system('cd '+path+' && tar -czf '+filename+'.tar.gz'+' '+filename);
os.system('rm '+path +filename);
os.system('umount /etc/domoleaf/mnt');
def monitor_knx(self, json_obj, connection, db):
"""
Callback called each time a monitor_knx packet is received.
Updates room_device_option values in the database and check scenarios.
"""
daemon_id = self.sql.update_knx_log(json_obj, db);
doList = self.knx_manager.update_room_device_option(daemon_id, json_obj, db);
if doList:
self.scenario.setValues(self.get_global_state(db), self.trigger, self.schedule, connection, doList);
self.scenario.start();
connection.close();
def knx_write_short(self, json_obj, connection, db):
"""
Callback called each time a knx_write_short packet is received.
Updates room_device_option values in the database.
"""
daemons = self.sql.get_daemons(db);
slave_name = self.get_slave_name(json_obj, daemons);
if slave_name is None:
connection.close();
return None;
dev = {}
dev["addr_dst"] = json_obj['data']['addr']
slave_name = slave_name.split('.')[0];
self.knx_manager.send_knx_write_short_to_slave(json_obj, dev, slave_name);
connection.close();
return None;
def knx_write_long(self, json_obj, connection, db):
"""
Callback called each time a knx_write_long packet is received.
Updates room_device_option values in the database.
"""
daemons = self.sql.get_daemons(db);
slave_name = self.get_slave_name(json_obj, daemons);
if slave_name is None:
connection.close();
return None;
dev = {}
dev["addr_dst"] = json_obj['data']['addr']
slave_name = slave_name.split('.')[0];
self.knx_manager.send_knx_write_long_to_slave(json_obj, dev, slave_name);
connection.close();
return None;
def knx_read(self, json_obj, connection, db):
"""
Callback called each time a knx_read packet is received.
"""