@majkers There will always be a delay, but that’s not necessarily a bug. Try turning your tv off and on again after just a few seconds, the reason it “starts” so fast is because it was never off in the first place.
All Samsung TVs seem to offer a sort of “grace period” after you turn them off, in which time the TV is not actually off, only the screen is off in this time, so turning it back on from this state is almost instant.
This was probably added for cases in which u turned the TV off by mistake and want to turn it on again fast to not miss scenes from what you were watching…
@majkers Taking into account this (let’s call it) “wait state”, I think that the correct way of using it is to turn off the TV twice. Because the first “turn off” will send the TV to the usual “wait state”, and the second “turn off” command will force it to actually turn off from that state.
Otherwise, when using “turn off” only once, you would need to wait for the “wait state” to time out too, and it will turn off by itself.
@jaruba thanks for response. Taking it into account. Do You know how long is this “grace period” in upadte method ping and default. Maybe I was just impatient?
hi could someone please help, i updated to 104 and i keep getting the following error
2020-01-22 18:42:56 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.samsung_tv fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/samsungtv_custom/media_player.py", line 198, in update
self.send_key("KEY")
File "/config/custom_components/samsungtv_custom/media_player.py", line 218, in send_key
self.get_remote().control(key)
File "/config/custom_components/samsungtv_custom/media_player.py", line 204, in get_remote
self._remote = self._remote_class(self._config)
File "/usr/local/lib/python3.7/site-packages/samsungctl/remote.py", line 11, in __init__
self.remote = RemoteWebsocket(config)
File "/usr/local/lib/python3.7/site-packages/samsungctl/remote_websocket.py", line 28, in __init__
self.connection = websocket.create_connection(url, config["timeout"])
File "/usr/local/lib/python3.7/site-packages/websocket/_core.py", line 511, in create_connection
websock.connect(url, **options)
File "/usr/local/lib/python3.7/site-packages/websocket/_core.py", line 223, in connect
self.handshake_response = handshake(self.sock, *addrs, **options)
File "/usr/local/lib/python3.7/site-packages/websocket/_handshake.py", line 79, in handshake
status, resp = _get_resp_headers(sock)
File "/usr/local/lib/python3.7/site-packages/websocket/_handshake.py", line 150, in _get_resp_headers
status, resp_headers, status_message = read_headers(sock)
File "/usr/local/lib/python3.7/site-packages/websocket/_http.py", line 298, in read_headers
line = recv_line(sock)
File "/usr/local/lib/python3.7/site-packages/websocket/_socket.py", line 102, in recv_line
c = recv(sock, 1)
File "/usr/local/lib/python3.7/site-packages/websocket/_socket.py", line 94, in recv
"Connection is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.
Not sure, but I think it’s possible to retrieve a list apps and id’s. A while ago I found a script in one of the other libraries that did exactly that … but like always, couldn’t find the exact code anymore …
@Tjeerd We’re already using the code you posted to get the app list, it’s used only if app_list is not set by users in the config.
But people asked how THEY can get the app list, not the component. The code you posted uses the WebSocket connection to get the app list, users can’t use the WebSocket API to get this data on their own, and there is no HTTP endpoint to get this same data either.
@jaruba Just wanted to say that this works perfectly! I’ve been wanting to start apps on my TV (Plex, Netflix, Disney+, etc) since forever and this makes it possible. The same for changing back to ‘TV’ which never worked, but with your chaining functionality it works great.
Is there a reason why this is not in core? Probably because it only supports 2016+ TV’s?
Also… why don’t you rename this component and add it to HACS? As you said, your version contains more functionaliteit than the two other repositories it is based upon.
@thmry I could push it to HACS, sure… but as you said, the supported TVs are limited. And this component still has limitations.
I’ve been looking into the idea of making a Samsung TV component based on the SmartThings Cloud API, this has A LOT more potential in terms of features.
That way, it would be possible to get data on what channel is currently watched on TV, even get the current input source (TV, HDMI Device)