homebridge-samsungtv-control2 icon indicating copy to clipboard operation
homebridge-samsungtv-control2 copied to clipboard

Unable to get USN / UUID

Open PrimaryInc opened this issue 3 years ago • 27 comments

Hi @mmende,

Thanks for creating plugin. Nice job 👍 I did get the pair1 to work and i have token. But I'm not able to get the USN / UUID, it is not presentet in the logs.

Plugin loads: Samsung01

Pair works: Samsung02

But no USN / UUID in logs.

Any pointers?

PrimaryInc avatar Sep 01 '20 11:09 PrimaryInc

Nice to hear that pairing worked at least. Can you tell me the model number of your tv? It might not be covered by my model parser function yet.

mmende avatar Sep 01 '20 12:09 mmende

Hi @mmende,

Thanks for getting back to me so quick 👍 Modell is UE65HU7505 I think it is a 2014 model.

PrimaryInc avatar Sep 01 '20 12:09 PrimaryInc

Hi @mmende ,

Another thing that would be great where to get the config posibillity to add condifg via the Home Bridge WEB UI: If you want your plugin to show a config UI editor in the plugin homebridge-config-ui-x, you can add a file config.schema.json to the root of your plugin.

The specifications of that JSON schema are detailed in https://github.com/oznu/homebridge-config-ui-x/wiki/Developers:-Plugin-Settings-GUI

It's def not a mandatory thing to have in your plugin, but it helps many users that use that UI homebridge plugin to maintain their installation and don't want to mess up with JSON editing 😉

PrimaryInc avatar Sep 02 '20 06:09 PrimaryInc

Ok the model number can be parsed and the tv is from 2014 (npx homebridge-samsungtv-control model UE65HU7505). Therefore the discovery seems to have problems discovering your tv. Can you try a manual discovery by running npx homebridge-samsungtv-control discover (note that this doesn't add the tv to homebridge but rather exists for debugging purposes...)

I already added a basic json schema but renamed it to _config.schema.json for now because you would have to wait for the device discovery anyway and I thought it might be more confusing to be confronted with the ui when you can't really add any configuration before knowing the parameters. However you could theoretically run the manual discovery before and acquire the usn's etc. before now. It might be a good idea to add it back and add some documentation for this way of setting it up. The json editing is also a good argument for doing so.

mmende avatar Sep 02 '20 07:09 mmende

Hi @mmende,

I suggest a "good" instruction in web ui about steps needed to fill config page. Or perhaps a "button/link to press in the UI to perform discovery? Might not be that easy to configure. Someone is bound to do it wrong anyways, but you know :)

Debugg info: C:\Windows\System32>npx homebridge-samsungtv-control discover Searching for devices... (node:3120) UnhandledPromiseRejectionWarning: HTTPError: Response code 404 (Not Found) at EventEmitter. (C:\Users\kenneth\AppData\Roaming\npm\node_modules\homebridge-samsungtv-control\node_modules\got\dist\source\as-promise.js:118:31) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:3120) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:3120) [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. (node:3120) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1) (node:3120) UnhandledPromiseRejectionWarning: HTTPError: Response code 404 (Not Found) at EventEmitter. (C:\Users\kenneth\AppData\Roaming\npm\node_modules\homebridge-samsungtv-control\node_modules\got\dist\source\as-promise.js:118:31) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:3120) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

C:\Windows\System32>

PrimaryInc avatar Sep 02 '20 07:09 PrimaryInc

Hm, seems to be the same error as in #23 ... I will have to figure out a way to reproduce this problem.

Concerning config ui: I don't know if it is possible to add buttons with interactions within config ui but this would probably be the nicest solution.

mmende avatar Sep 02 '20 07:09 mmende

Hi @mmende, I tried to use http to se if my TV actually respondet to something: This is http://IP:8001 Samsung03

Samsung04

Is it a setting that might need to be enabled on the TV to get a response?

PrimaryInc avatar Sep 02 '20 07:09 PrimaryInc

Ah if I use the whole string api/v2/ i get alot of information from the TV: Samsung05

Is the ID the same as USN / UUID?

Where is the _config.schema.json located? It would not mind trying it out.

PrimaryInc avatar Sep 02 '20 07:09 PrimaryInc

Yes id seems to be the same. I saw some options to disable/enable network control on my tv's but the menu structure varies strongly across models.

You can find the file here. However I didn't touch the file for some commits now and cannot guarantee that it fully works with the current configuration. The file is not being published at the moment, therefore you have to copy it to the location where the plugin is installed yourself (so in your case C:\Users\kenneth\AppData\Roaming\npm\node_modules\homebridge-samsungtv-control)

mmende avatar Sep 02 '20 08:09 mmende

Hi @mmende,

