Closed xRino94 closed 4 years ago
@RinoGaetano94 Oh mamma mia. Cosa fa la tua TV? :-)
Now seriously, I can fix dynamics ports and paths using SSDP. In fact it is the right way to do it. Yesterday I tried to execute SSDP in my LAN without success, and I thought all the H & J series would use same port, but your TV model break the rule.
So I'm going to have to work with SSDP and replace the getSmpPorts function that I did yesterday in no much time
I am concerned about that timeout. It is another problem that, if it exists, the SSDP will not solve it. I hope it is a mistake during hardcoding.
@RinoGaetano94 I have to ask you a little thing. Can you put the location address of your RenderingControl (http://:9197/dmr) in a browser? You should see XML content that I need to see it in a pastebin
Hi @sermayoral I'm still having issues, similar to this one. Here is my pastebin output https://pastebin.com/i9qRs7BJ
Hi @staraxis. Yes, watching your pastebin i see you have this problem.
I think it can be easily solved using SSDP :-)
@staraxis can you repeat the process with this URL? http://IP:PORT/RenderingControl_1.xml
@RinoGaetano94 I have to ask you a little thing. Can you put the location address of your RenderingControl (http://:9197/dmr) in a browser? You should see XML content that I need to see it in a pastebin
Sure! Here is it: https://pastebin.com/j2aKmAkG
And this is RenderingControl_1.xml: https://pastebin.com/Di3KVCym
I tried to create a SOAP call but it never works. If I call the services with the UPnP Analyser they works well, but I was not able to reproduce it. I can snif them with Wireshark if you need :)
Here's my RenderingControl @sermayoral https://pastebin.com/hTL8qZxj
Probably i will get the code ready in a couple of hour. I will upload it here for testing :-)
Here you are:
Feedbacks, please
Nice work, addresses and ports are correct now! :)
But the GetVolume/timeout problem is still there (issue #4) and it does not allow me to use the component properly. Another thing that I noticed is that evnf if I power off the TV (I'm using a broadlink mini 3) your component continue sending the GetVolume request, but maybe the problems are linked. Any ideas? Can I do something to help you?
If you want, do not close the issue and we can still investigate it :-)
Can you enable the debug log for this component and show it to me?
logger:
default: warning
logs:
custom_components.samsungtv_encrypted: debug
Try this one: samsungtv_encrypted.zip
If you want, do not close the issue and we can still investigate it :-)
Can you enable the debug log for this component and show it to me?
logger: default: warning logs: custom_components.samsungtv_encrypted: debug
Try this one: samsungtv_encrypted.zip
I already actived the log, and it repeatly print this:
DEBUG (SyncWorker_4) [custom_components.samsungtv_encrypted.media_player] Samsung TV sending: POST /upnp/control/RenderingControl1 HTTP/1.0
HOST: 192.168.178.26:9197
CONTENT-TYPE: text/xml;charset="utf-8"
SOAPACTION: "urn:schemas-upnp-org:service:RenderingControl:1#GetVolume"
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetVolume xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"><InstanceID>0</InstanceID><Channel>Master</Channel></u:GetVolume></s:Body></s:Envelope>
I think that the problem is related to the websocket, the line that generate the error is dataBuffer = client.recv(4096). It seems that the TV never responding. Maybe it didn't receive anything?
No changes with the new package that you tell me to try.
P.S.: I closed the issue because the getSmpPorts error was fixed. Now we are talking about another issue (#4) but if you prefer we can continue here.
@RinoGaetano94 I think #4 its different to this. In #4 getVolume works perfectly, but it close the TV channel guide. Here the getVolume call does not work.
Can I see more log after logs you have written. It should be a response or a timeout error
Try this with the log in debug: media_player_without_getvolume.zip
I have added a log in dataBuffer = client.recv(4096) and I deleted the getVolume call to see how it works with getSourceList
Another thing that I noticed is that evnf if I power off the TV (I'm using a broadlink mini 3) your component continue sending the GetVolume request
You are right. This is a bug!!
@RinoGaetano94 I think #4 its different to this. In #4 getVolume works perfectly, but it close the TV channel guide. Here the getVolume call does not work.
Can I see more log after logs you have written. It should be a response or a timeout error
It does not print any other logs, only the one repeatedly :/
Try this with the log in debug: media_player_without_getvolume.zip
I have added a log in dataBuffer = client.recv(4096) and I deleted the getVolume call to see how it works with getSourceList
This is what it print:
2020-03-27 00:58:42 DEBUG (SyncWorker_13) [custom_components.samsungtv_encrypted.media_player] Samsung TV sending: POST /MainTVServer2/control/MainTVAgent2 HTTP/1.0
HOST: 192.168.178.26:7677
CONTENT-TYPE: text/xml;charset="utf-8"
SOAPACTION: "urn:samsung.com:service:MainTVAgent2:1#GetSourceList"
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetSourceList xmlns:u="urn:samsung.com:service:MainTVAgent2:1"></u:GetSourceList></s:Body></s:Envelope>
2020-03-27 00:58:44 DEBUG (SyncWorker_13) [custom_components.samsungtv_encrypted.media_player] Error in SendSoap. Got timed out
I tried to make soap calls with python from my Windows PC (I have HA on Raspberry) to simulate the problem and I saw (as I told you before) that the error is generated by the recv method. If you want you can give me different types of test soap calls (python or curl) that I can try to launch to see if the TV responds. I tried to change some parameters, but I wasn't sure which ones to change.
@RinoGaetano94 yes, I know the error is in the recv method (i have undestand you first time :-) ), but I expected the log to be more accurate.
@RinoGaetano94 yes, I know the error is in the recv method (i have undestand you first time :-) ), but I expected the log to be more accurate.
Me too, but it doesn't say nothing :( Do you have any ideas?
I don't know how to invoke recv with other parameter. Its a SOAP call, it should work..
Let me thinking about it...
Maybe using requests? https://stackoverflow.com/questions/55530165/how-to-send-soap-request-by-python
Edit: If you don't understand anything, let me know :-)
Maybe using requests? https://stackoverflow.com/questions/55530165/how-to-send-soap-request-by-python
Maybe! I have to sleep now, I'll try tomorrow. If you want to write a little script implementing a test I appreciate it, I'm not good in python and it will take longer if I write it myself :/
I dont mind but i'm going to sleep as well. First with free time will do it :-)
By the way, this is the last version with the bug you have detected fixed. Update it and, please, everything you see let me know :-)
I have tried the various versions in this issue and still can't get the source select drop down to show up. Should I be doing anything differently in order to do this? I restart after updating the media_player.py
@staraxis does the get_volume function work for you?
Please, use the samsungtv_encrypted_202003270202.zip attached above, put the custom in debug mode:
logger:
default: warning
logs:
custom_components.samsungtv_encrypted: debug
And pastebin me all the logs
@sermayoral here is the output from the log https://pastebin.com/MgpNURpR
Thanks @staraxis. Same problem that @RinoGaetano94
We have to work on this to discover what happen. It must be a little thing we don't see...
@staraxis @RinoGaetano94 Today I'm using another computer, and testing this i got this error:
D:\T151602\Desktop>python upnp.py
Samsung TV sending: POST /smp_4_ HTTP/1.0
HOST: 192.168.1.32:7676
CONTENT-TYPE: text/xml;charset="utf-8"
SOAPACTION: "urn:samsung.com:service:MainTVAgent2:1#GetSourceList"
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetSourceList xmlns:u="urn:samsung.com:service:MainTVAgent2:1"></u:GetSourceList></s:Body></s:Envelope>
Error sending upnp soap request. Got timed out
Fortunately I were in front of the TV and saw a message asking me for permission. After accept it, i could send SOAP requests with success
In my TV there is a menu where you can see permission. It is in Menu >> Network >> Multimedia Device Setting:
Maybe its a clue of your errors... Can you investigate a little about this?
@staraxis @RinoGaetano94 Today I'm using another computer, and testing this i got this error:
D:\T151602\Desktop>python upnp.py Samsung TV sending: POST /smp_4_ HTTP/1.0 HOST: 192.168.1.32:7676 CONTENT-TYPE: text/xml;charset="utf-8" SOAPACTION: "urn:samsung.com:service:MainTVAgent2:1#GetSourceList" <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetSourceList xmlns:u="urn:samsung.com:service:MainTVAgent2:1"></u:GetSourceList></s:Body></s:Envelope> Error sending upnp soap request. Got timed out
Fortunately I were in front of the TV and saw a message asking me for permission. After accept it, i could send SOAP requests with success
In my TV there is a menu where you can see permission. It is in Menu >> Network >> Multimedia Device Setting:
Maybe its a clue of your errors... Can you investigate a little about this?
I found that menu, but in the list I have neither the raspberry nor my pc (but I have my notebook). We should understand how the association takes place, so that we can do it when connecting.
Were the TVs you tried with connected to the internet in wifi? Mine is connected with the cable, I don't know if something could change, but I don't think
My TV does not have wifi, so the last way to connect it to Internet is by cable.
Turn off the TV, wait 5 seconds, turn on the TV, launch the request and watch the TV because, in my case, it show you a windows asking for permission like this:
https://tecnologismo.com/wp-content/uploads/1cb9277170d0accd306bac390a62513f-1.jpg
In my case, the list with permission is a mobile phone, the raspberry, my desktop and now my new desktop :-)
Hello, had same issue with getting volume status. Error sending upnp soap request. Got timed out. Adding "Content-Length" field to POST request fixed it.
@kaustas thanks!!! I'm going to fix it
@RinoGaetano94 @staraxis can you test this version attached?
Hi @sermayoral here is my log: https://pastebin.com/kfjtzQQS I'm still getting UPNP errors it seems
@staraxis you are getting error in GetVolume method
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
<errorCode>501</errorCode>
<errorDescription>Action Failed</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
GetSourceList is responding:
<s:Body>
<u:GetSourceListResponse xmlns:u="urn:samsung.com:service:MainTVAgent2:1">
<Result>OK</Result>
<SourceList>
<?xml version="1.0" encoding="UTF-8" ?>
<SourceList>
<CurrentSourceType>HDMI1</CurrentSourceType>
<ID>13</ID>
</SourceList>
</SourceList>
</u:GetSourceListResponse>
</s:Body>
But I miss more information here...
Thanks @sermayoral I'm still not seeing a source_select drop down on the media player entity. Is there any further information you need?
@staraxis, Your getSourceList method is working in a strange way. As you can see in your last pastebin, or even in my above post, you get only the CurrentSourceType, but I need here all sourcelist. Here is my GetSourceList response: https://pastebin.com/BCWQ81JD
Can you inspect this operation (and similar ones) with UPNP Analyzer to see what happen?
Hi @sermayoral I have a J5500 and I am able to control the volume and mute, but not to power OFF the TV, I tried both versions (HDMI and normal). I can't either get a sourcelist nor control the volume by using the slider.
This is my http://samsungtvip:9197/DMR: https://pastebin.com/dmcxCp3X And this is my http://samsungtvip:9197/ConnectionManager_1.xml: https://pastebin.com/uvPLS0Yk
Please tell me if you need anything else, or if I can help with anything.
Thanks.
Good afternoon, I have similar problems like pablolassalle3, but I also noticed a bug in ha-samsungtv-encrypted (I tried the whole version). For example, if you open a menu or a USB / DLNA source or any other menu on a Samsung TV, then approximately every 5 seconds commands from HA will be sent to the TV KEY_DOWN or another (it will not be displayed in the log) which leads to the “Back” operation on the TV
Hi @sermayoral I have a J5500 and I am able to control the volume and mute, but not to power OFF the TV, I tried both versions (HDMI and normal). I can't either get a sourcelist nor control the volume by using the slider.
This is my http://samsungtvip:9197/DMR: https://pastebin.com/dmcxCp3X And this is my http://samsungtvip:9197/ConnectionManager_1.xml: https://pastebin.com/uvPLS0Yk
Please tell me if you need anything else, or if I can help with anything.
Thanks.
Please put the logs in debug for this custom and let me see it
logger:
default: warning
logs:
custom_components.samsungtv_encrypted: debug
Good afternoon, I have similar problems like pablolassalle3, but I also noticed a bug in ha-samsungtv-encrypted (I tried the whole version). For example, if you open a menu or a USB / DLNA source or any other menu on a Samsung TV, then approximately every 5 seconds commands from HA will be sent to the TV KEY_DOWN or another (it will not be displayed in the log) which leads to the “Back” operation on the TV
Ok, please use the #4 issue for working on this.
I thought it was the uPNP GetVolume method, but Ok we will see it in the right thread to work on this
Hi @sermayoral I have a J5500 and I am able to control the volume and mute, but not to power OFF the TV, I tried both versions (HDMI and normal). I can't either get a sourcelist nor control the volume by using the slider. This is my http://samsungtvip:9197/DMR: https://pastebin.com/dmcxCp3X And this is my http://samsungtvip:9197/ConnectionManager_1.xml: https://pastebin.com/uvPLS0Yk Please tell me if you need anything else, or if I can help with anything. Thanks.
Please put the logs in debug for this custom and let me see it
logger: default: warning logs: custom_components.samsungtv_encrypted: debug
Hi @sermayoral this is my log: home-assistant.log
Thanks
hi @sermayoral continuing from #15, I downloaded the samsungtv_encrypted_202003281229.zip, was about send you the logs, but while going through this thread, i checked the TV's network-> multimedia device settings, and my Home assistant IP was blocked!! Once I allowed access, the volume slider worked and sources are visible. Am willing to help in further testing if it would be of any help, though. thanks.
@photonforge great news. I'm going to release the new component :-)
@pablolassalle it is not searching for the uPNP assignment. Have you put logger in debug, right?
@pablolassalle it is not searching for the uPNP assignment. Have you put logger in debug, right?
Yes, I added these lines to my configuration.yaml:
logger:
default: warning
logs:
custom_components.samsungtv_encrypted: debug
Another strange behavior is the components stop working with apparently no reason, and I have to re pair my raspberry with the tv.
@pablolassalle it is not searching for the uPNP assignment. Have you put logger in debug, right?
@pablolassalle it is not searching for the uPNP assignment. Have you put logger in debug, right?
Yes, I added these lines to my configuration.yaml:
logger: default: warning logs: custom_components.samsungtv_encrypted: debug
Another strange behavior is the components stop working with apparently no reason, and I have to re pair my raspberry with the tv.
Hi @sermayoral, I updated the component to version 2.3, and now nothing is working, logger is showing the same error repeteadly.
Here is the log home-assistant.log
I intalled lxml library, but nothing happend, I also reinstalled bs4, but still nothing. Now I have downgraded again to a version 2.2, which is working (only for volume control).
I hope this can help you and others to improve the component.
@pablolassalle I know what happen to you. Are you using Hass.io? The 'lxml' library is missing.
@pablolassalle I know what happen to you. Are you using Hass.io? The 'lxml' library is missing.
@sermayoral, No, I am not usin Hass.io, I am using Home Assistant core 0.108.1, and as I told you, I manually installed lxml library on the venv but nothing changes, so I reinstalled bs4 but I still receive the same error message.
@pablolassalle Your log clearly says you need lxml:
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml
Try this attached version and tell us: ha-samsungtv-encrypted-2.3.1.zip
Hi,
I'm tring your component with a UE40JU4600K but this method cannot find my TV's services, because it uses port 9197 for the RenderingControl and a different path (http://:9197/dmr) and port 7677 with path http://:7677/MediaTVServer2. Can you handle this configuration? Thanks
EDIT: this is a correct GetVolume request sniffed with Wireshark
EDIT2: Even if I manually set te services path and port, the method SendSOAP fails. The line that generate error is dataBuffer = client.recv(4096), returning timed out