Samsung Tizen Support

@dico, I had the same error as yours. Then I decided to make a new image using Raspian instead of Hassbian and followed the instructions exactly as explained at https://home-assistant.io/docs/installation/raspberry-pi/

After the instalattion I installed websockets and ran Home Assistant:

(homeassistant) homeassistant@raspberrypi:/srv/homeassistant $ pip3 install websocket-client (homeassistant) homeassistant@raspberrypi:/srv/homeassistant $ hass

My TV model is KU6400, and the basic commands are working (power on/off, volume and mute). I still don´t know how to create commands, just begging with Home Assistant…

And that´s my configuration:

media_player TV1:
  - platform: samsungtv
    host: 192.168.0.3
    port: 8001

If you have no success try to disable auto discover. I´m not sure, but I think Home Assistant was getting my computer ip (Windows 10) instead the TV ip…

# Discover some devices automatically
discovery:
  ignore:
    samsung_tv

If everything works you will see a message in your TV asking permission to be controlled by external device.
You can check this configuration in your TV.

Mine is like that: Settings / Network / Expert Settings / Mobile Device Manager / Mobile Notification = First Time Only

Did you ever get this issue working on Hassbian? I am having the same issue as you are.

I’ve confirmed that I can manually use the samsungctl script to connect to my TV and it works great. However, when I try loading Samsungtv through Home Assistant, I have this same websocket import issue, even though I’ve installed websocket-client using pip3.

I’m wondering if it’s same to reload Home Assistant using Raspbian instead.

Well, it seems that I may have spoken too soon. As soon as I posted this, I did some more digging and found the problem, at least for me. I installed Home Assistant using the Hassbian image, rather than the Raspbian Lite image. In looking at the documentation for Hassbian, I had forgotten that Hassbian installs HomeAssistant into a Python virtual environment. Because of this, when I was running sudo pip3 install websocket-client, it was installing websockets for the global python environment, but not specifically for the virtual environment that HomeAssistant was using.

To get around this issue:

homeassistant@hassbian:/ $ source /srv/homeassistant/bin/activate
(homeassistant) homeassistant@hassbian:/ $ 
(homeassistant) homeassistant@hassbian:/ $ pip3 install websocket-client
Collecting websocket-client
  Downloading websocket_client-0.44.0-py2.py3-none-any.whl (199kB)
100% |████████████████████████████████| 204kB 44kB/s 
Collecting six (from websocket-client)
  Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six, websocket-client
Successfully installed six-1.10.0 websocket-client-0.44.0
(homeassistant) homeassistant@hassbian:/ $ 
(homeassistant) homeassistant@hassbian:/ $ deactivate 

After doing this, I reloaded Home Assistant, I’m no longer getting the websocket import error. Even better, my Samsung TV now responds via Home Assistant!!

Hopefully this helps you or someone else.

3 Likes

What’s the model number of your TV?

and how can i get around this with hass.io installation? :slightly_smiling_face:

I would like to know too. Hass.io autodiscovered my Samsung TV but I can’t do anything. Can’t even find it in the config.yaml.

i disabled discovery for samsung_tv and added it manualy, changed the port to the newer one and so the on/off state works great but i can’t controll it with hass.io. :upside_down_face:

from what i read here https://home-assistant.io/components/media_player.samsungtv/, is that we need to do pip3 install websocket-client so i connect with putty and gave this command. Then i get this error:
core-ssh:~# pip3 install websocket-client -ash: pip3: not found
i believe we cannot do this with hassio but then how can we have the samsung tv platform working?

2 Likes

Any dev that might have an answer?

@Jonny_Davey got a way here:

https://community.home-assistant.io/t/websocket-in-hass-io/

1 Like

It works for me!

I can power it on and off, adjust the volume, mute and unmute. While on Netflix i can use the fast forward and rewind button but the play button doesn’t appear. It does when it’s off… kinda odd.

Model: Samsung 6 Series (60) (UE60KU6000)

configuration.yaml

media_player:
  - platform: samsungtv
    host: 192.168.129.20
    port: 8001
    mac: b8:bb:af:de:0f:36
    name: Living Room TV

image

image

It would be great if we could control the play/ pause too and see on what source the tv is to get some fun automtion like when watching netflix, dim the lights or set a scene!

Can i report this on git?

2 Likes

@kurniawan77 not bad, my UE55J5670 won’t do anything. :frowning:

config looks like yours.

well don’t feel sad… i get errrors the whole day!!!

2017-09-07 12:57:48 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.living_room_tv is taking over 10 seconds
2017-09-07 12:57:49 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 12:58:00 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 12:58:11 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 12:58:22 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 12:58:33 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 12:58:44 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 12:58:55 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 12:59:06 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 12:59:17 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 12:59:28 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 12:59:39 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:00:00 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.living_room_tv is taking over 10 seconds
2017-09-07 13:00:01 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:00:12 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:00:23 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:00:34 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:00:45 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:00:56 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:01:07 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:01:18 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:01:29 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:01:40 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:01:51 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:02:12 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.living_room_tv is taking over 10 seconds
2017-09-07 13:02:13 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:02:24 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:02:35 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:02:46 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:02:57 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:03:08 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:03:19 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:03:30 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:03:41 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:03:52 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:04:03 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:04:24 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.living_room_tv is taking over 10 seconds
2017-09-07 13:04:25 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:04:36 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:04:47 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:04:58 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:05:09 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:05:20 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:05:31 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:05:42 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:05:53 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:06:04 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:06:15 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:06:36 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.living_room_tv is taking over 10 seconds
2017-09-07 13:06:37 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:06:48 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:06:59 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:07:10 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:07:21 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:07:32 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:07:43 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:07:54 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2017-09-07 13:08:05 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10

I was hoping for the same functionality. Just having a simple on/off status is kind of useless to automate anything for me.

Then vote for it! :+1::slightly_smiling_face:

I have a 2016 Tizen, Model UN65KS850D
using samsungctl from my debian laptop i get the same results as i get from my raspberry pi HA installation. (0.51.2). Which leads me to believe the problem lies with samsungctl and not HA’s integration of it.

I can browse to my tv and get all the info about it via http://192.168.22.6:8001/api/v2/.

~$ samsungctl --host 192.168.22.6 --method websocket --interactive --port 8001
Traceback (most recent call last):
File “/home/root/.local/bin/samsungctl”, line 11, in
sys.exit(main())
File “/home/root/.local/lib/python3.5/site-packages/samsungctl/main.py”, line 101, in main
with Remote(config) as remote:
File “/home/root/.local/lib/python3.5/site-packages/samsungctl/remote.py”, line 10, in init
self.remote = RemoteWebsocket(config)
File “/home/root/.local/lib/python3.5/site-packages/samsungctl/remote_websocket.py”, line 25, in init
self._read_response()
File “/home/root/.local/lib/python3.5/site-packages/samsungctl/remote_websocket.py”, line 67, in _read_response
raise exceptions.UnhandledResponse(response)
samsungctl.exceptions.UnhandledResponse: {‘event’: ‘ms.channel.timeOut’}

I’m a decent tech, but a fairly novice scripter. Anything I can provide to help troubleshoot, i’d be happy to do.

Whats strange is OpenHab’s implementation works as a remote

Hi.
I have a Samsung UE55KU6000 and Home Assistant (HASSBIAN, not HASS.io)
I had the same problem, ImportError: No module named ‘websocket’
We are working in a virtualenv and the command sudo pip3 install websocket installs the module in the system instead of the virtualenv. If I activate the virtualenv and try to install the module I get a “permission denied”.
Inside de virtualenv with sudo the module is installed again in outside of the virtualenv.

I got it working:with the next steps.

  1. Connect to the virtualenv:
    source /srv/homeassistant/bin/activate

  2. Set permissions for the user ‘pi’ so we can install without sudo.
    sudo chown pi:pi -R /srv/homeassistant/lib
    sudo chown pi:pi -R /srv/homeassistant/include

  3. Install websocket modules
    pip3 install websocket
    pip3 install websocket-client

  4. Set permissions back for the user ‘homeassistant’
    sudo chown homeassistant:homeassistant -R /srv/homeassistant/lib
    sudo chown homeassistant:homeassistant -R /srv/homeassistant/include

  5. You can check if module is properly installed in your virtualenv
    pip3 freeze

If you have more errors due to permissions in another folder, chown is your way to go.
I hope this helps someone, cheers.

edit:

With these 2 commands works too.

   source /srv/homeassistant/bin/activate
   sudo /srv/homeassistant/bin/pip3 install websocket
   sudo /srv/homeassistant/bin/pip3 install websocket-client
1 Like

After doing the above how did you set up your Samsung TV? Is it normal i.e. adding the samsung TV component in your configuration.yaml?

Thanks.

UPDATE:

I followed your method and it doesn’t work for me.
Get the same warning issues:

WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10

Step 0: sudo bash -u homeassistant -H /bin/bash

Then you can skip step 2 and step 4.

Enjoy!

1 Like