2020-05-06 16:29:59 +00:00
|
|
|
"""ONVIF models."""
|
2021-03-18 12:21:46 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2020-05-06 16:29:59 +00:00
|
|
|
from dataclasses import dataclass
|
2021-03-18 12:21:46 +00:00
|
|
|
from typing import Any
|
2020-05-06 16:29:59 +00:00
|
|
|
|
2023-02-09 19:15:37 +00:00
|
|
|
from homeassistant.const import EntityCategory
|
2022-04-21 18:38:20 +00:00
|
|
|
|
2020-05-06 16:29:59 +00:00
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class DeviceInfo:
|
|
|
|
"""Represent device information."""
|
|
|
|
|
2022-06-20 10:07:33 +00:00
|
|
|
manufacturer: str | None = None
|
|
|
|
model: str | None = None
|
|
|
|
fw_version: str | None = None
|
|
|
|
serial_number: str | None = None
|
|
|
|
mac: str | None = None
|
2020-05-06 16:29:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class Resolution:
|
|
|
|
"""Represent video resolution."""
|
|
|
|
|
|
|
|
width: int
|
|
|
|
height: int
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class Video:
|
|
|
|
"""Represent video encoding settings."""
|
|
|
|
|
|
|
|
encoding: str
|
|
|
|
resolution: Resolution
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class PTZ:
|
|
|
|
"""Represents PTZ configuration on a profile."""
|
|
|
|
|
|
|
|
continuous: bool
|
|
|
|
relative: bool
|
|
|
|
absolute: bool
|
2022-06-20 10:07:33 +00:00
|
|
|
presets: list[str] | None = None
|
2020-05-06 16:29:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class Profile:
|
|
|
|
"""Represent a ONVIF Profile."""
|
|
|
|
|
|
|
|
index: int
|
|
|
|
token: str
|
|
|
|
name: str
|
|
|
|
video: Video
|
2022-06-20 10:07:33 +00:00
|
|
|
ptz: PTZ | None = None
|
2023-01-30 11:08:07 +00:00
|
|
|
video_source_token: str | None = None
|
2020-05-06 16:29:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class Capabilities:
|
|
|
|
"""Represents Service capabilities."""
|
|
|
|
|
|
|
|
snapshot: bool = False
|
2020-05-11 17:12:12 +00:00
|
|
|
events: bool = False
|
2020-05-06 16:29:59 +00:00
|
|
|
ptz: bool = False
|
2023-01-30 11:08:07 +00:00
|
|
|
imaging: bool = False
|
2020-05-11 17:12:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class Event:
|
|
|
|
"""Represents a ONVIF event."""
|
|
|
|
|
|
|
|
uid: str
|
|
|
|
name: str
|
|
|
|
platform: str
|
2022-06-20 10:07:33 +00:00
|
|
|
device_class: str | None = None
|
|
|
|
unit_of_measurement: str | None = None
|
2020-05-11 17:12:12 +00:00
|
|
|
value: Any = None
|
2022-04-21 18:38:20 +00:00
|
|
|
entity_category: EntityCategory | None = None
|
2020-05-11 17:12:12 +00:00
|
|
|
entity_enabled: bool = True
|