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

 找回密码
 立即注册
楼主: jiluxinqing

[插件集成] 云音乐4.0【支持播放本地音乐,断网也能听音乐哦】

  [复制链接]

0

主题

47

帖子

222

积分

中级会员

Rank: 3Rank: 3

积分
222
金钱
175
HASS币
0
发表于 2020-8-7 13:10:05 | 显示全部楼层
回复

使用道具 举报

46

主题

641

帖子

4411

积分

元老级技术达人

积分
4411
金钱
3740
HASS币
120
发表于 2020-9-8 21:20:13 | 显示全部楼层
本帖最后由 evantalk 于 2020-9-8 21:21 编辑

发现一个问题,需要修改media_player.py第65行为:api_config = ApiConfig(hass.config.path("custom_components/ha_cloud_music"))
2020-09-08 20:47:16 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up ha_cloud_music platform for media_player
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 184, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/ha_cloud_music/media_player.py", line 65, in setup_platform
    api_config = ApiConfig(hass.config.path(".shaonianzhentan/ha_cloud_music"))
  File "/config/custom_components/ha_cloud_music/api_config.py", line 17, in __init__
    os.mkdir(_dir)
FileNotFoundError: [Errno 2] No such file or directory: '/config/.shaonianzhentan/ha_cloud_music'


另外我有mpd播放器在用的
  - platform: mpd
    host: 192.168.2.51
    name: mopidy

为啥云音乐配了识别不了
  - platform: ha_cloud_music
    api_url: http://192.168.2.51:3000
    mpd_host: 192.168.2.51

回复

使用道具 举报

38

主题

402

帖子

4330

积分

元老级技术达人

积分
4330
金钱
3863
HASS币
350

教程狂人

 楼主| 发表于 2020-9-9 10:33:27 | 显示全部楼层
evantalk 发表于 2020-9-8 21:20
发现一个问题,需要修改media_player.py第65行为:api_config = ApiConfig(hass.config.path(" ...

这个错误是因为配置目录改了导致的,我已经修复了这个错误

识别不了具体表现在哪里?具体可以看日志,连接到MPD会有日志显示的
http://github.com/shaonianzhentan
回复

使用道具 举报

46

主题

641

帖子

4411

积分

元老级技术达人

积分
4411
金钱
3740
HASS币
120
发表于 2020-9-9 21:59:43 | 显示全部楼层
本帖最后由 evantalk 于 2020-9-9 22:01 编辑

捕获.JPG 这是现场

mpd日志正常:2020-09-09 21:47:04 INFO (SyncWorker_6) [mpd.base] Calling MPD connect('192.168.2.51', 6600, timeout=None)
倒是有数据库错误
2020-09-09 21:48:34 ERROR (Recorder) [homeassistant.components.recorder] Error adding event: (MySQLdb._exceptions.DataError) (1406, "Data too long for column 'event_data' at row 1")
[SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id, context_parent_id) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)]
[parameters: ('call_service', '{"domain": "media_player", "service": "play_media", "service_data": {"entity_id": "media_player.yun_yin_le", "media_content_id": "{\"index\":0,\"l ... (184273 characters truncated) ... \\\":373,\\\\\"url\\\\\":\\\\\"https://music.163.com/song/media/outer/url?id=18309240.mp3\\\\\"}]\"}", "media_content_type": "music_playlist"}}', 'LOCAL', datetime.datetime(2020, 9, 9, 13, 48, 34, 491258, tzinfo=<UTC>), datetime.datetime(2020, 9, 9, 13, 48, 34, 506228, tzinfo=<UTC>), '27860063f2a311eaa395835c6b1abf71', '6fdcbe90cbc44ab588dac7e0f79c2351', None)]
(Background on this error at: http://sqlalche.me/e/13/9h9h)
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1277, in _execute_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 593, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/lib/python3.8/site-packages/MySQLdb/connections.py", line 259, in query
    _mysql.connection.query(self, query)
MySQLdb._exceptions.DataError: (1406, "Data too long for column 'event_data' at row 1")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 377, in run
    self.event_session.flush()
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2523, in flush
    self._flush(objects)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2664, in _flush
    transaction.rollback(_capture_exception=True)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
    compat.raise_(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 178, in raise_
    raise exception
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2624, in _flush
    flush_context.execute()
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute
    rec.execute(self)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 586, in execute
    persistence.save_obj(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", line 239, in save_obj
    _emit_insert_statements(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", line 1135, in _emit_insert_statements
    result = cached_connections[connection].execute(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1014, in execute
    return meth(self, multiparams, params)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1127, in _execute_clauseelement
    ret = self._execute_context(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1317, in _execute_context
    self._handle_dbapi_exception(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1511, in _handle_dbapi_exception
    util.raise_(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 178, in raise_
    raise exception
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1277, in _execute_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 593, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/lib/python3.8/site-packages/MySQLdb/connections.py", line 259, in query
    _mysql.connection.query(self, query)
sqlalchemy.exc.DataError: (MySQLdb._exceptions.DataError) (1406, "Data too long for column 'event_data' at row 1")



回复

使用道具 举报

0

主题

27

帖子

210

积分

中级会员

Rank: 3Rank: 3

积分
210
金钱
183
HASS币
0
发表于 2020-9-10 03:09:33 | 显示全部楼层
谢谢分享
需要测试一下
回复

使用道具 举报

0

主题

22

帖子

60

积分

注册会员

Rank: 2

积分
60
金钱
38
HASS币
0
发表于 2020-9-10 10:36:07 | 显示全部楼层
加一个到ha里面看看效果。谢谢了。
回复

使用道具 举报

38

主题

402

帖子

4330

积分

元老级技术达人

积分
4330
金钱
3863
HASS币
350

教程狂人

 楼主| 发表于 2020-9-10 10:36:10 | 显示全部楼层
evantalk 发表于 2020-9-9 21:59
这是现场

mpd日志正常:2020-09-09 21:47:04 INFO (SyncWorker_6) [mpd.base] Calling MPD connect('192.1 ...

你最好阻止一下这个播放器记录到数据库,属性太多占用存储
http://github.com/shaonianzhentan
回复

使用道具 举报

24

主题

608

帖子

3486

积分

元老级技术达人

积分
3486
金钱
2873
HASS币
0

卓越贡献

发表于 2020-9-11 08:22:04 | 显示全部楼层
感谢分享!!!家里只能用DLNA播放器。现在是没办法测试了。。
但是3.3好像最近也不能用了。。无法自动下一曲
回复

使用道具 举报

22

主题

424

帖子

2188

积分

金牌会员

Rank: 6Rank: 6

积分
2188
金钱
1764
HASS币
10
发表于 2020-9-25 07:54:34 | 显示全部楼层
升级到115.2,无法使用了
回复

使用道具 举报

2

主题

33

帖子

322

积分

中级会员

挖煤的猫

Rank: 3Rank: 3

积分
322
金钱
289
HASS币
0
发表于 2020-9-25 16:05:56 | 显示全部楼层
不错~~~~~~~~~~~~~~~
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-22 02:47 , Processed in 0.062462 second(s), 33 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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