Home Assistant Unofficial Reference 2024.12.1
const.py
Go to the documentation of this file.
1 """STT constante."""
2 
3 from __future__ import annotations
4 
5 from enum import Enum
6 from typing import TYPE_CHECKING
7 
8 from homeassistant.util.hass_dict import HassKey
9 
10 if TYPE_CHECKING:
11  from homeassistant.helpers.entity_component import EntityComponent
12 
13  from . import SpeechToTextEntity
14  from .legacy import Provider
15 
16 DOMAIN = "stt"
17 DATA_COMPONENT: HassKey[EntityComponent[SpeechToTextEntity]] = HassKey(DOMAIN)
18 DATA_PROVIDERS: HassKey[dict[str, Provider]] = HassKey(f"{DOMAIN}_providers")
19 
20 
21 class AudioCodecs(str, Enum):
22  """Supported Audio codecs."""
23 
24  PCM = "pcm"
25  OPUS = "opus"
26 
27 
28 class AudioFormats(str, Enum):
29  """Supported Audio formats."""
30 
31  WAV = "wav"
32  OGG = "ogg"
33 
34 
35 class AudioBitRates(int, Enum):
36  """Supported Audio bit rates."""
37 
38  BITRATE_8 = 8
39  BITRATE_16 = 16
40  BITRATE_24 = 24
41  BITRATE_32 = 32
42 
43 
44 class AudioSampleRates(int, Enum):
45  """Supported Audio sample rates."""
46 
47  SAMPLERATE_8000 = 8000
48  SAMPLERATE_11000 = 11000
49  SAMPLERATE_16000 = 16000
50  SAMPLERATE_18900 = 18900
51  SAMPLERATE_22000 = 22000
52  SAMPLERATE_32000 = 32000
53  SAMPLERATE_37800 = 37800
54  SAMPLERATE_44100 = 44100
55  SAMPLERATE_48000 = 48000
56 
57 
58 class AudioChannels(int, Enum):
59  """Supported Audio channel."""
60 
61  CHANNEL_MONO = 1
62  CHANNEL_STEREO = 2
63 
64 
65 class SpeechResultState(str, Enum):
66  """Result state of speech."""
67 
68  SUCCESS = "success"
69  ERROR = "error"