tavicu / homebridge-samsung-tizen

Homebridge plugin for Samsung TV's with Tizen OS
MIT License
648 stars 88 forks source link

UE48JU6400 not works #12

Closed goathers closed 6 years ago

goathers commented 6 years ago

Hi,

I'm trying to add this TV to Homebridge and I not be able to do it.

I read others issues and make some of the test you explain.

The config is (Mac is hide):

{ "platform": "SamsungTizen", "devices": [ { "name": "Tele", "ip": "192.168.0.21", "mac": "xx:xx:xx:xx:xx:xx" }] }

I run a ping to the TV ip and return this:

PING 192.168.0.21 (192.168.0.21): 56 data bytes
64 bytes from 192.168.0.21: icmp_seq=0 ttl=64 time=0.670 ms
--- 192.168.0.21 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.670/0.670/0.670/0.000 ms

I make some tests (with TV ON) and look at the homebridge log for errors, but only one line at log file.

When press ON [2018-8-28 18:28:35] [Tele] Power: TV powered ON

When press OFF [2018-8-28 18:29:05] [Tele] Power: TV is already OFF

I think the next is clear my doubt about if this model is compatible, before doing more tests.

I'm looking in the internet for confirm the OS on this model and I'm not sure if is Tizen or not. The interface looks like the screen you put in another issue.

Many thanks for your time.

tavicu commented 6 years ago

Hi,

Awesome to see that you made your homework :P

Try to access the following url when the TV is on: http://TV_IP:8001/api/v2/ It should return all TV information (https://developer.samsung.com/tv/develop/extension-libraries/smart-view-sdk/receiver-apps/debugging)

Let me know if that link works.

Also first time when you connect to the TV it will ask you to allow the connection.

"check in Settings - General - External Device Manager - Device List. Maybe you clicked Disallow."

tavicu commented 6 years ago

But looking at your TV model it is possible to not be compatible. i think it use an older version of Tizen which does not offer access to an API.

It should look like this: http://linuxgizmos.com/files/samsung_smarttv_hub2.jpg

goathers commented 6 years ago

This is the return of accessing the URL http://192.168.0.21:8001/api/v2/

uuids are hidden

{ "id": "uuid:xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "name": "[TV] UE48JU6400", "version": "2.0.25", "device": { "type": "Samsung SmartTV", "duid": "uuid:xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "model": "15_HAWKM_UHD_2D", "modelName": "UE48JU6400", "description": "Samsung DTV RCR", "networkType": "wired", "ssid": "", "ip": "192.168.0.21", "firmwareVersion": "Unknown", "name": "[TV] UE48JU6400", "id": "uuid:xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "udn": "uuid:xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "resolution": "1920x1080", "countryCode": "ES", "msfVersion": "2.0.25", "smartHubAgreement": "true", "wifiMac": "fc:f1:36:03:b8:c1", "developerMode": "0", "developerIP": "" }, "type": "Samsung SmartTV", "uri": "http://192.168.0.21:8001/api/v2/" }

I don't find the External Device Manager menu in settings, so it's possible that is not compatible.

I find this page in samsung developer web:

Samsung TV Models Group

My model platform is Tizen 2.3

Smart hub is different to the image you link. Is like this: https://www.digitbin.com/content/uploads/Samsung-Smart-TV-Apps.jpg

Do you know if this version of Tizen is compatible with your plugin?

tavicu commented 6 years ago

Hei!

It should works with your version of Tizen.

What does not work? Powering ON or OFF? Both?

tavicu commented 6 years ago

Can you try this and see if it works?

https://github.com/tdudek/samsung-remote-models-2014-and-newer

Run the demo

goathers commented 6 years ago

Hi,

The TV not work on power ON, OFF or any other command. I try put the TV on developer mode following the instructions on this page you told me (https://developer.samsung.com/tv/develop/extension-libraries/smart-view-sdk/receiver-apps/debugging) but the page received in the computer is Not Found.

On the other side, I run the demo on your last comment and it works. The TV show a popup with a pin number that I have to put on the test webpage.

When I try your plugin nothing is show on TV.

Are there any way to write more detailed logs in your plugin?

Many thanks again.

kkapitan commented 6 years ago

Hi,

I've also encountered similar issues with my H series Samsung TV. After some research I ended up with exactly the same demo @tavicu posted above. Since this one was working fine for me, I started developing my own homebridge plugin, which currently is in a very raw form but seems to be working. If there is no way to use this plugin with the H/J models, I'll post my work so people like me or @goathers can benefit. But if this plugin is somehow capable of controlling those models I'll be happy to use it instead.

tavicu commented 6 years ago

Hey guys!

First of all thanks for checking that plugin!

This weekend i will try and see if the PIN method works on newer models too!

After that i will implement in the plugin this method so you can use it too!

I will keep you posted! I will try to do it faster but unfortunately I don’t think i will be able to check it early than this weekend :(

tavicu commented 6 years ago

Can you tell me what this prints? http://${this.config.ip}:8001/ms/1.0/

dwienand commented 6 years ago

Hi, I've been trying to set up my Samsung TV (Model#: UN60J620DAF) with Homebridge this weekend as well to no avail =(

I can ping the TV but http://TV_IP:8001/api/v2/ doesnt work.

I did a port scan Port Scanning host: 192.168.86.220

 Open TCP Port:     7011        talon-disc
 Open TCP Port:     7676        imqbrokerd
 Open TCP Port:     8080        http-alt

Port Scan has completed…

curl http://192.168.86.220:8080/ -> 404 curl http://192.168.86.220:8080/anythingelse -> 403

I'm guessing that means the TV doesn't support the API? I bought it last year so I assumed it would work. Any way to verify whether it's not supported or I'm just doing something completely wrong? This should be the model page https://www.samsung.com/us/televisions-home-theater/tvs/full-hd-tvs/led-j620d-series-smart-tv-60-class-60-0-diag-un60j620dafxza/

tavicu commented 6 years ago

Hei @dwienand, as i asked in a previous post, try this plugin demo and tell me if it’s working to send commands.

https://github.com/tdudek/samsung-remote-models-2014-and-newer

P.s! It’s not a homebridge plugin. You need to clone the repo and follow the instructions from the readme to run the example!

goathers commented 6 years ago

Hi,

The return of accessing the URL http://192.168.0.21:8001/ms/1.0/

The uuids have been hidden

{ "DUID": "uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "Model": "15_HAWKM_UHD_2D", "ModelName": "UE48JU6400", "ModelDescription": "Samsung DTV RCR", "NetworkType": "wired", "SSID": "", "IP": "192.168.0.21", "FirmwareVersion": "Unknown", "DeviceName": "[TV] UE48JU6400", "DeviceID": "uuid:xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "UDN": "uuid:xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "Resolution": "1920x1080", "CountryCode": "ES", "SmartHubAgreement": "true", "ServiceURI": "http://192.168.0.21:8001/ms/1.0/", "DialURI": "http://192.168.0.21:8001/ws/apps/", "Capabilities": [ { "name": "samsung:multiscreen:1", "port": "8001", "location": "/ms/1.0/" } ] }

tavicu commented 6 years ago

@kkapitan can you also tell me what http://${this.config.ip}:8001/ms/1.0/ returns? Since i don't have an older version of TV to work with i'm trying to understand the pattern :d

boro55 commented 6 years ago

Hi there,

I have the same issue as guys above but with UE48JU7000. I installed the plugin but none of the commands work.

Btw. I run the demo from https://github.com/tdudek/samsung-remote-models-2014-and-newer and it works just fine.

dwienand commented 6 years ago

Getting Server running at: http://localhost:3000 Initializing device configuration Fetching device info Debug: internal, implementation, error TypeError: Cannot read property 'requestPin' of null at SamsungTv.requestPin

which I think means that it can't connect to the TV in the first place =/

tavicu commented 6 years ago

@dwienand Your TV is not running Tizen OS for Smart TV. None of the plugins are compatible with your TV because it doesn't have an API to access.

@goathers, @kkapitan, @boro55 I will develop a small plugin to work with PIN access and I will need some help from one of you to test it :) If it will work then i will implement it in the main plugin.

Sounds cool? :)

goathers commented 6 years ago

Yeah!!

I run the tests that are needed.

boro55 commented 6 years ago

Thanks @tavicu :) Just ping me if you need one more tester.

tavicu commented 6 years ago

@goathers, @boro55

Steps:

  1. Create a folder to run the test mkdir /var/lib/test-repo
  2. Go to folder cd /var/lib/test-repo
  3. Clone repo git clone git@github.com:tavicu/test-samsung-tv-pin.git
  4. Enter folder cd test-samsung-tv-pin
  5. Edit config.json and enter your tv ip vim/node config.json
  6. Install npm packages npm install
  7. Run the script node index.js
  8. TV should show you the PIN, write it in config.json
  9. Run the script again node index.js
  10. It should send 3 commands to VOLUP

Tell me if it works and show me the log :)

kkapitan commented 6 years ago

Hi guys, sorry for the late response.

I decided to challenge myself and finish the plugin - you can get it here.

I'm not dealing with js on a daily basis, in fact this is my first published npm package, so please bare with me ;)

@tavicu feel free to check the specifics of implementation as I had the opportunity to test it using my personal device. And again thanks for the plugin, it really helped me kickstart the work :) As for the demo it works for me, however only one VOLUP command is performed by the TV (I guess there was no delay between the sent commands).

boro55 commented 6 years ago

@tavicu I run your script, TV showed the PIN but after I wrote it in config.json and tried to run the script again I get this error (the uuids have been hidden):

Initializing device configuration Fetching device info Received device info Device info: { id: ‚uuid:xxxxx-xxxxx-xxxxx-xxxxx-xxxxx’, name: ‚[TV] UE48JU7000’ } Initialization successful { id: ‚xxxxx-xxxxx-xxxxx-xxxxx-xxxxx’, name: ‚[TV] UE48JU7000’ } Confirming pin 7182 Step 1: Saying hello to the server Generated serverHello 010200000000000000008A000000063635343332310EAF6F2CAA39EF547C9177792321C35D53509460B7423C010CD01D7F8A05A8CAD91F8CB881A3662FCD817ADCD664F683261CAC7BE5E49BA2B20B12CBC39917B7700B3C1507DF75E9E2434B7ABDFB6BF23EDE2478AC69879BEFC81F49E7DC7438E74C1CCE4CCF236AAA9EEEC1074C1EE3E1592747FECCD050C6959A299CC1451F0000000000 hello auth data { auth_type: ‚SPC’, request_id: ‚3’, GeneratorClientHello: ‚010100000000000000009E00000006363534333231A4375B963574872CFB9552DAAA344D86B29BC1C74649A7C5B5E34280CB6D7813BE35C4D4B1E687FC49A08030BAB3D949A4BC4DA4E23B16C2F0AF86AAC6CA946B8FF4B9F01C92079EE60F7D8DBC9DE817AD4515DB64DC1EBFBF773A4375870D699BBDD5FE50BC772A2CABF66AB54378E7F01463D28AAF2CBE309BED8B848E5C95CB431BD3FAFE3379E79FEC3807616C9C7F2544F70000000000’ } DEBUG error Invalid PIN Entered (node:25923) UnhandledPromiseRejectionWarning: Error: Invalid PIN entered at _verifyHelloAuthData (/var/lib/test-repo/test-samsung-tv-pin-master/lib/Pairing/SamsungTvPairing.js:87:11) at fetch.then.then.then.authData (/var/lib/test-repo/test-samsung-tv-pin-master/lib/Pairing/SamsungTvPairing.js:46:23) at at process._tickCallback (internal/process/next_tick.js:188:7) (node:25923) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:25923) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

goathers commented 6 years ago

Hi,

Sorry for the delay. I was out on weekend.

In my case the test works. The plugin sends 3 VOLUP, but the TV only UP 2. Like @kkapitan I think the cause is because no delay between commands.

kkapitan commented 6 years ago

@goathers @boro55 would you be so kind to try my plugin here? I'm wondering if it works on J series models as I do not have one to test it myself. In best case you should be able to connect to the TV and send basic key commands.

boro55 commented 6 years ago

@kkapitan I successfully installed your plugin and got to the point where PIN is displayed on my TV but I'm getting an error after entering the PIN, therefore I can't get the sessionId and the aesKey

homesung-pair 192.168.100.2 Enter the pin displayed on the TV screen: 3235 Confirming pin with config: {"ip":"192.168.100.2","appId":"721b6fce-4ee6-48ba-8045-955a539edadb","userId":"654321","deviceId":"uuid:xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"} and pin: 3235 Sending server hello 010200000000000000008A00000006363534333231B3C8BD874B8FBCFA6800DCA04B4148B0CD7E3A98F409C1ADE3D8AB48E382A76C5F680774CB007F5F1B847530FE7F554131280C7ABF9E034545085A55DB9F75135DBC7CA76952BCF4DF1A9420892100A39DFA5BFB333C03F61DEB3880052E4C571E1D29A926F61FDA4456252C1F15F84DC2312569C02A8A42DE3689CA068505970000000000 Received server hello Unable to pair: Unexpected end of JSON input


@tavicu There was mistake on my end, I run your test script again and it did work with the same results as @goathers mentioned

kkapitan commented 6 years ago

@boro55 thank you for trying! It seems that J series models are sending something that my pairing code did not expect. Can you run the pairing command again like NODE_DEBUG=request homesung-pair <your_ip> and then paste me the logs? It would provide me additional info to fix this.

boro55 commented 6 years ago

@kkapitan Here's the log:

NODE_DEBUG=request homesung-pair 192.168.100.2 REQUEST { url: '/ms/1.0/', timeout: 5000, baseUrl: 'http://192.168.100.2:8001', callback: [Function] } REQUEST make request http://192.168.100.2:8001/ms/1.0/ REQUEST onRequestResponse http://192.168.100.2:8001/ms/1.0/ 200 { 'x-powered-by': 'Express', 'access-control-allow-origin': '', 'access-control-allow-credentials': 'true', 'access-control-allow-methods': 'GET,PUT,POST,DELETE', 'access-control-allow-headers': 'Origin, X-Requested-With, Content-Type, Accept, SilentLaunch', 'content-type': 'application/json; charset=utf-8', 'content-length': '713', date: 'Wed, 12 Sep 2018 07:11:47 GMT', connection: 'close' } REQUEST reading response's body REQUEST finish init function http://192.168.100.2:8001/ms/1.0/ REQUEST response end http://192.168.100.2:8001/ms/1.0/ 200 { 'x-powered-by': 'Express', 'access-control-allow-origin': '', 'access-control-allow-credentials': 'true', 'access-control-allow-methods': 'GET,PUT,POST,DELETE', 'access-control-allow-headers': 'Origin, X-Requested-With, Content-Type, Accept, SilentLaunch', 'content-type': 'application/json; charset=utf-8', 'content-length': '713', date: 'Wed, 12 Sep 2018 07:11:47 GMT', connection: 'close' } REQUEST end event http://192.168.100.2:8001/ms/1.0/ REQUEST has body http://192.168.100.2:8001/ms/1.0/ 713 REQUEST emitting complete http://192.168.100.2:8001/ms/1.0/ REQUEST { url: '/ws/apps/CloudPINPage', method: 'POST', baseUrl: 'http://192.168.100.2:8080', callback: [Function] } REQUEST make request http://192.168.100.2:8080/ws/apps/CloudPINPage REQUEST onRequestResponse http://192.168.100.2:8080/ws/apps/CloudPINPage 201 { 'api-version': 'v1.00', 'content-type': 'text/html', location: 'http:///ws/apps/CloudPINPage/run', connection: 'close', 'transfer-encoding': 'chunked', date: 'Wed, 12 Sep 2018 07:11:47 GMT', server: 'WebServer' } REQUEST reading response's body REQUEST finish init function http://192.168.100.2:8080/ws/apps/CloudPINPage REQUEST response end http://192.168.100.2:8080/ws/apps/CloudPINPage 201 { 'api-version': 'v1.00', 'content-type': 'text/html', location: 'http:///ws/apps/CloudPINPage/run', connection: 'close', 'transfer-encoding': 'chunked', date: 'Wed, 12 Sep 2018 07:11:47 GMT', server: 'WebServer' } REQUEST end event http://192.168.100.2:8080/ws/apps/CloudPINPage REQUEST has body http://192.168.100.2:8080/ws/apps/CloudPINPage 32 REQUEST emitting complete http://192.168.100.2:8080/ws/apps/CloudPINPage REQUEST { url: '/ws/pairing', qs: { step: 0, app_id: '721b6fce-4ee6-48ba-8045-955a539edadb', device_id: 'uuid:xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx', type: 1 }, baseUrl: 'http://192.168.100.2:8080', callback: [Function] } REQUEST make request http://192.168.100.2:8080/ws/pairing?step=0&app_id=721b6fce-4ee6-48ba-8045-955a539edadb&device_id=uuid:xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx&type=1 REQUEST onRequestResponse http://192.168.100.2:8080/ws/pairing?step=0&app_id=721b6fce-4ee6-48ba-8045-955a539edadb&device_id=uuid:xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx&type=1 200 { 'content-length': '0', connection: 'close', date: 'Wed, 12 Sep 2018 07:11:47 GMT', server: 'WebServer' } REQUEST reading response's body REQUEST finish init function http://192.168.100.2:8080/ws/pairing?step=0&app_id=721b6fce-4ee6-48ba-8045-955a539edadb&device_id=uuid:xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx&type=1 REQUEST response end http://192.168.100.2:8080/ws/pairing?step=0&app_id=721b6fce-4ee6-48ba-8045-955a539edadb&device_id=uuid:xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx&type=1 200 { 'content-length': '0', connection: 'close', date: 'Wed, 12 Sep 2018 07:11:47 GMT', server: 'WebServer' } REQUEST end event http://192.168.100.2:8080/ws/pairing?step=0&app_id=721b6fce-4ee6-48ba-8045-955a539edadb&device_id=uuid:xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx&type=1 REQUEST emitting complete http://192.168.100.2:8080/ws/pairing?step=0&app_id=721b6fce-4ee6-48ba-8045-955a539edadb&device_id=uuid:xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx&type=1 Enter the pin displayed on the TV screen: 2979 Confirming pin with config: {"ip":"192.168.100.2","appId":"721b6fce-4ee6-48ba-8045-955a539edadb","userId":"654321","deviceId":"uuid:xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx"} and pin: 2979 Sending server hello 010200000000000000008A00000006363534333231DD44E39EF25A054DFE6B0E029023C54B98A628ABD61B0FC78EB186F8E92CE600029C50635D1A338FA0075D8EC7209FBD5A17BDA95B5C2DE8596213755B979BE2CE2122F428FDC5A69D8E5BD7DD4AD612E1B0F508AAB7025ACD8CEDD9315976BB2D0F8278FA73455BA7E38BD3D02409CD573F9BADA884BA33ACB1669C9B829E330000000000 REQUEST { url: '/ws/pairing', qs: { step: 1, app_id: '721b6fce-4ee6-48ba-8045-955a539edadb', device_id: 'uuid:xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx' }, method: 'POST', body: '{"auth_Data":{"auth_type":"SPC","GeneratorServerHello":"010200000000000000008A00000006363534333231DD44E39EF25A054DFE6B0E029023C54B98A628ABD61B0FC78EB186F8E92CE600029C50635D1A338FA0075D8EC7209FBD5A17BDA95B5C2DE8596213755B979BE2CE2122F428FDC5A69D8E5BD7DD4AD612E1B0F508AAB7025ACD8CEDD9315976BB2D0F8278FA73455BA7E38BD3D02409CD573F9BADA884BA33ACB1669C9B829E330000000000"}}', headers: { 'Content-Type': 'application/json' }, baseUrl: 'http://192.168.100.2:8080', callback: [Function] } REQUEST make request http://192.168.100.2:8080/ws/pairing?step=1&app_id=721b6fce-4ee6-48ba-8045-955a539edadb&device_id=uuid:xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx REQUEST onRequestResponse http://192.168.100.2:8080/ws/pairing?step=1&app_id=721b6fce-4ee6-48ba-8045-955a539edadb&device_id=uuid:xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx 200 { 'content-length': '0', connection: 'close', date: 'Wed, 12 Sep 2018 07:12:02 GMT', server: 'WebServer' } REQUEST reading response's body REQUEST finish init function http://192.168.100.2:8080/ws/pairing?step=1&app_id=721b6fce-4ee6-48ba-8045-955a539edadb&device_id=uuid:xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx REQUEST response end http://192.168.100.2:8080/ws/pairing?step=1&app_id=721b6fce-4ee6-48ba-8045-955a539edadb&device_id=uuid:xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx 200 { 'content-length': '0', connection: 'close', date: 'Wed, 12 Sep 2018 07:12:02 GMT', server: 'WebServer' } REQUEST end event http://192.168.100.2:8080/ws/pairing?step=1&app_id=721b6fce-4ee6-48ba-8045-955a539edadb&device_id=uuid:xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx REQUEST emitting complete http://192.168.100.2:8080/ws/pairing?step=1&app_id=721b6fce-4ee6-48ba-8045-955a539edadb&device_id=uuid:xxxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxxxx Received server hello Unable to pair: Unexpected end of JSON input

tavicu commented 6 years ago

Hi guys! Looks like this Issue become support for another plugin :)

Without disrespect i will ask you to continue the conversation on @kkapitan repo.

As soon as i will have the time i will implement in the plugin the method to access the TV with a PIN. When i will have a beta version i will open a new Issue and if you will still be interested i will ask you to help me test it since i can't.

kkapitan commented 6 years ago

You are right, sorry! I've made an issue to track this, my apologies!

jonasman commented 2 years ago

Hi @tavicu did you eventually finish the plugin? docs say no

tavicu commented 2 years ago

Hi @tavicu did you eventually finish the plugin? docs say no

Hi @jonasman, this issue is very old. This plugin is not and will not support the older API which uses a PIN method.