@blackmesa what is your HA version?
Thanks this has fixed it.
Im having a seperate issue with my second TV and the smart things API component… The TV rarely responds and the status doesn’t seems to update correctly when I add the device id and api token to my config.yaml.
Image attached of how my TV’s appear inside the smartthings API device list, for some reason it is coming up with a different type “placeholder” and also as “inactive”
The “Living room tv” works perfectly whereas the “master bed tv” is the one im having troubles with. I have reached out to samsung support multiple times and am not getting anywhere.
I realise this isn’t an issue with your component but figured you might have seen similar issues in the past?
@AJG one of my TVs is also flagged as inactive in the SmartThings API, but it works fine. Maybe double check that u use the right API key and device id (many set the device id wrongly by using the network device id, which is completely different)
Hello
I cannot find any information about what TV features can be controlled without Smart Things and which ones require it.
Currently I configured the component with default configuration, providing IP, MAC and port. HA shows state of TV (enabled/disabled). But all available controls in HA GUI doesn’t work raising errors:
File "/config/custom_components/samsungtv_tizen/websockets.py", line 109, in _ws_send
self.open()
File "/config/custom_components/samsungtv_tizen/websockets.py", line 160, in open
raise exceptions.ConnectionFailure(response)
custom_components.samsungtv_tizen.exceptions.ConnectionFailure: {'event': 'ms.channel.unauthorized'}
Thanks for help in advance
@maxym Your TV needs to be on, and you need to be near it in order to accept the authorization pop-ups. Your error says it’s lacking authorization, if u don’t see any pop-ups when restarting this component (or HA) or after u use any command from the UI, then check ur TVs settings, maybe u disabled them at some point.
As for the SmartThings API, there is an entire page dedicated to it:
https://github.com/jaruba/ha-samsungtv-tizen/blob/9c37012592c13416183b5bc3cd5e128f51348ec1/Smartthings.md
There is a section there about the benefits of using it.
I didn’t configured SMartThings yet.
So you say that all the component features (except monitoring TV enable/disable state) requires SmartThings to work. is it true?
@maxym No, without SmartThings, u will get the “TV/HDMI” state instead of exact input or current channel, and won’t have access to the SmartThings Keys which makes it very easy to change input (with the normal keys, u would need to use key chaining to change inputs, as there is no key for individual HDMI inputs), the general on / off states may be a bit more accurate too.
U might have an irational fear of the SmartThings API though, all ur TV data is sent to them anyway, u can’t change that… at least by enabling this u get to use that data too.
No, it’s not a fear. Just doing the configuration work step by step.
Currently I cannot even turn off the TV with use of default settings (ie withoug SmartThings). No manual informs about it. Moreover UI shows a lot of controls, even if they are not intended to work without SmartThings. It’s all is a bit misleading.
GUI without SmartThings configured for the component:
Anyway, thank you. Now It’s clear to me that next step is configuring SmartThings
@maxym no, all those controls should work, they use the WS API and UPnP, did u accept the authorization pop-ups? I’ve asked u this before.
@maxym u could also try to set port to 8002, but i still think it’s more likely an authorization issue.
No… no popups on TV
Why are you assuming I have set anything else than 8002? This port is listed as default in your documentation.
Anyway, I restarted HA a few times and the result is pretty sad:
Logs are full of following lines:
File "/config/custom_components/samsungtv_tizen/websockets.py", line 109, in _ws_send
self.open()
File "/config/custom_components/samsungtv_tizen/websockets.py", line 160, in open
raise exceptions.ConnectionFailure(response)
custom_components.samsungtv_tizen.exceptions.ConnectionFailure: {'event': 'ms.channel.timeOut'}
2020-03-22 18:28:00 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
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 781, in capability_attributes
source_list = self.source_list
File "/config/custom_components/samsungtv_tizen/media_player.py", line 532, in source_list
self._gen_installed_app_list()
File "/config/custom_components/samsungtv_tizen/media_player.py", line 337, in _gen_installed_app_list
app_list = self._ws.app_list()
File "/config/custom_components/samsungtv_tizen/websockets.py", line 237, in app_list
'to': 'host'
File "/config/custom_components/samsungtv_tizen/websockets.py", line 109, in _ws_send
self.open()
File "/config/custom_components/samsungtv_tizen/websockets.py", line 160, in open
raise exceptions.ConnectionFailure(response)
custom_components.samsungtv_tizen.exceptions.ConnectionFailure: {'event': 'ms.channel.timeOut'}
Don’t know if is it important but token file created by the component is empty
Added (actually copied from several posts above).
This is my config:
media_player:
- platform: samsungtv_tizen
host: "192.168.68.208"
broadcast_address: "192.168.68.208"
port: 8002
mac: "XXXXX"
app_list: '{"Netflix": "11101200001", "YouTube": "111299001912", "Spotify": "3201606009684"}'
The result:
Entity is now valid, but state still “unknown”.
Logs points to problem with parsing json afaik. But since app_list is copied directly from your example I have no idea what’s wrong
File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2020-03-22 22:51:18 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.samsung_tv_remote 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 476, 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 "/usr/src/homeassistant/homeassistant/util/__init__.py", line 240, in wrapper
result = method(*args, **kwargs)
File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 240, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/samsungtv_tizen/media_player.py", line 423, in update
self._get_running_app()
File "/config/custom_components/samsungtv_tizen/media_player.py", line 322, in _get_running_app
root = json.loads(data.encode('UTF-8'))
File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
@maxym logs are still saying that the component is trying to fetch the app_list from the TV, as if it were not set, can you try something simpler like:
app_list: '{"Netflix": "11101200001"}'
No change. Still the same error.
Please note I’m on HA 0.107.5 if it does matter.
I did some more testing today, config was all correct. For some odd reason when on digital TV it would always show in the UI channel “9” no matter what channel i was actually watching… When I swapped input to Netflix or Youtube it would show Netflix/Youtube correctly.
I made some requests via postman to the below and was always getting the same result on digital TV “9”
https://api.smartthings.com/devices/<mydevcieid>/status
I probably sent this request 15 times and then I got a few more device access notifications on my TV and then it all started working correctly and also displaying the correct channel in the UI.
Must have purely been a permissions thing as inside the smartthings app the whole time I could always view the correct channel info.
@AJG I can’t explain that behaviour, but I’m happy it works for you now
@maxym I can’t test HA 0.107.5 for now, it might make a difference, or it might not
@TheStigh You can open the browser with a specific URL with this component, here is an example:
I just updated to 0.107.5 and the error is persisting
Guys,
Got a brand new Q70R, everything seem to work fine.
Though, the responses are quite slow??
Testing TURN ON via media_player console, 6 seconds until turns on
Testing TURN OFF, same… 6 seconds until tv responds
Made a script using SmartThings for toggle power on/off testing:
tv_power_toggle:
alias: TV Power Toggle
sequence:
- service: media_player.play_media
data:
entity_id: media_player.samsung_q70r
media_content_id: KEY_POWER
media_content_type: "send_key"
Using the ‘toggle’ ST KEY, won’t turn on but turns off.
Respons time is also approx 6 seconds…
Any ideas why so slow ?
My config:
- platform: samsungtv_tizen
host: !secret samsung_q70r_ip
port: 8002
mac: !secret samsung_q70r_mac
name: Samsung Q70R
api_key: !secret smartthings_token
device_id: !secret smartthings_device_id
app_list: '{"Netflix": "11101200001", "YouTube": "111299001912", "Spotify": "3201606009684"}'
update_method: "ping"