Samsung TV: what is pip3 install websocket-client

how can i install pip3 install websocket-client on Hassio? I need this to setup samsung tv on home assistant.

just like you noted: pip3 install websocket-client. You can then run samsungctl to control your TV.

Where exactly do I run that command?

You would run that where home assistant is installed. Your home assistant will essentially be the websockets client to your TV. Should already be installed though based on my instance of home assistant, but I’m running the Docker container

Sorry to highjack
How do you do this on hassio, also will this allow you to turn on/off the tv via HA?

But he is running Hassio and I am guessing no console window or means to execute such command. Even if he did, the line pip3 install websocket-client would fail and return an error of pip3: not found

So the question remains. How does one do this within hassio??

Have a look at custom components, you can set requirements which hassio will install when the component loads. I don’t think anything is stopping you creating a blank custom component with nothing other than the requirements line.

Ah thought he was strictly talking about HA, my bad. Maybe via a terminal add on: https://github.com/hassio-addons/addon-terminal

Or what was mentioned about custom components, which is probably the best option.

sure i will try it with addon terminal since it will help out for future needs if i need to run any other commands. Thank you guys for help

It may work, somehow but the line pip3 install websocket-client will not if you are running hass-io. It sounds like the custom component route is the way to go. If you understand this and figure it out, post it here. I’d be interested in knowing as well.

Anybody make any headway on this with the custom component route?

I’d love to have this working on Hassio but no idea where to start

Any joy? I want to do this too.

No I haven’t

I figured it out! Get to a terminal and run:

sudo apt-get -y install python3-pip

THEN you can run pip3 install websocket-client. Be careful though, this seemingly made my Hass.io tab disappear. I have no idea why this would be, hopefully it’s not a bad sign. I added hassio: to my configuration.yaml and it came right back.

TV power and volume control working beautifully!

No way you can do the “sudo apt-get” command in a Hass.io enviroment. I don’t understand…

Wow, before your comment I had no idea that “normal” Hass.io was so… locked down (for lack of a better term). It helps a lot to know what ResinOS is. :stuck_out_tongue:

Anyway, yes, there is a way to run that command… if you used the generic Linux install option. Which probably doesn’t help anyone else in this thread.

I was struggling with this to get my Samsung TV component to work on Hassio.
I have a Samsung tv from after 2017, for these tv’s you need to install the websocket-client for it to work.

I just figured out that hassio has this library already installed, you just need to set the correct config for the Samsung component. So if you need the websocket client for your tv to work you need to set the “ip” and the “port”, and it will magically use the correct lib.

platform: samsungtv
name: TV Living Room
host: 192.168.0.000
port: 8001
2 Likes

@reindrich, thank you for posting this. I’ve been trying to get my KS8000 integrated into hass for a long time and was always perplexed by the system auto-discovering my TV, but not actually being able to control it. I deleted the auto-config that was discovered and added your lines to my configuration.yaml…and bingo! I get on/off state reporting, on/off control, volume control, play/pause, and input select. It’s not comprehensive, but enough to automate from. Thanks!

:frowning: I tried everything and can not control it in the GUI as it says in entities dans there is no unique id for this entity so can’t use it in automation in the GUI…