# Events

> **Deprecation Notice**
> This page describes features that have been removed or replaced in Luxonis Hub. Functionality may be limited and only available
to Hub Original customers. Please refer to the up-to-date guides to provision devices, manage fleets, and deploy applications.

## Out of the box Events

The robothubsupport three basic use cases

 * Send one image
 * Send one image with additional images zipped and send as an attachment
 * Send a video

> Should your use case require a new type of
> `Event`
> , let us know on our
> [forum](https://discuss.luxonis.com/t/robothub)

### events

Kind: Module

#### logger

Kind: Variable

#### send_image_event(image: Union [ np.ndarray , bytes ], title: str, device_id: str = None, metadata: Optional [ dict ] = None,
tags: List [ str ] = None, mjpeg_quality = 98, encode = False) -> Optional[str]: Optional[str]

Kind: Function

Send a single image frame event to RH.

:param image: The image to send.
:param title: The title of the event.
:param device_id: The device ID to associate with the event.
:param metadata: A dictionary of metadata to associate with the event.
:param tags: A list of tags to associate with the event.
:param mjpeg_quality: The JPEG quality to use when encoding.
:param encode: Whether to encode the image as a JPEG before sending.
:return: The event ID. None if the event failed to send.

#### send_frame_event_with_zipped_images(cv_frame: np.ndarray, files: list, title: str, device_id: str, tags: List [ str ] = None,
metadata: Optional [ dict ] = None, encode: bool = False, mjpeg_quality = 98) -> Optional[str]: Optional[str]

Kind: Function

Send a collection of images as a single event to RH.

:param cv_frame: The main image frame to send.
:param files: A list of images to zip and send.
:param title: The title of the event.
:param device_id: The device ID to associate with the event.
:param tags: A list of tags to associate with the event.
:param metadata: A dictionary of metadata to associate with the event.
:param encode: Whether to encode the images as JPEGs before sending.
:param mjpeg_quality: The JPEG quality to use when encoding.
:return: The event ID. None if the event failed to send.

#### send_video_event(video: bytes | str, title: str, metadata: Optional [ dict ] = None) -> Optional[str]: Optional[str]

Kind: Function

Send a video event to RH. The video can be a path to a video file or a bytes object.

:param video: Path to a video file or a bytes object.
:param title: Title of the video event.
:param metadata: Overlay metadata to be displayed on the video.
:return: The event ID. None if the event failed to send.

## Custom Events

You can use the low level API to build and send a custom Event. Example:

```python
import robothub as rh
event: FutureEvent = rh.EVENTS.prepare()
event.set_tags(["video", "interesting situation"])
event.add_video(video_as_bytes, filename=video_file_name)
event.set_title(f"Video Event")
event.add_file(support_file.getvalue(), name='metadata.zip', filename='metadata.zip')
rh.EVENTS.upload(event)
```

where support_file.getvalue() returns bytes representation of a zipfile.ZipFile object

### robothub.robothub_core_wrapper.events.FutureEvent

Kind: Class

Object describing an Event

#### id

Kind: Instance Variable

ID of the Event

#### folder_path

Kind: Instance Variable

Path to the folder of the Event in the App's container. Added frames, files & videos are stored in this folder.

#### __init__(self, _id: str, folder_path: Union [ str , Path ])

Kind: Method

#### title

Kind: Instance Variable

Title of the Event in the Cloud. Set to "Event" + UUID by default.

#### add_video(self, _bytes: bytes | bytearray, name: str | None = None, metadata: dict | None = None, filename: str | None =
None, camera_serial: str | None = None)

Kind: Method

Adds a video to the Event.

@param _bytes: Bytes of the encoded video. Must be H264 format.
@type _bytes: bytes | bytearray
@param name: Optional - Name of the video
@type name: str | NoneType
@param metadata: Optional - Metadata to be overlayed over the video. List length must be equal to number of frames in the video.
@type metadata: list
@param filename: Optional - can define name of the video file on Host.
@type filename: str | NoneType
@param camera_serial: Optional - Serial number (MxID) of camera that took the video
@type camera_serial: str

#### add_frame(self, _bytes, camera_serial: str | None = None, name: str | None = None, metadata: dict | None = None, filename:
str | None = None)

Kind: Method

Adds a frame to the Event.

@param _bytes: Bytes of the encoded frame
@type _bytes: bytes | bytearray
@param camera_serial: Optional - Serial number (MxID) of camera that took the frame
@type camera_serial: str
@param name: Optional - Name of the frame
@type name: str | NoneType
@param metadata: Optional - Metadata to be overlayed over the frame
@type metadata: list
@param filename: Optional - can define name of the frame file on Host.
@type filename: str | NoneType

#### add_file(self, _bytes, name: str | None = None, filename: str | None = None)

Kind: Method

Adds a file to the Event.

@param _bytes: Bytes of the file.
@type _bytes: bytes | bytearray
@param name: Optional - Name of the file in the cloud
@type name: str | NoneType
@param filename: Optional - can define name of the file saved on Host.
@type filename: str | NoneType

#### add_existing_file(self, filename: Path | str, copy: bool = True, name: str | None = None)

Kind: Method

Adds an existing file to the Event.

@param filename: Path to the file to be added.
@type filename: Path | str
@param copy: If True, the file will be copied to the Event folder. If False, the file will be moved to the Event folder.
@type copy: bool
@param name: Optional - Name of the file in the cloud
@type name: str | NoneType

#### set_title(self, title)

Kind: Method

Sets the title of the Event.

@param title: Title for the Event
@type title: str | NoneType

#### set_metadata(self, metadata: dict)

Kind: Method

Sets the metadata of the Event.

@param metadata: Dictionary containing the metadata
@type metadata: dict

#### add_tag(self, tag: str)

Kind: Method

Adds a tag to the Event.

Cannot add more than 10 tags to one Event.

@param tag: The tag string
@type tag: str

#### add_tags(self, tags: List [ str ])

Kind: Method

Adds multiple tags to the Event.

Cannot add more than 10 tags to one Event.

@param tags: A list of tags
@type tags: List[str]

#### set_tags(self, tags: List [ str ])

Kind: Method

Sets the tags of the Event.

An Event cannot have more than 10 tags.

@param tags: A list of tags
@type tags: List[str]

#### keep_after_upload

Kind: Property

Decides whether Event should be kept after upload, C{False} by default.

Example usage:

>>> self.keep_after_upload
True

return: bool

#### keep_after_upload.setter(self, value: bool)

Kind: Method

Sets the keep after upload property.

Example usage:

>>> self.keep_after_upload = True

#### no_upload_by_default

Kind: Property

If set to True, Event will not be uploaded. C{False} by default.

Example usage:

>>> self.no_upload_by_default
True

return: bool

#### no_upload_by_default.setter(self, value: bool)

Kind: Method

Sets the keep after upload property.

Example usage:

>>> self.keep_after_upload = True

#### keep_when_space_low

Kind: Property

Decides whether Event should be kept when storage space is low, C{False} by default.

Example usage:

>>> self.keep_after_upload
True

return: bool

#### keep_when_space_low.setter(self, value: bool)

Kind: Method

Sets the keep when space low property.

Example usage:

>>> self.keep_when_space_low = True
