Example #1
0
    def simulate_alarm(self, device, request):
        log.info('simulate_alarm', device=device, request=request)

        if device.id not in self.devices:
            log.error("Device does not exist", device_id=device.id)
            return OperationResp(code=OperationResp.OPERATION_FAILURE,
                                 additional_info="Device %s does not exist" %
                                 device.id)

        handler = self.devices[device.id]

        handler.simulate_alarm(request)

        return OperationResp(code=OperationResp.OPERATION_SUCCESS)
Example #2
0
 def simulate_alarm(self, device, alarm):
     handler = self.devices_handlers[device.id]
     handler.simulate_alarm(alarm)
     return OperationResp(code=OperationResp.OPERATION_SUCCESS)