|
|
|
@ -37,6 +37,10 @@ class AmcrestAPI(object):
|
|
|
|
# return just the config of each device, not the camera object
|
|
|
|
# return just the config of each device, not the camera object
|
|
|
|
return {d: self.devices[d]['config'] for d in self.devices.keys()}
|
|
|
|
return {d: self.devices[d]['config'] for d in self.devices.keys()}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def reset_connection(self, device_id):
|
|
|
|
|
|
|
|
device = self.devices[device_id]
|
|
|
|
|
|
|
|
device['camera'] = get_camera(device['config']['host'])
|
|
|
|
|
|
|
|
|
|
|
|
def get_camera(self, host):
|
|
|
|
def get_camera(self, host):
|
|
|
|
return AmcrestCamera(
|
|
|
|
return AmcrestCamera(
|
|
|
|
host,
|
|
|
|
host,
|
|
|
|
@ -120,6 +124,7 @@ class AmcrestAPI(object):
|
|
|
|
await self.process_device_event(device_id, code, payload)
|
|
|
|
await self.process_device_event(device_id, code, payload)
|
|
|
|
except Exception as err:
|
|
|
|
except Exception as err:
|
|
|
|
self.logger.error(f'Failed to get events from device ({device_id}): {err}')
|
|
|
|
self.logger.error(f'Failed to get events from device ({device_id}): {err}')
|
|
|
|
|
|
|
|
self.reset_connection(device_id)
|
|
|
|
|
|
|
|
|
|
|
|
async def process_device_event(self, device_id, code, payload):
|
|
|
|
async def process_device_event(self, device_id, code, payload):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
|