I added the config file and added configuration: Samsung06

Config file: Samsung07

Everything looks good, but I get error in log: Samsung08

No butten apear in homeapp.

PrimaryInc avatar Sep 02 '20 08:09 PrimaryInc

Yeah this is the same error as in #23 . This error seems to appear in the device discovery and will therefore lead to the plugin not being able to be loaded successfully. I will let you know (in this thread) when I know what's going on there.

mmende avatar Sep 02 '20 08:09 mmende

@mmende thank you :)

PrimaryInc avatar Sep 02 '20 08:09 PrimaryInc

@mmende, I see that a new release is out, but web config has changes a lot and does not contain the USN, token and name config part. How is config suppose to look now?

Thanks!!

PrimaryInc avatar Oct 05 '20 07:10 PrimaryInc

The config shouldn't have changed actually. Can you tell me which changes you mean exactly?

Kind regards

mmende avatar Oct 05 '20 07:10 mmende

Now it looks like this:

Screenshot 2020-10-05 at 09 42 04

Before you can see a bit up this page.

PrimaryInc avatar Oct 05 '20 07:10 PrimaryInc

The config should look the same as before e.g. like this:

{
  "platform": "SamsungTVControl",
  "name": "SamsungTVControl",
  "devices": [
    {
      "usn": "uuid:a7001fbe-c776-11ea-87d0-0242ac130003",
      "name": "Bedroom TV",
      "token": "YOUR_PAIRING_TOKEN",
      "inputs": [
        {
          "name": "Sleep 30m",
          "keys": "tools,down*3,enter,down,enter,return"
        }
      ]
    }
  ]
}

...basically as described in the readme examples. I guess the new top level name property comes from a slightly changed function call that registers the plugin within homebridge. Apart from that all should be compatible with the current release.

mmende avatar Oct 05 '20 07:10 mmende

Ok, thanks. Strange the plugin UI dont show the same. I'll have a go manual config.

PrimaryInc avatar Oct 05 '20 07:10 PrimaryInc

I didn't reactivate the schema json file yet because I want to extend the command line tools so far that you can get all infos you need upfront. Otherwise I suspect people to be a bit overwhelmed by the config screen with a lot of infos they don't have yet when they initially install the plugin.

mmende avatar Oct 05 '20 07:10 mmende

Ah, yes that is correct. I'll look at enabeling the extention to see how it looks. I'm not to good with code.

PrimaryInc avatar Oct 05 '20 08:10 PrimaryInc

Enabling web ui, I god this: Screenshot 2020-10-05 at 10 25 08

And it created this input to config:

Screenshot 2020-10-05 at 10 23 59

It is a bit different from what your config example and the device dont what up in Apple Home. No error during restart :) So I´ll try to change config manually to see if that helps.

PrimaryInc avatar Oct 05 '20 08:10 PrimaryInc

Hm... it looks like you twisted usn and token and furthermore as far as I remember correctly the usn usually starts with uuid:. You can run npx homebridge-samsungtv-control discover to get the correct usn without needing to crawl through the homebridge log if that helps.

mmende avatar Oct 05 '20 08:10 mmende

You are right, I did reverse them. When trying the pair1, I don't get the UUID/USN presented in logs so I picked it up from http://tv_ip:8001/api/v2/ there it is shown without uuid:

Screenshot 2020-10-05 at 10 57 52

So I changed it, and let plugin UI do the config.

Screenshot 2020-10-05 at 10 57 11

No error on startup, plugin is loading, but there is no entry in log for Samsung TV other than this: Screenshot 2020-10-05 at 10 56 07

PrimaryInc avatar Oct 05 '20 08:10 PrimaryInc

Ok, did running npx homebridge-samsungtv-control discover list your tv?

mmende avatar Oct 05 '20 09:10 mmende

I get this:

Screenshot 2020-10-05 at 11 05 13

This states a different uuid as well.

PrimaryInc avatar Oct 05 '20 09:10 PrimaryInc

Hm ok ... this might also be another upnp device in your network and can be ignored if the usn differs. However as from the pictures above it seems like your tv does not expose the manufacturer field which this plugin currently uses to find out which upnp devices are possible samsung tv's. Therefore your tv might not be listed yet. I might remove this part in the next version as the plugin can also use the modelName property to identify samsung tv's (which your tv seems to expose as expected). I'll let you know when I published the next version with this fix included.

mmende avatar Oct 05 '20 09:10 mmende

@mmende thanks :)

PrimaryInc avatar Oct 05 '20 10:10 PrimaryInc

Just a quick update @mmende, I did get the device in home kit, but it is not doing anything. That in it self is not strange sins tv is not connecting.

IMG_1585

PrimaryInc avatar Nov 05 '20 12:11 PrimaryInc