-
-
Notifications
You must be signed in to change notification settings - Fork 28.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Samsung TV's not working [Testing fix] #20795
Comments
There is a missing Log Details (ERROR)
Wed Feb 06 2019 15:01:28 GMT-0500 (Eastern Standard Time)
Error while setting up platform samsungtv
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
return fut.result()
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/media_player/samsungtv.py", line 109, in setup_platform
[SamsungTVDevice(host, name, description, method, uuid, config_path)]
File "/config/custom_components/media_player/samsungtv.py", line 136, in __init__
self._config = samsungctl.Config()
File "/config/deps/lib/python3.6/site-packages/samsungctl/config.py", line 57, in __init__
raise exceptions.ConfigHostError
samsungctl.exceptions.ConfigHostError: <unprintable ConfigHostError object> My TV is UN75NU8000. |
I updated the code in the first post to solve both problems. |
UPNP errors now: Log Details (ERROR)
Wed Feb 06 2019 15:13:35 GMT-0500 (Eastern Standard Time)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 352, in _async_add_entity
await entity.async_update_ha_state()
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 239, in async_update_ha_state
attr = self.state_attributes or {}
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 787, in state_attributes
in ATTR_TO_PROPERTY if getattr(self, attr) is not None
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 787, in <dictcomp>
in ATTR_TO_PROPERTY if getattr(self, attr) is not None
File "/config/custom_components/media_player/samsungtv.py", line 302, in volume_level
volume = self.get_remote().volume
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/__init__.py", line 1215, in volume
if not self.connected:
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/__init__.py", line 30, in connected
self._connect_upnp()
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/__init__.py", line 37, in _connect_upnp
if not self._connected and self.power:
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/UPNP_Device/upnp_class.py", line 123, in __getattr__
if item in self._devices:
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/UPNP_Device/upnp_class.py", line 123, in __getattr__
if item in self._devices:
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/UPNP_Device/upnp_class.py", line 123, in __getattr__
if item in self._devices:
[Previous line repeated 322 more times]
RecursionError: maximum recursion depth exceeded Are you on Home Assistant Discord? |
dunno what that is. can you do me a favor. please attach this file to a post. samsungctl/upnp/__init__.py |
Here it is https://hastebin.com/efuzucutiw.rb |
Discord has Home Assistant chat server, easy to coordinate https://www.home-assistant.io/help/ Here's the Discord server link: https://discord.gg/6JJ3Rb |
Nevermind on that last post. I am not trying to be rude at all. but I can see you did not follow my directions. it clearly states in the first post. DO THIS FIRST we are going to want to clean out any installed versions of the current samsungctl library. you can do this from a command prompt (shell)
I have updated some code of the code in samsungctl and the new code needs to be downloaded. and installed. I really would prefer if you also installed it from the command line using
this will make sure it gets installed without using a cached copy of it that may be on your system You have an old copy of samsungctl that is being used. that is why you are getting the error. |
Let me reinstall Hassio afresh and test it out again. Gimme 10 min. |
Ok....started afresh and now I see the entity created 🎉 I have not tested anything yet. But I see the media_player entity, which is huge progress :) |
I am going nutz over here trying to locate the problem. and i have not been able to come up with anything. I even coded up a replica of the process that is taking place and it runs fine. you got me on this one. But it appears as tho you have has some progress. and there was possibly something latent kicking about somewhere causing the issue. |
I think there is definitely something wrong here. After restarting I am getting the same UPNP errors. Log Details (ERROR)
Wed Feb 06 2019 16:58:13 GMT-0500 (Eastern Standard Time)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 352, in _async_add_entity
await entity.async_update_ha_state()
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 239, in async_update_ha_state
attr = self.state_attributes or {}
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 787, in state_attributes
in ATTR_TO_PROPERTY if getattr(self, attr) is not None
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 787, in <dictcomp>
in ATTR_TO_PROPERTY if getattr(self, attr) is not None
File "/config/custom_components/media_player/samsungtv.py", line 258, in source
source = self.get_remote().source
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/__init__.py", line 950, in source
if not self.connected:
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/__init__.py", line 30, in connected
self._connect_upnp()
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/__init__.py", line 37, in _connect_upnp
if not self._connected and self.power:
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/UPNP_Device/upnp_class.py", line 123, in __getattr__
if item in self._devices:
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/UPNP_Device/upnp_class.py", line 123, in __getattr__
if item in self._devices:
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/UPNP_Device/upnp_class.py", line 123, in __getattr__
if item in self._devices:
[Previous line repeated 322 more times]
RecursionError: maximum recursion depth exceeded Not sure if this may be causing it, but I am using a Sonos Playbase for audio. I know it is frustrating |
here is what I am going to do. I will bump the version on the develop branch and update the code in the first post to use the new version. |
ok I did the version bump. |
So, unfortunately, the same issue, it worked after I put the code in for the first time. But after restarting HA, I get the same UPNP errors: Log Details (ERROR)
Wed Feb 06 2019 15:47:31 GMT-0500 (Eastern Standard Time)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 239, in async_update_ha_state
attr = self.state_attributes or {}
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 787, in state_attributes
in ATTR_TO_PROPERTY if getattr(self, attr) is not None
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 787, in <dictcomp>
in ATTR_TO_PROPERTY if getattr(self, attr) is not None
File "/config/custom_components/media_player/samsungtv.py", line 302, in volume_level
volume = self.get_remote().volume
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/__init__.py", line 1215, in volume
if not self.connected:
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/__init__.py", line 30, in connected
self._connect_upnp()
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/__init__.py", line 37, in _connect_upnp
if not self._connected and self.power:
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/UPNP_Device/upnp_class.py", line 123, in __getattr__
if item in self._devices:
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/UPNP_Device/upnp_class.py", line 123, in __getattr__
if item in self._devices:
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/UPNP_Device/upnp_class.py", line 123, in __getattr__
if item in self._devices:
[Previous line repeated 323 more times]
RecursionError: maximum recursion depth exceeded while calling a Python object |
If you are on Discord (https://discord.gg/6JJ3Rb) it will be easier to debug. I am at home and can work on it in real-time. |
my question is what is happening when you restart.. the code that is getting loaded is changing somehow I do not know anything about your setup. but is there a possibility of some old copy of samsungctl kicking about in some other python installations site-packags folder?. as an example. with another project that i work on. it uses python 2.7 but it is all set up as an executable. so technically speaking there is no python installation when you install it. But. if you install python 2.7 my program will load the site-packages directory from that python installation. Now the reason why it works right after installation is because the neew version gets plopped in the begining of the search order. once you restart the program it is no longer going to be at the beginning of that search order. I have also run into issues because of mixes installation types. example. if you run python setup.py install it will install the library but you get either a file or a folder name that ends with .egg but if you do the install using pip that is not the case. the wacky thing is if you install via pip after you have already installed using python setup.py install you will end up with 2 installations.. and pip gets all mucked up when removing it. it's a strange thing. |
I am going to add some information printouts. like the location of the library and the version. |
OK i updated the code in the first post to give us a printout of what is going on. |
Here you go (had to change to 2019-02-07 03:14:30 ERROR (SyncWorker_7) [custom_components.media_player.samsungtv] samsungctl version: 0.8.1b
2019-02-07 03:14:30 ERROR (SyncWorker_7) [custom_components.media_player.samsungtv] samsungctl location: /config/deps/lib/python3.6/site-packages/samsungctl
2019-02-07 03:14:30 ERROR (SyncWorker_7) [custom_components.media_player.samsungtv] Samsung TV 192.168.2.252 added as 'Living Room TV'
2019-02-07 03:14:31 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 352, in _async_add_entity
await entity.async_update_ha_state()
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 239, in async_update_ha_state
attr = self.state_attributes or {}
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 787, in state_attributes
in ATTR_TO_PROPERTY if getattr(self, attr) is not None
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 787, in <dictcomp>
in ATTR_TO_PROPERTY if getattr(self, attr) is not None
File "/config/custom_components/media_player/samsungtv.py", line 305, in volume_level
volume = self.get_remote().volume
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/__init__.py", line 1215, in volume
if not self.connected:
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/__init__.py", line 30, in connected
self._connect_upnp()
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/__init__.py", line 37, in _connect_upnp
if not self._connected and self.power:
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/UPNP_Device/upnp_class.py", line 123, in __getattr__
if item in self._devices:
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/UPNP_Device/upnp_class.py", line 123, in __getattr__
if item in self._devices:
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/UPNP_Device/upnp_class.py", line 123, in __getattr__
if item in self._devices:
[Previous line repeated 322 more times]
RecursionError: maximum recursion depth exceeded |
That is the whole log - I did not modify anything. The |
What are you looking for specifically? My guess is once the entity is added, it tries to get all the properties and that is where the error appears. Is there a way to eliminate UPNP (for now) to make sure that the basic media player works? |
give it a try again. delete samsungctl first. I updated the code in my repository |
|
Just for kicks, I removed all the volume and source related code from the component and it kinda works now. The state is still messed up, but no errors. |
do me a favor. do not modify this one. try it first. so you ar going to have to return the changes you made back to the way they were. I updated the develop branch of samsungctl. give it a go and see how you make out. |
Slightly different error this time, but still not working. 2019-02-07 13:08:30 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 352, in _async_add_entity
await entity.async_update_ha_state()
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 239, in async_update_ha_state
attr = self.state_attributes or {}
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 787, in state_attributes
in ATTR_TO_PROPERTY if getattr(self, attr) is not None
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 787, in <dictcomp>
in ATTR_TO_PROPERTY if getattr(self, attr) is not None
File "/config/custom_components/media_player/samsungtv.py", line 305, in volume_level
volume = self.get_remote().volume
File "/config/deps/lib/python3.6/site-packages/samsungctl/upnp/UPNP_Device/upnp_class.py", line 133, in __getattr__
raise AttributeError(item)
AttributeError: volume Wondering if there is no value for |
Okay, just a minor thing and not important for now at all, but I was setting everything up and I noticed the error below, it is just something to beautify the code: The TV is not connected to the network (not at home now so can't investigate why it isn't), but I was doing some preparation work for later today So I got this error (which is correct):
But then it continues and gives this error every ~10 sec:
Perhaps you can enhance to code to check if the socket is actually open before trying to do something with it? |
@kdschlosser Also, see #4210 for the I/O issues. We are doing a lot of I/O inside properties, which should be avoided. |
on hassio all I get is this even if I manually put samsungctl folder there.
|
I get the ModuleNotFoundError: No module named 'samsungctl.upnp' error too |
Could someone please provide up to date installation instructions? They're very confusing from earlier, i.e.
with
or overwriting?
Thank you. |
Okay, think I've got it half figured out
Think this is everything. It now recognises the power state of my TV (again) but remote control does not work. Edit: nah, it's not working at all. Shows On constantly. |
I brought a rm mini 3. WiFi ir, works perfect for 2015 series |
I gave up on trying to get Samsung TV working with this and used a nodeMCU with ir transmitter running esphome and a power monitoring plug to detect when it is switched on. |
Port 8000 gives me accurate on/off state |
I'm looking in Running Hassbian v0.97.2 There is indeed a component samsungtv at What is the last direction to follow to make samsungctl to work with Home Assistant ? Thanks. |
Same here. Using Broadlink to learn the remote and replay them. |
Hey guys, what power monitoring plug did you use to do this? |
I used a Popp zwave socket, don't think they are made any more but any zwave or ZigBee socket with power monitoring capabilities should work. |
So.. should I try this solution (component) or not? My TV: |
After HA updates, I have decided to create a custom component, it is working on the latest version of HA 0.99.3, I have uploaded the code to: https://github.com/roberodin/ha-samsungtv-custom I hope it helps you. |
Hello! |
Hi, I have uploaded the latest version 2.0.1 in HACS. If not working by default samsungctl protocol, try changing it to WS protocol for 2016+ TVs model… |
Wow! That's great!! We can test the HACS version and debug it until it is perfect!! Thanks guys. Great work. |
@sermayoral Have you been able to make it work on an encrypted tv? Can you please help me with it? |
Update to version 3.0.0 and try the new protocols: |
@pablolassalle I have not tested this addon yet, but it sounds great. Anyway. What is your problem? What is your TV's model? Mine is H6400 of 2014. @roberodin Do you know if ha-samsungtv-custom works with encrypted tvs like H6400? |
@sermayoral my tv is a J5500 from 2015, my tv does require a pin for pairing. I think also your tv does require it. Problem is I have never that blue box on my tv asking for pairing with xxxx pin, which I should enter on my HOMEASSISTANT. |
Awesome... i've been looking for a solution for months now. I can confirm that most things are working on the Q6 2019 samsung tv. Thanks a lot guys :) |
@roberodin I'm also curious if this works on the 2014/2015 tv models (H and J). Those used an encrypted connection, which I believe the original component on this git did support for a while. |
I have H series TV. I tried multiple components and they never work as expected |
@roberodin This is something incredible! I can control it. Thanks for this component. |
@roberodin. Can you help us with encrypted TVs? For example 2014 H Series? @kdschlosser got it working. Those different is to introduce the pin when TV shows you... Thank you! |
.Hey Guys,
Any suggestions? Should I add MAC address, as I've seen in some configs that you have posted here? |
Sorry for the beginners question: My home assistant is installed as "hassio" on a raspberry pi. I think on this installation, there is no folder "/homeassistant/components/media_player/samsungtv.py". Right? If so, is there any other alternative measure to get this fix from kdschlosser installed on hassio? Many thanks! |
@magicmatt007 this component doesn’t work anymore and no longer under development. |
Well that sucks. |
Wake on lan works on wireless. The following lines will work. Do not add any port. The format is important that one needs to follow. Enable WOLwake_on_lan: #SAMSUNG TV in Living Room
|
*****UPDATED*****
PLEASE READ ALL THE INFORMATION BELOW THERE ARE PARTS THAT HAVE CHANGED
I am moving the conversation that is taking place in #17802 as the current conversation really has nothing to do with the issue that was reported.
If this is not OK then delete this issue. I am the person that is currently updating the code to samsungctl. It has undergone a lot of additions which I do believe the users of Home Assistant will enjoy being able to use.
thee library also now supports ALL Samsung TV's that have the capability of being controlled over a network or WiFi Connection from 2008 to present. This includes the encrypted websocket connections (H (2014) and J (2015) TV's) as well as the SSL websocket connection (latest firmware release).
I have simplified the connection process so that the only things that are needed in thee Home Assistant config file is the host (ip) of the TV. nothing else is needed. the samsungctl library now handles hammering all of the connection specific details. I also added to it a a class that handles loading and saving of config data. I did this to handle the dynamically changing tokens that are used with the encrypted websockets and SSL websockets. the library now also does not stop running if the connection get severed.. (TV gets powered off). I also changed the handling of the power keys to make them function like they should. KEY_POWER = power toggle, KEY_POWERON = power on and KEY_POWEROFF = power off.
I am currently testing the replacement for /homeassistant/components/media_player/samsungtv.py, because I am not familiar with Home Assistant it is better to hammer these problems out in an issue where they can be tested then to open a PR for non functioning code and end up with a very messy commit history.
PLEASE READ
This is a replacement for the /homeassistant/components/media_player/samsungtv.py file
please do not edit the code and then report an issue. only report problems relating to this code. also do not provide vague errors. like it says config error.. I am willing to bet the error stats more then "config error". I need a copy of the error message in it's entirety. not little bits and pieces. because of the nature of Home Assistant you may need to scroll back in the logs and read for a bit to make sure that you have grabbed all of the relevant log messages.
If you state anything about "custom_components" or if i see that in any of the errors I am not going to answer you. this is because you have modified the code. and it is a pretty good chance that your modification is what is causing the problem.
If you do not do the above then I have no way of helping to solve any issues.
config files for the TV are going to be saved in a directory called samsung_tv that is located in the Home Assistant config folder. the config files for the TVs are going to be named using the IP address you supply in the Home Assistant config yaml file.
HOME ASSISTANT CONFIG FILE
This is the only thing that needs to be added to your hass configuration.yaml file. you will not need to specify any kind of a host. or mac or name. nothing. The whole system will dynamically add TV's as it finds them (of coarse with your permission). if a TV is found you will get a notification in the hass UI. when you open this notification you will be prompted to change the display name, the mac address and the description. if you do not wish to change them simply click on the accept button. You may need to refresh the page once the device is added for it to show up. If you have more then a single TV you DO NOT need to add multiple entries into the hass config file. You only need to add the below code a single time.
If you do not want to add a TV to hass (not sure why you wouldn't) simply ignore the notification. it will disappear after 60 seconds. if you change your mind afterwards or you simply miss the timeout you will need to go into thee samsung_tv config directory and delete the file that has an extension of
.noinclude
.the config file will only get saved once there is a successful connection to the TV made. I have changed about the detection mechanism for the 4 different types of connections. I am hoping this is going to be more of a dock solid mechanism of detecting the connection type. IF you have an issue detecting your TV let me know. There are some tasks I will have you do in order to get it to detect the TV properly. I do not own every Samsung TV made so there is no way to test it on my end. so it is up to you guys to follow the bug reporting directions as outline above.
Here is the updated code.
I WILL NOT MAKE CHANGES AND MAKE ANOTHER POST FOR IT. I WILL UPDATE THE CODE BELOW WITH ANY NEW CHANGES AND INFORM YOU THAT THE CODE HAS CHANGED
click to expand
The text was updated successfully, but these errors were encountered: