Control newer Samsung TVs

@chrisaxe21 Can you share the full code for the remote?

Has anyone done any more testing on the 2017 tvs? I have a UN55NU6950/6900 and all I’m able to do is turn on the tv from Homeassistant. No other functions. Once you turn the tv on it goes from off to unknown, then kinda flips between unknown and off even when the tv’s on.

1 Like

Hi MrUart232.

I have a Samsung TV 2014 H Series and your code is the only one that works for me. Have you managed to finish it? I mean, get it works ‘turn off’ and ‘turn on’. It would be fantastic.

Thanks

Hey,

I tried the above samsung.py code which seems to have done the trick. At least for the status and the volume.
I do also see the correct source, but I still can’t change source nor can I turn off the tv or on.
My TV is a: UE55H6675

Anyone having any experience with this model?

A lot of users have issues with their samsung tv’s (including myself)

On Github kdschlosser is working on a fix.

Keep an eye on this issue on github.

4 Likes

Thanks.

He is working on it hard. Hope he repair the component for encrypted Samsung TVs :slight_smile:

I am in the same situation that you. I control status and volume using the custom_components/media_player/samsungtv.py and the turning on/off via hdmi_cec.

I hope to control everything using only one component some day :slight_smile:

How have you achieved to turn it on and off with that?

It’s easy. You must connect the RPI to your TV by HDMI and setup de hdmi_cec component in Home Assistant.

After that, you can send ‘hdmi_cec’ commands to your TV, like turning on/off

action:
  service: hdmi_cec.power_on

More info here.

Arh yes, that makes sense. I thought you could without.
One thing I can’t get working is the source change.

Before I was using openhab and had that part working too. I really hope I can find a solution to get that working. I was using it in a rule so that my TV switches from one source to another, showing my surveillance cameras when the doorbell rang. Unfortunately that’s no longer possible :frowning:

Anyone else not seeing their tv’s updating after the latest 88.1 update?

This is the error I see in the log:

Error loading custom_components.media_player.samsungtv. Make sure all dependencies are installed

Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/homeassistant/loader.py", line 147, in _load_file module = importlib.import_module(path) File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 728, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/config/custom_components/media_player/samsungtv.py", line 13, in <module> from homeassistant.components.media_player import ( ImportError: cannot import name 'SUPPORT_TURN_OFF' from 'homeassistant.components.media_player' (/usr/local/lib/python3.7/site-packages/homeassistant/components/media_player/__init__.py)

I get “ms.channel.unauthorized” when connecting to Samsung TV UE55NU6035 and I haven’t been able to figure it out.

Here are the logs when pressing the on/off button in the UI:

2019-03-07 16:38:59 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.4552020656] {'event': 'ms.channel.unauthorized'}
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py", line 148, in handle_call_service
    connection.context(msg))
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1133, in async_call
    self._execute_service(handler, service_call))
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1155, in _execute_service
    await handler.func(service_call)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py", line 188, in handle_service
    self._platforms.values(), func, call, service_name
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 278, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 292, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/media_player/samsungtv.py", line 214, in turn_off
    self.get_remote().close()
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/media_player/samsungtv.py", line 138, in get_remote
    self._remote = self._remote_class(self._config)
  File "/Users/henrik/.homeassistant/deps/lib/python/site-packages/samsungctl/remote.py", line 11, in __init__
    self.remote = RemoteWebsocket(config)
  File "/Users/henrik/.homeassistant/deps/lib/python/site-packages/samsungctl/remote_websocket.py", line 30, in __init__
    self._read_response()
  File "/Users/henrik/.homeassistant/deps/lib/python/site-packages/samsungctl/remote_websocket.py", line 72, in _read_response
    raise exceptions.UnhandledResponse(response)
samsungctl.exceptions.UnhandledResponse: {'event': 'ms.channel.unauthorized'}
2019-03-07 16:39:00 INFO (SyncWorker_6) [homeassistant.components.media_player.samsungtv] TV is powering off, not sending command: KEY

I have been following

also but have seen he has stopped. However I also do own an Athom Homey and for that device somebody managed to write an app. For the code see: https://github.com/balmli/com.samsung.smart/tree/cd455cbb5cb27988e7e32e2489cf604e7135843d. Possibly somebody could use this to create a working Hass module.

2 Likes

I got the same issue. No clue

kdschlosser stopped working on the home assistant intergration.

He is still actively developing the samsungctl library.
Github link to develop branche

Got a Samsung UE49LS03, tried to add everything from above but got errors.

Any thougts?

configuration.yaml

  - platform: samsungtv_custom
    host: 192.168.1.32
    port: 8002

error:

Wed May 29 2019 11:04:28 GMT+0200 (Central European Summer Time)
Update for media_player.samsung_tv_remote fails
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 220, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 379, 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 125, in update
    self.send_key("KEY")
  File "/config/custom_components/samsungtv_custom/media_player.py", line 146, in send_key
    self.get_remote().control(key)
  File "/config/custom_components/samsungctl/utils.py", line 248, in wrapper
    return func(*args, **kwargs)
  File "/config/custom_components/samsungctl/remote_legacy.py", line 410, in control
    ' -- is the TV on?!?'
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

I got also Frame 2018, could you please share the things what you did to get it working?

Thanks in advance

Everything stopped working after an update. That happened a couple of weeks after my post. I just bought an ir blaster. Haven’t tested direct commands eversince.

Is there anyway to grab status of hdmi on Samsung tv.
Means can we grab different status of hdmi
Like is it
HDMI 1 or HDMI 2 or HDMI 3 …

Please guide.
Thanks