2022-05-25 18:39:15 +00:00
|
|
|
"""Models for Hardware."""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
from dataclasses import dataclass
|
|
|
|
from typing import Protocol
|
|
|
|
|
|
|
|
from homeassistant.core import HomeAssistant, callback
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class BoardInfo:
|
|
|
|
"""Board info type."""
|
|
|
|
|
|
|
|
hassio_board_id: str | None
|
|
|
|
manufacturer: str
|
|
|
|
model: str | None
|
|
|
|
revision: str | None
|
|
|
|
|
|
|
|
|
2022-08-18 19:52:12 +00:00
|
|
|
@dataclass(frozen=True)
|
|
|
|
class USBInfo:
|
|
|
|
"""USB info type."""
|
|
|
|
|
|
|
|
vid: str
|
|
|
|
pid: str
|
|
|
|
serial_number: str | None
|
|
|
|
manufacturer: str | None
|
|
|
|
description: str | None
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass(frozen=True)
|
2022-05-25 18:39:15 +00:00
|
|
|
class HardwareInfo:
|
|
|
|
"""Hardware info type."""
|
|
|
|
|
|
|
|
name: str | None
|
|
|
|
board: BoardInfo | None
|
2022-11-10 12:19:21 +00:00
|
|
|
config_entries: list[str] | None
|
2022-08-29 06:45:39 +00:00
|
|
|
dongle: USBInfo | None
|
2022-05-25 18:39:15 +00:00
|
|
|
url: str | None
|
|
|
|
|
|
|
|
|
|
|
|
class HardwareProtocol(Protocol):
|
|
|
|
"""Define the format of hardware platforms."""
|
|
|
|
|
|
|
|
@callback
|
2022-08-29 06:45:39 +00:00
|
|
|
def async_info(self, hass: HomeAssistant) -> list[HardwareInfo]:
|
2022-05-25 18:39:15 +00:00
|
|
|
"""Return info."""
|