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

Integration working bad last few days #178

Closed
matata86 opened this issue Aug 30, 2022 · 34 comments
Closed

Integration working bad last few days #178

matata86 opened this issue Aug 30, 2022 · 34 comments

Comments

@matata86
Copy link

Describe the bug
Integration not working. TV is still off.

Expected behavior
If I reload the integration. It works for a while and then it doesn't work again.

Environment details:

  • Environment (HASSIO, Raspbian, etc): RPi4
  • Home Assistant version installed: 2022.8.5
  • Component version installed: 0.7.5
  • Last know working version: I dont know
  • TV model: Samsung TV Q6

Output of HA logs
2022-08-29 09:26:19.303 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration samsungtv_smart which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-08-29 09:27:15.676 WARNING (MainThread) [homeassistant.components.media_player] Setup of media_player platform samsungtv_smart is taking over 10 seconds.
2022-08-29 09:30:39.416 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 09:30:39.523 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 09:30:39.531 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 09:55:39.631 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 09:55:39.760 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 09:55:39.798 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 10:20:39.737 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 10:20:39.828 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 10:20:39.850 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 10:45:39.925 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 10:45:40.019 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 10:45:40.023 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 11:10:40.010 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 11:10:40.108 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 11:10:40.113 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 11:35:40.322 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 11:35:40.424 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 11:35:40.453 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 12:00:40.466 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 12:00:40.550 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 12:00:40.562 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 12:25:40.628 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 12:25:40.724 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 12:25:40.731 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 12:50:40.769 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 12:50:40.872 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 12:50:40.878 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 13:15:41.087 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 13:15:41.186 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 13:15:41.194 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 13:40:41.254 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 13:40:41.347 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 13:40:41.356 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 14:05:41.381 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 14:05:41.475 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 14:05:41.480 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 14:30:41.451 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 14:30:41.542 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 14:30:41.580 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 14:55:42.311 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 14:55:42.401 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 14:55:42.406 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 15:20:42.512 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 15:20:42.620 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 15:20:42.637 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 15:45:42.484 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 15:45:42.576 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 15:45:42.584 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 16:10:42.691 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 16:10:42.791 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 16:10:42.800 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 16:35:42.850 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 16:35:42.945 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 16:35:42.965 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 17:00:43.002 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 17:00:43.132 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 17:00:43.133 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 17:25:43.142 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 17:25:43.237 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 17:25:43.247 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 17:50:43.344 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 17:50:43.455 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 17:50:43.467 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 18:09:44.737 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 18:09:44.827 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 18:09:44.839 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 18:35:28.525 ERROR (SamsungRemote) [root] Uncaught thread exception
File "/config/custom_components/samsungtv_smart/api/samsungws.py", line 376, in _client_remote_thread
2022-08-29 22:06:37.281 WARNING (SamsungRemote) [websocket] websocket connected
2022-08-29 22:06:37.453 WARNING (SamsungArt) [websocket] websocket connected
2022-08-29 22:06:37.474 WARNING (SamsungControl) [websocket] websocket connected
2022-08-29 22:43:53.876 ERROR (SamsungRemote) [root] Uncaught thread exception
File "/config/custom_components/samsungtv_smart/api/samsungws.py", line 376, in _client_remote_thread
2022-08-30 08:52:40.120 WARNING (SyncWorker_8) [custom_components.samsungtv_smart.api.samsungws] _ws_send: connection is closed, send command failed

@nelsonamen
Copy link

Same here

@Jshanks
Copy link

Jshanks commented Aug 30, 2022

Seeing the same here.

Home Assistant 2022.8.7
Supervisor 2022.08.5
Operating System 8.5
Frontend 20220802.0 - latest
SamsungTV Smart - v0.7.5
Models - UN65NU8000 & UN55MU6300

Logger: root
Source: custom_components/samsungtv_smart/api/samsungws.py:376
Integration: SamsungTV Smart (documentation, issues)
First occurred: August 29, 2022 at 4:45:59 PM (3 occurrences)
Last logged: 1:57:37 AM

