Bump hass-nabucasa to 0.65.0 (#91565)
This commit is contained in:
parent
599cc4a5c6
commit
f3897d8dae
7 changed files with 20 additions and 39 deletions
|
@ -8,5 +8,5 @@
|
||||||
"integration_type": "system",
|
"integration_type": "system",
|
||||||
"iot_class": "cloud_push",
|
"iot_class": "cloud_push",
|
||||||
"loggers": ["hass_nabucasa"],
|
"loggers": ["hass_nabucasa"],
|
||||||
"requirements": ["hass-nabucasa==0.64.1"]
|
"requirements": ["hass-nabucasa==0.65.0"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ from collections.abc import AsyncIterable
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from hass_nabucasa import Cloud
|
from hass_nabucasa import Cloud
|
||||||
from hass_nabucasa.voice import VoiceError
|
from hass_nabucasa.voice import STT_LANGUAGES, VoiceError
|
||||||
|
|
||||||
from homeassistant.components.stt import (
|
from homeassistant.components.stt import (
|
||||||
AudioBitRates,
|
AudioBitRates,
|
||||||
|
@ -23,29 +23,6 @@ from .const import DOMAIN
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
SUPPORT_LANGUAGES = [
|
|
||||||
"da-DK",
|
|
||||||
"de-DE",
|
|
||||||
"en-AU",
|
|
||||||
"en-CA",
|
|
||||||
"en-GB",
|
|
||||||
"en-US",
|
|
||||||
"es-ES",
|
|
||||||
"fi-FI",
|
|
||||||
"fr-CA",
|
|
||||||
"fr-FR",
|
|
||||||
"it-IT",
|
|
||||||
"ja-JP",
|
|
||||||
"nl-NL",
|
|
||||||
"pl-PL",
|
|
||||||
"pt-PT",
|
|
||||||
"ru-RU",
|
|
||||||
"sv-SE",
|
|
||||||
"th-TH",
|
|
||||||
"zh-CN",
|
|
||||||
"zh-HK",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
async def async_get_engine(hass, config, discovery_info=None):
|
async def async_get_engine(hass, config, discovery_info=None):
|
||||||
"""Set up Cloud speech component."""
|
"""Set up Cloud speech component."""
|
||||||
|
@ -64,7 +41,7 @@ class CloudProvider(Provider):
|
||||||
@property
|
@property
|
||||||
def supported_languages(self) -> list[str]:
|
def supported_languages(self) -> list[str]:
|
||||||
"""Return a list of supported languages."""
|
"""Return a list of supported languages."""
|
||||||
return SUPPORT_LANGUAGES
|
return STT_LANGUAGES
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_formats(self) -> list[AudioFormats]:
|
def supported_formats(self) -> list[AudioFormats]:
|
||||||
|
@ -95,7 +72,7 @@ class CloudProvider(Provider):
|
||||||
self, metadata: SpeechMetadata, stream: AsyncIterable[bytes]
|
self, metadata: SpeechMetadata, stream: AsyncIterable[bytes]
|
||||||
) -> SpeechResult:
|
) -> SpeechResult:
|
||||||
"""Process an audio stream to STT service."""
|
"""Process an audio stream to STT service."""
|
||||||
content = (
|
content_type = (
|
||||||
f"audio/{metadata.format!s}; codecs=audio/{metadata.codec!s};"
|
f"audio/{metadata.format!s}; codecs=audio/{metadata.codec!s};"
|
||||||
" samplerate=16000"
|
" samplerate=16000"
|
||||||
)
|
)
|
||||||
|
@ -103,7 +80,9 @@ class CloudProvider(Provider):
|
||||||
# Process STT
|
# Process STT
|
||||||
try:
|
try:
|
||||||
result = await self.cloud.voice.process_stt(
|
result = await self.cloud.voice.process_stt(
|
||||||
stream, content, metadata.language
|
stream=stream,
|
||||||
|
content_type=content_type,
|
||||||
|
language=metadata.language,
|
||||||
)
|
)
|
||||||
except VoiceError as err:
|
except VoiceError as err:
|
||||||
_LOGGER.debug("Voice error: %s", err)
|
_LOGGER.debug("Voice error: %s", err)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Support for the cloud for text to speech service."""
|
"""Support for the cloud for text to speech service."""
|
||||||
|
|
||||||
from hass_nabucasa import Cloud
|
from hass_nabucasa import Cloud
|
||||||
from hass_nabucasa.voice import MAP_VOICE, AudioOutput, VoiceError
|
from hass_nabucasa.voice import MAP_VOICE, TTS_VOICES, AudioOutput, VoiceError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.tts import (
|
from homeassistant.components.tts import (
|
||||||
|
@ -14,8 +14,9 @@ from homeassistant.components.tts import (
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
ATTR_GENDER = "gender"
|
ATTR_GENDER = "gender"
|
||||||
|
ATTR_VOICE = "voice"
|
||||||
|
|
||||||
SUPPORT_LANGUAGES = list({key[0] for key in MAP_VOICE})
|
SUPPORT_LANGUAGES = list(TTS_VOICES)
|
||||||
|
|
||||||
|
|
||||||
def validate_lang(value):
|
def validate_lang(value):
|
||||||
|
@ -92,7 +93,7 @@ class CloudProvider(Provider):
|
||||||
@property
|
@property
|
||||||
def supported_options(self):
|
def supported_options(self):
|
||||||
"""Return list of supported options like voice, emotion."""
|
"""Return list of supported options like voice, emotion."""
|
||||||
return [ATTR_GENDER, ATTR_AUDIO_OUTPUT]
|
return [ATTR_GENDER, ATTR_VOICE, ATTR_AUDIO_OUTPUT]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_options(self):
|
def default_options(self):
|
||||||
|
@ -107,9 +108,10 @@ class CloudProvider(Provider):
|
||||||
# Process TTS
|
# Process TTS
|
||||||
try:
|
try:
|
||||||
data = await self.cloud.voice.process_tts(
|
data = await self.cloud.voice.process_tts(
|
||||||
message,
|
text=message,
|
||||||
language,
|
language=language,
|
||||||
gender=options[ATTR_GENDER],
|
gender=options.get(ATTR_GENDER),
|
||||||
|
voice=options.get(ATTR_VOICE),
|
||||||
output=options[ATTR_AUDIO_OUTPUT],
|
output=options[ATTR_AUDIO_OUTPUT],
|
||||||
)
|
)
|
||||||
except VoiceError:
|
except VoiceError:
|
||||||
|
|
|
@ -22,7 +22,7 @@ cryptography==40.0.2
|
||||||
dbus-fast==1.84.2
|
dbus-fast==1.84.2
|
||||||
fnv-hash-fast==0.3.1
|
fnv-hash-fast==0.3.1
|
||||||
ha-av==10.0.0
|
ha-av==10.0.0
|
||||||
hass-nabucasa==0.64.1
|
hass-nabucasa==0.65.0
|
||||||
hassil==1.0.6
|
hassil==1.0.6
|
||||||
home-assistant-bluetooth==1.9.3
|
home-assistant-bluetooth==1.9.3
|
||||||
home-assistant-frontend==20230411.1
|
home-assistant-frontend==20230411.1
|
||||||
|
|
|
@ -869,7 +869,7 @@ ha-philipsjs==3.0.0
|
||||||
habitipy==0.2.0
|
habitipy==0.2.0
|
||||||
|
|
||||||
# homeassistant.components.cloud
|
# homeassistant.components.cloud
|
||||||
hass-nabucasa==0.64.1
|
hass-nabucasa==0.65.0
|
||||||
|
|
||||||
# homeassistant.components.splunk
|
# homeassistant.components.splunk
|
||||||
hass_splunk==0.1.1
|
hass_splunk==0.1.1
|
||||||
|
|
|
@ -670,7 +670,7 @@ ha-philipsjs==3.0.0
|
||||||
habitipy==0.2.0
|
habitipy==0.2.0
|
||||||
|
|
||||||
# homeassistant.components.cloud
|
# homeassistant.components.cloud
|
||||||
hass-nabucasa==0.64.1
|
hass-nabucasa==0.65.0
|
||||||
|
|
||||||
# homeassistant.components.conversation
|
# homeassistant.components.conversation
|
||||||
hassil==1.0.6
|
hassil==1.0.6
|
||||||
|
|
|
@ -76,7 +76,7 @@ async def test_provider_properties(cloud_with_prefs) -> None:
|
||||||
provider = await tts.async_get_engine(
|
provider = await tts.async_get_engine(
|
||||||
Mock(data={const.DOMAIN: cloud_with_prefs}), None, {}
|
Mock(data={const.DOMAIN: cloud_with_prefs}), None, {}
|
||||||
)
|
)
|
||||||
assert provider.supported_options == ["gender", "audio_output"]
|
assert provider.supported_options == ["gender", "voice", "audio_output"]
|
||||||
assert "nl-NL" in provider.supported_languages
|
assert "nl-NL" in provider.supported_languages
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,5 +85,5 @@ async def test_get_tts_audio(cloud_with_prefs) -> None:
|
||||||
provider = await tts.async_get_engine(
|
provider = await tts.async_get_engine(
|
||||||
Mock(data={const.DOMAIN: cloud_with_prefs}), None, {}
|
Mock(data={const.DOMAIN: cloud_with_prefs}), None, {}
|
||||||
)
|
)
|
||||||
assert provider.supported_options == ["gender", "audio_output"]
|
assert provider.supported_options == ["gender", "voice", "audio_output"]
|
||||||
assert "nl-NL" in provider.supported_languages
|
assert "nl-NL" in provider.supported_languages
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue