shaonianzhentan / ha_cloud_music

新版云音乐
MIT License
105 stars 96 forks source link

插件导致 Home Assistant 日志里持续报错 #55

Open EricCorleone opened 2 months ago

EricCorleone commented 2 months ago

大佬你好,首先插件是可以正常使用的,但是在日志里却持续不断地报错:

2024-07-03 15:01:21.189 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ha_cloud_music/media_player.py", line 71, in media_player_interval
    mp.interval(now)
  File "/config/custom_components/ha_cloud_music/media_player.py", line 111, in interval
    media_player = self.media_player
                   ^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ha_cloud_music/media_player.py", line 152, in media_player
    return self.hass.states.get(self.source_media_player)
           ^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'states'

麻烦帮忙看一下是怎么回事,谢谢

shaonianzhentan commented 2 months ago

大佬你好,首先插件是可以正常使用的,但是在日志里却持续不断地报错:

2024-07-03 15:01:21.189 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ha_cloud_music/media_player.py", line 71, in media_player_interval
    mp.interval(now)
  File "/config/custom_components/ha_cloud_music/media_player.py", line 111, in interval
    media_player = self.media_player
                   ^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ha_cloud_music/media_player.py", line 152, in media_player
    return self.hass.states.get(self.source_media_player)
           ^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'states'

麻烦帮忙看一下是怎么回事,谢谢

HA什么版本?

EricCorleone commented 2 months ago

当时应该是2024.7.0,不过后来解决了,貌似是因为我添加了两个智能音箱设备,然后又禁用了其中一个导致的,我后来把禁用的那个在设备筛选那里去掉了就好了。