Uncaught thread exception
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 342, in setSock
self.sock.connect(
File "/usr/local/lib/python3.10/site-packages/websocket/_core.py", line 246, in connect
self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options),
File "/usr/local/lib/python3.10/site-packages/websocket/_http.py", line 130, in connect
sock = _open_socket(addrinfo_list, options.sockopt, options.timeout)
File "/usr/local/lib/python3.10/site-packages/websocket/_http.py", line 205, in _open_socket
raise err
File "/usr/local/lib/python3.10/site-packages/websocket/_http.py", line 185, in _open_socket
sock.connect(address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/config/custom_components/samsungtv_smart/api/samsungws.py", line 376, in _client_remote_thread
self._ws_remote.run_forever(
File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 420, in run_forever
setSock()
File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 356, in setSock
handleDisconnect(e)
File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 407, in handleDisconnect
dispatcher.timeout(reconnect, setSock)
AttributeError: 'SSLDispatcher' object has no attribute 'timeout'

@ollo69
Copy link
Owner

ollo69 commented Aug 30, 2022

This is normally due to a wrong version of websocket library because another integration is hard pinning an older version in requirements.

@Jshanks
Copy link

Jshanks commented Aug 30, 2022

This is normally due to a wrong version of websocket library because another integration is hard pinning an older version in requirements.

Is there anything I can provide you to verify that's the case? I'm happy to help in any way I can.

@gabrielmalherbe
Copy link

Same issue, seems to have started after upgrading to Home Assistant 2022.8.7.

@ripburger
Copy link

ripburger commented Aug 30, 2022

I'm having the exact same problems too.

Edit: restoring to 2022.8.6 solves the issue.

@leranp
Copy link

leranp commented Aug 30, 2022

Same here, started after updating to HA 2022.8.7

@Opontios
Copy link

Same thing, and 100% sure it started after the last update.

@balkonrad
Copy link

Same for me

@tudora2
Copy link

tudora2 commented Aug 31, 2022

same here after updating to 2022.8.7

Screenshot 2022-08-31 at 21 18 11

@ollo69
Copy link
Owner

ollo69 commented Sep 1, 2022

I'm using 2022.8.7 without any issue, so problem is not related to HA version.
The few logs in this thread seem to indicate that the problem is related to the websocket-client library, in particular the log from @Jshanks refers to the timeout method introduced in the latest version (v1.4). Looking to the others post it is not clear if the problem is the same for everybody, probably not!!!
To analyze the issues everybody should provide more detail about error and environment and try to understand which version of websocket-client is installed in HA env (in my env version 1.3.3 is installed).
Very probably some custom integration is forcing installation of last version, so is important to understand which custom integration you have installed.

@tudora2
Copy link

tudora2 commented Sep 1, 2022

I'm running HA on a virtual machine, KVM, and CentOS as the main host for virtual machines. Where I can see the WebSocket-client version?
Screenshot 2022-09-01 at 22 53 19
Screenshot 2022-09-01 at 22 55 49

@ollo69
Copy link
Owner

ollo69 commented Sep 1, 2022

Where I can see the WebSocket-client version?

if you create a venv, starting from the folder where you install HA, navigate to lib/python3.10/site-packages and search for a folder like websocket_client-x.y.z.dist-info (x.y.z is the version installed).
If you don't create a venv, depend on what is installed on your virtual machine, but this could be a very unreliable installation. I think should be better if you can provide more logs, because your issue seems different. I have no idea of what a warning that says websocket connected means!!!

@Jshanks
Copy link

Jshanks commented Sep 2, 2022

I've got HAOS installed barebones. That was a bit of a trip trying to find the websocket_client version. I ended up opening a shell into the homeassistant container and running a "pip show websocket_client", which reports v1.4.0. Is that that correct location?

pip show websocket_client
Name: websocket-client
Version: 1.4.0

@ollo69
Copy link
Owner

ollo69 commented Sep 2, 2022

This means that you have last version installed, I don't know which integration require to install that version, but that's it.
Looking better at the code of the library seems that there is a bug in last version using SSLDispatcher that is causing the error AttributeError: 'SSLDispatcher' object has no attribute 'timeout'. Indeed SSLDispatcher is derived from DispatcherBase that do not have timeout method, so when this method is called at row 407 error is raised.
You should open an issue to the library repository (may be referencing this issue). As workaround you could try to install previous version of the library with pip, hoping that new version is not installed again when HA start.

@ollo69
Copy link
Owner

ollo69 commented Sep 2, 2022

BTW this will be fixed by this PR when (and if) will be merged. For now the only possible work-around is rollback to version 1.3.3 of the library.

@elenril2
Copy link

elenril2 commented Sep 3, 2022

I've downgraded my websocket-client to 1.3.3 version. But still that problem occurs:

Logger: root
Source: custom_components/samsungtv_smart/api/samsungws.py:376
Integration: SamsungTV Smart ([documentation](https://github.com/ollo69/ha-samsungtv-smart), [issues](https://github.com/ollo69/ha-samsungtv-smart/issues))
First occurred: 31 sierpnia 2022 15:04:44 (3 occurrences)
Last logged: 10:08:00

Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 342, in setSock
    self.sock.connect(
  File "/usr/local/lib/python3.10/site-packages/websocket/_core.py", line 246, in connect
    self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options),
  File "/usr/local/lib/python3.10/site-packages/websocket/_http.py", line 130, in connect
    sock = _open_socket(addrinfo_list, options.sockopt, options.timeout)
  File "/usr/local/lib/python3.10/site-packages/websocket/_http.py", line 205, in _open_socket
    raise err
  File "/usr/local/lib/python3.10/site-packages/websocket/_http.py", line 185, in _open_socket
    sock.connect(address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/config/custom_components/samsungtv_smart/api/samsungws.py", line 376, in _client_remote_thread
    self._ws_remote.run_forever(
  File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 420, in run_forever
    setSock()
  File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 356, in setSock
    handleDisconnect(e)
  File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 407, in handleDisconnect
    dispatcher.timeout(reconnect, setSock)
AttributeError: 'SSLDispatcher' object has no attribute 'timeout'

@ollo69
Copy link
Owner

ollo69 commented Sep 3, 2022

I think that an integration is asking for that specific version, so when HA restart immediately install v.1.4 again.
You should identify that integration and temporary disable it.

@matata86
Copy link
Author

matata86 commented Sep 3, 2022

I've downgraded my websocket-client to 1.3.3 version. But still that problem occurs:

Logger: root
Source: custom_components/samsungtv_smart/api/samsungws.py:376
Integration: SamsungTV Smart ([documentation](https://github.com/ollo69/ha-samsungtv-smart), [issues](https://github.com/ollo69/ha-samsungtv-smart/issues))
First occurred: 31 sierpnia 2022 15:04:44 (3 occurrences)
Last logged: 10:08:00

Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 342, in setSock
    self.sock.connect(
  File "/usr/local/lib/python3.10/site-packages/websocket/_core.py", line 246, in connect
    self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options),
  File "/usr/local/lib/python3.10/site-packages/websocket/_http.py", line 130, in connect
    sock = _open_socket(addrinfo_list, options.sockopt, options.timeout)
  File "/usr/local/lib/python3.10/site-packages/websocket/_http.py", line 205, in _open_socket
    raise err
  File "/usr/local/lib/python3.10/site-packages/websocket/_http.py", line 185, in _open_socket
    sock.connect(address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/config/custom_components/samsungtv_smart/api/samsungws.py", line 376, in _client_remote_thread
    self._ws_remote.run_forever(
  File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 420, in run_forever
    setSock()
  File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 356, in setSock
    handleDisconnect(e)
  File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 407, in handleDisconnect
    dispatcher.timeout(reconnect, setSock)
AttributeError: 'SSLDispatcher' object has no attribute 'timeout'

Please report if you find out which integration requires an incompatible .version

@elenril2
Copy link

elenril2 commented Sep 3, 2022

Even after HA restart when I check version it is still 1.3.3:

bash-5.1# pip show websocket-client
Name: websocket-client
Version: 1.3.3
Summary: WebSocket client for Python with low level API options
Home-page: https://github.com/websocket-client/websocket-client.git
Author: liris
Author-email: liris.pp@gmail.com
License: Apache-2.0
Location: /usr/local/lib/python3.10/site-packages
Requires:
Required-by: devolo-home-control-api, homematicip, ibm-watson, jellyfin-apiclient-python, libsoundtouch, mycroftapi, praw, pushbullet.py, pyfireservicerota, Pysher, roonapi, samsungtvws, sense-energy, tuya-iot-py-sdk, waterfurnace, zwave-me-ws

I have docker hassio.

@ollo69
Copy link
Owner

ollo69 commented Sep 3, 2022

Even after HA restart when I check version it is still 1.3.3:

So probably this is not the version that HA is using, you should search for a venv dedicated to HA. For sure this issue was introduced in 1.4.0

@ollo69
Copy link
Owner

ollo69 commented Sep 3, 2022

You could try to manually modify the manifest.json file for custom integration, forcing a version <= 1.3.3 and see what happen.
In detail modify line 7 of the file in this way:

"websocket-client>=0.58.0,<=1.3.3",

After modification reboot HA.

@Jshanks
Copy link

Jshanks commented Sep 3, 2022

modified as such, and will let you know if it starts acting up again.

"requirements": [ "websocket-client>=0.58.0,<=1.3.3", "wakeonlan>=2.0.0", "aiofiles>=0.8.0" ],

@elenril2
Copy link

elenril2 commented Sep 3, 2022

You could try to manually modify the manifest.json file for custom integration, forcing a version <= 1.3.3 and see what happen. In detail modify line 7 of the file in this way:

"websocket-client>=0.58.0,<=1.3.3",

After modification reboot HA.

I didn't find any custom component using websocket-client, only yours and for this one the manifest is correct I think: "websocket-client>=0.58.0"
Maybe it is something else from HA core or base integrations.

@nelsonamen
Copy link

Change to "websocket-client>=0.58.0,<=1.3.3",

@elenril2
Copy link

elenril2 commented Sep 3, 2022

Ahh, right. Version higher than 0.58, but lower than 1.3.3.

@ollo69
Copy link
Owner

ollo69 commented Sep 4, 2022

Please try updating to last release v0.7.6 and let me know if this fix the issue.

@gabrielmalherbe
Copy link

Thanks, that seems to have fixed my instance.

@elenril2
Copy link

elenril2 commented Sep 6, 2022

It looks like that solved the problem in my case as well. Thank you.

@ripburger
Copy link

It looks like that solved the problem in my case as well. Thank you.

For me too, thanks for the update!

@ollo69
Copy link
Owner

ollo69 commented Sep 6, 2022

So can we close this issue?
@matata86, because you open the issue, can you provide some update?

@matata86
Copy link
Author

matata86 commented Sep 7, 2022

Yes. After update works great.

@ollo69 ollo69 closed this as completed Sep 7, 2022
@Opontios
Copy link

Opontios commented Sep 9, 2022

For some days after the last update it stopped giving any notifications. Now this again. Should we just ignore it?
Безымянный

@TeHashX
Copy link

TeHashX commented Sep 12, 2022

I get the same "websocket connected" warnings in logs with v0.7.6:

Source: custom_components/samsungtv_smart/api/samsungws.py:592
Source: custom_components/samsungtv_smart/api/samsungws.py:466
Source: custom_components/samsungtv_smart/api/samsungws.py:376
And
Logger: custom_components.samsungtv_smart.media_player
Source: custom_components/samsungtv_smart/media_player.py:789
Integration: SamsungTV Smart (documentation, issues)
First occurred: 9:26:20 AM (2 occurrences)
Last logged: 9:41:50 AM

media_player.samsung_tv - Error refreshing from SmartThings. Check connection status with TV on the phone App
media_player.samsung_tv - Connection to SmartThings restored

Home Assistant 2022.9.2
Supervisor 2022.08.6
Operating System 8.5
Frontend 20220907.0 - latest

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

No branches or pull requests