Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'MediaPlayer' object has no attribute '8' #67

Closed
RonnyAL opened this issue Oct 25, 2024 · 3 comments
Closed

AttributeError: 'MediaPlayer' object has no attribute '8' #67

RonnyAL opened this issue Oct 25, 2024 · 3 comments
Labels

Comments

@RonnyAL
Copy link

RonnyAL commented Oct 25, 2024

I see that another user is having similar issues, fixed by reinstalling. I am on a fresh install of Flow Launcher (never tried it before), and just now installed HA-Commander, so I thought it was worth bringing it up (again).

Trace Log

Traceback (most recent call last):
  File C:\Users\ronny\AppData\Roaming\FlowLauncher\Plugins\HA-Commander-5.2.0\lib\flox\launcher.py, line 41, in run
    results = request_method(*request_parameters) or self._results
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File C:\Users\ronny\AppData\Roaming\FlowLauncher\Plugins\HA-Commander-5.2.0\lib\flox\__init__.py, line 132, in _query
    self.query(query)
  File C:\Users\ronny\AppData\Roaming\FlowLauncher\Plugins\HA-Commander-5.2.0\plugin\main.py, line 53, in query
    states = self.client.states()
             ^^^^^^^^^^^^^^^^^^^^
  File C:\Users\ronny\AppData\Roaming\FlowLauncher\Plugins\HA-Commander-5.2.0\plugin\homeassistant.py, line 122, in states
    entities.append(self.create_entity(entity))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File C:\Users\ronny\AppData\Roaming\FlowLauncher\Plugins\HA-Commander-5.2.0\plugin\homeassistant.py, line 147, in create_entity
    return _cls(self, entity)
           ^^^^^^^^^^^^^^^^^^
  File C:\Users\ronny\AppData\Roaming\FlowLauncher\Plugins\HA-Commander-5.2.0\plugin\homeassistant.py, line 328, in __init__
    getattr(self, current_source).icon = radiobox-marked
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'MediaPlayer' object has no attribute '8'

@Gh0stExp10it
Copy link
Contributor

I stumbled across the same AttributeError. In my case, the attribute was TV/HDMI. I have a plugin for "Samsung Smart TV" running under my HA instance. When I switched off the media device, in this case the TV, the error no longer occurred. Could this be related to encoding or similar?

@Gh0stExp10it
Copy link
Contributor

I have analysed the problem a little more. It definitely has something to do with the plugin for controlling Samsung Smart TVs. Unfortunately, this third-party plugin keeps clearing the current playback status. Thus the source_list is not equal to the current_source. Here is an excerpt from the log, which I have expanded a little.

Source List from my Configuration

19:26:05 ERROR (homeassistant.py): Attributes: {'source_list': ['TV', 'Unbekannt (HDMI 1)', 'Unbekannt (HDMI 2)', 'Unbekannt (HDMI 3)', 'ARD-Mediathek', 'ARTE', 'Amazon Prime', 'Joyn', 'Netflix', 'Plex', 'Spotify', 'YouTube', 'ZDF-Mediathek', '01| ARD', '02| ZDF', '03| RTL', '04| Sat.1', '05| ProSieben', '06| RTL ZWEI', '07| Kabel Eins', '08| VOX', '09| SUPER RTL', '10| ProSieben MAXX', '11| DMAX'] [...]

Actual Source, which falls back to the app_id

19:26:05 ERROR (homeassistant.py): Attributes: {[...] 'media_title': 'Das Erste HD', 'app_id': 'TV/HDMI', 'source': 'TV/HDMI', [...]

The source list does not contain any attribute that refers to the actual source == TV/HDMI
The error therefore only affects the control of the radiobox-marked icon and text Currently selected Source. As a simple fix, I would suggest an additional check using the source_list list. I will create a PR, then the original author can check this again.

@Garulf
Copy link
Owner

Garulf commented Jan 9, 2025

Closing as this should be fixed with #68

@Garulf Garulf added the bug label Jan 9, 2025
@Garulf Garulf closed this as completed Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants