Skip to content
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

Does not request permission to access Samsung SmartTV J series #32

Closed
wants to merge 38 commits into from

Conversation

sacredx72
Copy link

Good afternoon, I just can't beat the problem with the integration of Samsung SmartTV
UE48J6300

`http://192.168.169.9:8001/api/v2/
{
  "id": "uuid:f09f5ade-7f97-460f-b79d-32e19bbc4d87",
  "name": "[TV] Small room",
  "version": "2.0.25",
  "device": {
    "type": "Samsung SmartTV",
    "duid": "uuid:f09f5ade-7f97-460f-b79d-32e19bbc4d87",
    "model": "15_HAWKM_2D",
    "modelName": "UE48J6300",
    "description": "Samsung DTV RCR",
    "networkType": "wired",
    "ssid": "",
    "ip": "192.168.169.9",
    "firmwareVersion": "Unknown",
    "name": "[TV] Small room",
    "id": "uuid:f09f5ade-7f97-460f-b79d-32e19bbc4d87",
    "udn": "uuid:f09f5ade-7f97-460f-b79d-32e19bbc4d87",
    "resolution": "1920x1080",
    "countryCode": "RU",
    "msfVersion": "2.0.25",
    "smartHubAgreement": "true",
    "wifiMac": "f8:77:b8:df:06:e1",
    "developerMode": "0",
    "developerIP": ""
  },
  "type": "Samsung SmartTV",
  "uri": "http://192.168.169.9:8001/api/v2/"
}`

Nmap 7.80

`Starting Nmap 7.80 ( https://nmap.org ) at 2020-01-12 12:41 RTZ 4 (ceia)

NSE: Loaded 151 scripts for scanning.

NSE: Script Pre-scanning.

Initiating NSE at 12:41

Completed NSE at 12:41, 0.00s elapsed

Initiating NSE at 12:41

Completed NSE at 12:41, 0.00s elapsed

Initiating NSE at 12:41

Completed NSE at 12:41, 0.00s elapsed

Initiating ARP Ping Scan at 12:41

Scanning 192.168.169.9 [1 port]

Completed ARP Ping Scan at 12:41, 0.46s elapsed (1 total hosts)

Initiating Parallel DNS resolution of 1 host. at 12:41

Completed Parallel DNS resolution of 1 host. at 12:41, 0.00s elapsed

Initiating SYN Stealth Scan at 12:41

Scanning 192.168.169.9 [1000 ports]

Discovered open port 8080/tcp on 192.168.169.9

Discovered open port 7676/tcp on 192.168.169.9

Discovered open port 8002/tcp on 192.168.169.9

Discovered open port 9999/tcp on 192.168.169.9

Discovered open port 9090/tcp on 192.168.169.9

Discovered open port 8001/tcp on 192.168.169.9

Discovered open port 8000/tcp on 192.168.169.9

Completed SYN Stealth Scan at 12:41, 0.17s elapsed (1000 total ports)

Initiating Service scan at 12:41

Scanning 7 services on 192.168.169.9

Completed Service scan at 12:42, 44.83s elapsed (7 services on 1 host)

Initiating OS detection (try #1) against 192.168.169.9

NSE: Script scanning 192.168.169.9.

Initiating NSE at 12:42

Completed NSE at 12:42, 11.03s elapsed

Initiating NSE at 12:42

Completed NSE at 12:42, 0.38s elapsed

Initiating NSE at 12:42

Completed NSE at 12:42, 0.00s elapsed

Nmap scan report for 192.168.169.9

Host is up (0.0012s latency).

Not shown: 993 closed ports

PORT     STATE SERVICE  VERSION

7676/tcp open  upnp     Samsung AllShare upnpd 1.0 (UPnP 1.1)

8000/tcp open  http-alt

| fingerprint-strings: 

|   FourOhFourRequest, GetRequest, HTTPOptions: 

|     HTTP/1.1 500 Internal Server Error

|     Content-Type: text/plain

|     Date: Sun, 12 Jan 2020 07:41:59 GMT

|_    Connection: close

|_http-cors: GET POST PUT DELETE OPTIONS

|_http-favicon: Unknown favicon MD5: 33E3EA7FC9C08D2E72730482906A676C

| http-methods: 

|_  Supported Methods: GET HEAD POST OPTIONS

|_http-open-proxy: Proxy might be redirecting requests

|_http-title: Site doesn't have a title.

8001/tcp open  http     Tizen Multiscreen SDK httpd

|_http-cors: GET POST PUT DELETE

| http-methods: 

|_  Supported Methods: GET HEAD POST OPTIONS

|_http-title: 404 : Not Found

8002/tcp open  ssl/http Tizen Multiscreen SDK httpd

|_http-cors: POST PUT DELETE

| http-methods: 

|_  Supported Methods: GET HEAD POST OPTIONS

|_http-title: 404 : Not Found

| ssl-cert: Subject: commonName=SmartViewSDK/organizationName=SmartViewSDK/countryName=KR

| Subject Alternative Name: DNS:127.0.0.1, DNS:localhost

| Issuer: commonName=SmartViewSDK Root Ceritificate Authority/organizationName=SmartViewSDK/countryName=KR

| Public Key type: rsa

| Public Key bits: 2048

| Signature Algorithm: sha256WithRSAEncryption

| Not valid before: 2016-07-29T05:34:23

| Not valid after:  2036-07-29T05:34:23

| MD5:   189b 2634 fcca f1ef 31e1 7b7b 02ac c5bd

|_SHA-1: b15e 72c0 04b4 3825 651e e7a7 2b66 1856 305d e56b

|_ssl-date: TLS randomness does not represent time

| tls-nextprotoneg: 

|   http/1.1

|_  http/1.0

8080/tcp open  http     lighttpd

| http-methods: 

|_  Supported Methods: OPTIONS GET HEAD POST

|_http-server-header: WebServer

|_http-title: 404 - Not Found

9090/tcp open  http     Samsung UE55D7000 TV http config

|_http-favicon: Unknown favicon MD5: D41D8CD98F00B204E9800998ECF8427E

| http-methods: 

|_  Supported Methods: GET HEAD POST OPTIONS

|_http-title: Site doesn't have a title (application/octet-stream).

9999/tcp open  abyss?

1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :

SF-Port8000-TCP:V=7.80%I=7%D=1/12%Time=5E1ACDCD%P=i686-pc-windows-windows%

SF:r(GetRequest,78,"HTTP/1\.1\x20500\x20Internal\x20Server\x20Error\r\nCon

SF:tent-Type:\x20text/plain\r\nDate:\x20Sun,\x2012\x20Jan\x202020\x2007:41

SF::59\x20GMT\r\nConnection:\x20close\r\n\r\n")%r(FourOhFourRequest,78,"HT

SF:TP/1\.1\x20500\x20Internal\x20Server\x20Error\r\nContent-Type:\x20text/

SF:plain\r\nDate:\x20Sun,\x2012\x20Jan\x202020\x2007:41:59\x20GMT\r\nConne

SF:ction:\x20close\r\n\r\n")%r(HTTPOptions,78,"HTTP/1\.1\x20500\x20Interna

SF:l\x20Server\x20Error\r\nContent-Type:\x20text/plain\r\nDate:\x20Sun,\x2

SF:012\x20Jan\x202020\x2007:41:59\x20GMT\r\nConnection:\x20close\r\n\r\n");

MAC Address: F8:77:B8:DF:06:E1 (Samsung Electronics)

Device type: general purpose

Running: Linux 3.X

OS CPE: cpe:/o:linux:linux_kernel:3

OS details: Linux 3.2 - 3.10, Linux 3.2 - 3.16

Uptime guess: 1.491 days (since Sat Jan 11 00:55:22 2020)

Network Distance: 1 hop

TCP Sequence Prediction: Difficulty=260 (Good luck!)

IP ID Sequence Generation: All zeros

Service Info: Device: media device; CPE: cpe:/h:samsung:ue55d7000



TRACEROUTE

HOP RTT     ADDRESS

1   1.23 ms 192.168.169.9



NSE: Script Post-scanning.

Initiating NSE at 12:42

Completed NSE at 12:42, 0.00s elapsed

Initiating NSE at 12:42

Completed NSE at 12:42, 0.00s elapsed

Initiating NSE at 12:42

Completed NSE at 12:42, 0.00s elapsed

Read data files from: C:\Program Files (x86)\Nmap

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .

Nmap done: 1 IP address (1 host up) scanned in 61.86 seconds

           Raw packets sent: 1023 (45.806KB) | Rcvd: 1020 (41.635KB)`

I used various costume components of various authors xchwarze / ha-samsungtv-custom, roberodin ha-samsungtv-custom, jaruba ha-samsungtv-custom. The result is one, only the actual status of the TV is displayed On / Off, but there is no control! Everything works only through port 8001. When using port 8002 in LOG


Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/websocket/_socket.py", line 81, in recv
    bytes_ = sock.recv(bufsize)
  File "/usr/local/lib/python3.7/ssl.py", line 1056, in recv
    return self.read(buflen)
  File "/usr/local/lib/python3.7/ssl.py", line 931, in read
    return self._sslobj.read(len)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 407, in _async_add_entity
    await entity.async_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 795, in state_attributes
    for attr in ATTR_TO_PROPERTY
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 796, in <dictcomp>
    if getattr(self, attr) is not None
  File "/config/custom_components/samsungtv_custom/media_player.py", line 286, in source_list
    self._gen_installed_app_list()
  File "/config/custom_components/samsungtv_custom/media_player.py", line 248, in _gen_installed_app_list
    app_list = self._remote.app_list()
  File "/usr/local/lib/python3.7/site-packages/samsungtvws/remote.py", line 175, in app_list
    self._ws_send(payload)
  File "/usr/local/lib/python3.7/site-packages/samsungtvws/remote.py", line 89, in _ws_send
    self.open()
  File "/usr/local/lib/python3.7/site-packages/samsungtvws/remote.py", line 104, in open
    sslopt=sslopt
  File "/usr/local/lib/python3.7/site-packages/websocket/_core.py", line 511, in create_connection
    websock.connect(url, **options)
  File "/usr/local/lib/python3.7/site-packages/websocket/_core.py", line 223, in connect
    self.handshake_response = handshake(self.sock, *addrs, **options)
  File "/usr/local/lib/python3.7/site-packages/websocket/_handshake.py", line 79, in handshake
    status, resp = _get_resp_headers(sock)
  File "/usr/local/lib/python3.7/site-packages/websocket/_handshake.py", line 150, in _get_resp_headers
    status, resp_headers, status_message = read_headers(sock)
  File "/usr/local/lib/python3.7/site-packages/websocket/_http.py", line 298, in read_headers
    line = recv_line(sock)
  File "/usr/local/lib/python3.7/site-packages/websocket/_socket.py", line 102, in recv_line
    c = recv(sock, 1)
  File "/usr/local/lib/python3.7/site-packages/websocket/_socket.py", line 84, in recv
    raise WebSocketTimeoutException(message)
websocket._exceptions.WebSocketTimeoutException: The read operation timed out

On costume components of the author xchwarze, the token-192.178.189.9.txt file is created in the folder, but it is empty! The TV does not issue a request for granting access to work with HA on any component, I think this is the main problem, but how to send a request for granting access if nothing happens when you click on the Sound, Channel, Source buttons (

P.s

I also checked on which port the standard Samsung TV Android application accesses via TV via Wireshark. Handling and control occurs via port 8001 with a token request on the TV screen

P.s.s
I also tried to conduct test requests to my TV via the method described in the blog kdschlosser/samsungctl.
Through the launch of RUN_ME.py in the developer’s release, HA connects to the TV and makes a request to the TV to access it, but the kdschlosser / samsungctl component has not been updated for a long time and cannot be used as a custom one (

xchwarze and others added 8 commits February 5, 2020 02:06
 - Added additional validation for "channel-sub_channel" syntax.
 - Updated error feedback accordingly.
use last version of samsungtvws
@roberodin
Copy link
Owner

roberodin commented Jun 26, 2020

Hello,

Sorry, now I don't have much time to do this, please feel free to update what you want, I have sent you a full invitation.

@xchwarze
@sacredx72
@kdschlosser

Thank you all!

@roberodin roberodin closed this Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants