@jaruba Just a big for this great component.
It works perfectly and action are immediate on my UE65KS8000
GV
No, do not use it. But one week ago I uninstall Samsung custom component and I have no more ghost TV switch on. Generally, TV switched on around 20 seconds after automation switch off or manual switch off, even when I disabled “enable TV wake up by ip device” strange. I also tried to delete MAC, but didn’t see any changes. I know nobody else reported this issue… just reporting.
Hi, I have been trying to get this to work on my Samsung Q6 however I’m getting some errors… Any advice would be appreciated.
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 419, in _async_add_entity
await entity.async_update_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 314, in _async_write_ha_state
attr = self.capability_attributes
File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 792, in capability_attributes
source_list = self.source_list
File "/config/custom_components/samsungtv_custom/media_player.py", line 319, in source_list
self._gen_installed_app_list()
File "/config/custom_components/samsungtv_custom/media_player.py", line 229, in _gen_installed_app_list
app_list = self._remote.app_list()
File "/config/custom_components/samsungtv_custom/samsungtvws/remote.py", line 179, in app_list
self._ws_send(payload)
File "/config/custom_components/samsungtv_custom/samsungtvws/remote.py", line 93, in _ws_send
self.open()
File "/config/custom_components/samsungtv_custom/samsungtvws/remote.py", line 108, in open
sslopt=sslopt
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 220, in connect
options.pop('socket', None))
File "/usr/local/lib/python3.7/site-packages/websocket/_http.py", line 126, in connect
sock = _ssl_socket(sock, options.sslopt, hostname)
File "/usr/local/lib/python3.7/site-packages/websocket/_http.py", line 253, in _ssl_socket
sock = _wrap_sni_socket(sock, sslopt, hostname, check_hostname)
File "/usr/local/lib/python3.7/site-packages/websocket/_http.py", line 232, in _wrap_sni_socket
server_hostname=hostname,
File "/usr/local/lib/python3.7/ssl.py", line 423, in wrap_socket
session=session
File "/usr/local/lib/python3.7/ssl.py", line 870, in _create
self.do_handshake()
File "/usr/local/lib/python3.7/ssl.py", line 1139, in do_handshake
self._sslobj.do_handshake()
socket.timeout: _ssl.c:1059: The handshake operation timed out
@jaruba, great app! Got it working on my Q85 TV (2019)!
I found an addition to the Key codes. KEY_AMBIENT
changes to Ambient Mode.
A more robust way to change to LiveTV is the key combination: KEY_EXIT+2000+KEY_TV+KEY_EXIT
This works to change to TV from any source or app.
@rosch100 Thanks, I’ll add KEY_AMBIENT
to the readme. I’m happy people are using key chaining!
@AJG Looks like a SSL handshake time out issue when trying to get the list of apps from the TV. Was the TV turned off when you tried this? Try turning on the TV and restarting HA? Otherwise, if you set a custom app_list
(explained in the readme), it won’t try to get this list from the TV anymore.
@chris669 I’m not sure what to tell you, if you disabled WOL, even removed the MAC… Are not using IFTTT… If you are also sure there’s no general automation to turn things on right after they go off that might be interfering with this… Then I’m out of ideas…
Oh, wow that works perfectly and really fast! That is a very nice tip @rosch100! I even changed it to KEY_EXIT+1000+KEY_TV+KEY_EXIT
which seems to work just as well. I don’t think it needs more than a second, but I can always change it to two or more when needed.
This looks so much better than what I had before: KEY_SOURCE+500+KEY_LEFT+KEY_LEFT+KEY_LEFT+KEY_LEFT+KEY_LEFT+500+KEY_RIGHT+KEY_RIGHT+KEY_ENTER
which didn’t look great and took a while :).
@rosch100 @thmry I think it’s possible to make a wiki on Github for the repo that would allow public editing, which would make it easy for key chaining patterns to be a community effort. I think this would be worth it as you can do literally anything with key chaining… even change complex tv settings.
I could even make a wiki page for keys, as those are also ever changing and make more sense to be updated by the users.
@thmry, it seems that the delay time is quite dependent on the TV model. I could not get it to work below 2000ms. Glad, it works for you!
@jaruba Thanks.
I did have the TV on in my original attempt and it didn’t work.
However adding the app_list like you mentioned was the fix.
Thanks again!
Great Custom componet.
How to add a second tv?
@raidptn You can add as many TVs as you want in the exact same way you added the first one. Here’s my config for my 2 TVs (I used XXX
to censor sensitive data):
media_player:
- platform: samsungtv_custom
host: XXX
name: Living Room TV
mac: XXX
port: 8002
source_list: '{"TV":"KEY_SOURCE+KEY_LEFT+KEY_LEFT+KEY_ENTER","Manual":"KEY_SOURCE+KEY_LEFT+KEY_LEFT+KEY_RIGHT+KEY_RIGHT+KEY_ENTER","Chromecast":"KEY_SOURCE+KEY_LEFT+KEY_LEFT+KEY_RIGHT+KEY_ENTER"}'
app_list: '{"Netflix": "11101200001", "YouTube": "111299001912", "Spotify": "3201606009684"}'
update_method: "ping"
- platform: samsungtv_custom
host: XXX
name: Bedroom TV
mac: XXX
port: 8002
source_list: '{"TV":"KEY_SOURCE+KEY_DOWN+KEY_UP+KEY_LEFT+KEY_LEFT+KEY_ENTER","Manual":"KEY_SOURCE+KEY_DOWN+KEY_UP+KEY_LEFT+KEY_LEFT+KEY_RIGHT+KEY_ENTER","Chromecast":"KEY_SOURCE+KEY_DOWN+KEY_UP+KEY_LEFT+KEY_LEFT+KEY_RIGHT+KEY_RIGHT+KEY_ENTER"}'
app_list: '{"Netflix": "11101200001", "YouTube": "111299001912", "Spotify": "3201606009684"}'
update_method: "ping"
Hi
I added the
media_player:
- platform: samsungtv_custom
host: XXX
name: Kitchen TV
mac: XXX
port: 8002
source_list: ‘{“TV”:“KEY_HOME+KEY_RIGHT+KEY_RIGHT+KEY_ENTER”}’
But when i run Check Config or try to restart HASSIO i get source_list is an invalid option.
TIA
Are you sure that you’re using my component? There are 2 more components with the same name.
Yeah, downloaded via git link on your post. Wife’s using TV at the min but if I don’t add the source list it has auto detected the sources. Will try to see if they work and let you know
I’ve renamed this component to “SamsungTV Tizen” (renamed the github repository too to jaruba/ha-samsungtv-tizen
).
I’ve released a new version that adds support for the SmartThings API, which is enabled by setting the api_key
and device_id
properties. SmartThings adds many benefits: see TV channel names, see which HDMI source is selected, improved on / off states, new keys: ST_TV
, ST_HDMI1
, ST_HDMI2
, ST_HDMI3
I’ve also submitted this custom component to HACS, here is the PR:
Does this work with NU models? Specifically NU8000 - it has the Magic remote with only a handful of buttons. Thanks.
@Stooovie There is a good chance that it will work, but there’s only one way to find out… And it presumes trying it to see if it works.
Yeah, it’s just the integration I use now (Samsung custom plus Alexa) is kinda fragile and I didn’t wanna disturb anything backups don’t always work as they should. I’ll try anyway.
@Stooovie I recommend u also set a value for the app_list
property. Although this is optional, there have been users that got errors when not setting it.
okay thanks!