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: 'ClientConnection' Samsung TV #131759

Closed
Anto79-ops opened this issue Nov 27, 2024 · 7 comments · Fixed by #131784
Closed

AttributeError: 'ClientConnection' Samsung TV #131759

Anto79-ops opened this issue Nov 27, 2024 · 7 comments · Fixed by #131784

Comments

@Anto79-ops
Copy link

The problem

Hello,

Updating to 2024.12.0b0 and my Samsung TV integration seems to broken with the following log thanks

Logger: homeassistant.components.samsungtv
Source: helpers/update_coordinator.py:379
integration: Samsung Smart TV (documentation, issues)
First occurred: 1:26:47 PM (8 occurrences)
Last logged: 1:32:48 PM

Unexpected error fetching samsungtv data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 379, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/samsungtv/coordinator.py", line 45, in _async_update_data
    self.is_on = await self.bridge.async_is_on()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/samsungtv/bridge.py", line 509, in async_is_on
    return await super().async_is_on()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/samsungtv/bridge.py", line 422, in async_is_on
    return remote.is_alive()
           ~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/samsungtvws/async_connection.py", line 177, in is_alive
    return self.connection is not None and not self.connection.closed
                                               ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ClientConnection' object has no attribute 'closed'. Did you mean: 'close'?

What version of Home Assistant Core has the issue?

2024.12.0b0

What was the last working version of Home Assistant Core?

2024.11.x

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Samsung TV

Link to integration documentation on our website

https://www.home-assistant.io/integrations/samsungtv/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

Hey there @chemelli74, @epenet, mind taking a look at this issue as it has been labeled with an integration (samsungtv) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of samsungtv can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign samsungtv Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


samsungtv documentation
samsungtv source
(message by IssueLinks)

@bdraco
Copy link
Member

bdraco commented Nov 27, 2024

@bdraco
Copy link
Member

bdraco commented Nov 27, 2024

    def is_alive(self) -> bool:
        return self._connection is not None and self._connection.protocol.close_code is None

That should fix it

@bdraco bdraco added this to the 2024.12.0 milestone Nov 27, 2024
@codyc1515
Copy link
Contributor

Also facing this:

Logger: homeassistant.components.samsungtv
Source: helpers/update_coordinator.py:379
integration: Samsung Smart TV (documentation, issues)
First occurred: 10:56:48 (14 occurrences)
Last logged: 11:06:56

Unexpected error fetching samsungtv data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 379, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/samsungtv/coordinator.py", line 45, in _async_update_data
    self.is_on = await self.bridge.async_is_on()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/samsungtv/bridge.py", line 509, in async_is_on
    return await super().async_is_on()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/samsungtv/bridge.py", line 422, in async_is_on
    return remote.is_alive()
           ~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/samsungtvws/async_connection.py", line 177, in is_alive
    return self.connection is not None and not self.connection.closed
                                               ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ClientConnection' object has no attribute 'closed'. Did you mean: 'close'?

@andreasbrett
Copy link
Contributor

    def is_alive(self) -> bool:
        return self._connection is not None and self._connection.protocol.close_code is None

That should fix it

This will not suffice. See the log in OP's post. It is used in async_connection.py as well. https://github.com/search?q=repo%3Axchwarze%2Fsamsung-tv-ws-api+.closed&type=code

@epenet
Copy link
Contributor

epenet commented Nov 28, 2024

Should be fixed with v2.7.1: #131784

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants