『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 6221|回复: 2

[求助] 百度tts调用失败?求教各位了!多谢

[复制链接]

4

主题

103

帖子

1742

积分

金牌会员

Rank: 6Rank: 6

积分
1742
金钱
1639
HASS币
0
发表于 2020-3-24 20:47:54 | 显示全部楼层 |阅读模式
最近刚在试试homeassistant,想测试下百度的语音服务,已经成功安装播放器,本地可以播放音乐,但测试百度文字转语音时,提示:“ 调用服务 tts/baidu_say 失败     'access_token'”,无法成功播放声音。仔细核对了百度云上面的三个app_id   api_key secret_key 又重新复制了一遍,!系统是0.107.5
日志详细信息( ERROR )
Logger: homeassistant.components.websocket_api.http.connection.547729251088
Source: components/baidu/tts.py:124
Integration: websocket_api ([color=var(--primary-color)]documentation, [color=var(--primary-color)]issues)
First occurred: 下午8:31:08 (2 occurrences)
Last logged: 下午8:31:21
'access_token'Traceback (most recent call last):  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service    connection.context(msg),  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1234, in async_call    await asyncio.shield(self._execute_service(handler, service_call))  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1257, in _execute_service    await handler.func(service_call)  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/tts/__init__.py", line 159, in async_say_handle    p_type, message, cache=cache, language=language, options=options  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/tts/__init__.py", line 339, in async_get_url    engine, key, message, use_cache, language, options  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/tts/__init__.py", line 350, in async_get_tts_audio    extension, data = await provider.async_get_tts_audio(message, language, options)  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/tts/__init__.py", line 510, in async_get_tts_audio    ft.partial(self.get_tts_audio, message, language, options=options)  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run    result = self.fn(*self.args, **self.kwargs)  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/baidu/tts.py", line 124, in get_tts_audio    result = aip_speech.synthesis(message, language, 1, speech_data)  File "/usr/local/lib/python3.7/site-packages/aip/speech.py", line 92, in synthesis    result = self._request(self.__ttsUrl, data)  File "/usr/local/lib/python3.7/site-packages/aip/base.py", line 92, in _request    params = self._getParams(authObj)  File "/usr/local/lib/python3.7/site-packages/aip/base.py", line 192, in _getParams    params['access_token'] = authObj['access_token']KeyError: 'access_token'

回复

使用道具 举报

4

主题

342

帖子

2694

积分

金牌会员

Rank: 6Rank: 6

积分
2694
金钱
2352
HASS币
0
发表于 2020-5-8 09:59:43 | 显示全部楼层
相同的问题,楼主解决了吗
回复

使用道具 举报

0

主题

129

帖子

800

积分

高级会员

Rank: 4

积分
800
金钱
671
HASS币
0
发表于 2020-5-9 09:18:35 | 显示全部楼层
configuration.yaml里base_url要设置正确。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-24 22:38 , Processed in 0.474169 second(s), 25 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表