def bump(self): import requests r = requests.get('http://{}/bump'.format(self.ip_address)) if r.status_code == 200: log_event(self.name + " bumped from admin interface.", "door", "Status: {}. Content: {}".format(r.status_code, r.content)) return True else: log_event(self.name + " bumped from admin interface failed.", "door", "Status: {}. Content: {}".format(r.status_code, r.content)) return False
def lock(self): import requests r = requests.get('http://{}/end'.format(self.ip_address)) if r.status_code == 200: log_event(self.name + " locked from admin interface.", "interlock", "Status: {}. Content: {}".format(r.status_code, r.content)) return True else: log_event(self.name + " lock request from admin interface failed.", "interlock", "Status: {}. Content: {}".format(r.status_code, r.content)) return False
def checkin(self): log_event(self.name + " checked in with server.", "door") self.last_seen = timezone.now() self.save()