本文整理汇总了Python中entities.Entity.last_checkin方法的典型用法代码示例。如果您正苦于以下问题:Python Entity.last_checkin方法的具体用法?Python Entity.last_checkin怎么用?Python Entity.last_checkin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entities.Entity
的用法示例。
在下文中一共展示了Entity.last_checkin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_23_power
# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import last_checkin [as 别名]
def test_23_power(self):
tl = Entity('POWER-0', EntityType.find(100), 'Power plug')
tl.assigned_id = 1
tl.last_checkin = time.time() - 3600 # one hour before
tl.save()
self.printall()
print tl
示例2: test_20_light_create
# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import last_checkin [as 别名]
def test_20_light_create(self):
tl = Entity('LIGHT-1', EntityType.find(101), name='Sample light')
tl.assigned_id = 2
tl.state = STATE_ON
tl.last_checkin = time.time()
tl.save()
self.printall()
print tl
示例3: describe
# 需要导入模块: from entities import Entity [as 别名]
# 或者: from entities.Entity import last_checkin [as 别名]
def describe(self, address, unique_id, data):
''' Registers a device for the given physical address. '''
DeviceHandler.describe(self, address, unique_id, data)
etype_id = data[0]
etype = EntityType.find(etype_id)
if etype:
entity = Entity.find(unique_id)
if entity is None:
entity = Entity(unique_id, etype, 'Unknown device: ' + unique_id, last_checkin=time.time())
entity.save()
print 'Device registered:', entity
ClientModule.instance().send_state_change(entity)
else:
entity.last_checkin = time.time()
entity.save()
print 'Device found:', entity
ClientModule.instance().send_state_change(entity)
else:
print 'Entity type not found:', etype_id