home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.53k stars 30.71k forks source link

0.109.b4: Samsung sound bar detected as TV #34810

Closed chemelli74 closed 3 years ago

chemelli74 commented 4 years ago

The problem

Samsung sound bar (HW-Q70R) is detected as TV, and TV (QE55Q85RATXZT) is not detected at all.

Environment

Problem-relevant configuration.yaml

-

Traceback/Error logs

-

Additional information

image

probot-home-assistant[bot] commented 4 years ago

Hey there @escoand, mind taking a look at this issue as its been labeled with a integration (samsungtv) you are listed as a codeowner for? Thanks!

escoand commented 4 years ago

@frenck This detection was last changed 3 months ago. This is not related to 0.109. https://github.com/home-assistant/core/blame/dev/homeassistant/components/samsungtv/manifest.json

frenck commented 4 years ago

The issue was filed against 0.109.b4 by @chemelli74...

escoand commented 4 years ago

@frenck I mean this wasn't introduced with a change this cycle, probably.

chemelli74 commented 4 years ago

@frenck I mean this wasn't introduced with a change this cycle, probably.

I got my soundbar discovered for the first time after upgrading to 0.109.x Let me know if I can help find a fix for this issue.

Simone

escoand commented 4 years ago

Nice would be the output of the two devices from the second command:

pip3 install async-upnp-client
upnp-client --pprint search
chemelli74 commented 4 years ago

upnp-client --pprint search

I can see only the Soundbar, not the TV. But TV is working fine: ping reply, netflix streaming, etc.

Any idea ?

Simone

escoand commented 4 years ago

Maybe, reset the network settings. Or is there an option to disable something? You could also try https://play.google.com/store/apps/details?id=com.tjjang.upnptool for SSDP discovery. Additionally you could try https://play.google.com/store/apps/details?id=com.druk.servicebrowser for Zeroconf discovery, maybe they have a new way of discovery.

escoand commented 4 years ago

Are you able to control the soundbar? If not, it would be helpful if you could show the output of upnp-client. We should exclude the device otherwise.

chemelli74 commented 4 years ago

Are you able to control the soundbar? If not, it would be helpful if you could show the output of upnp-client. We should exclude the device otherwise.

Didn't try at all, as the integration is called "Samsung TV" ;-) Should work as well for soundbar ?

Simone

chemelli74 commented 4 years ago

Maybe, reset the network settings. Or is there an option to disable something? You could also try https://play.google.com/store/apps/details?id=com.tjjang.upnptool for SSDP discovery. Additionally you could try https://play.google.com/store/apps/details?id=com.druk.servicebrowser for Zeroconf discovery, maybe they have a new way of discovery.

Will dig a bit more as soon as I complete my working day. I know for sure that there is mDNS for discovery as I saw some time ago packets during a wireshark session.

Simone

chemelli74 commented 4 years ago

Seems both device have an announce:

image

packet content is:

SEARCH BSDP/0.1
DEVICE=5 or 0
SERVICE=1

where Soundbar is device 5 and TV is device 0

Simone

escoand commented 4 years ago

BSDP? This is nothing we can work with. We need Zeroconf, SSDP or Homekit as described here: https://developers.home-assistant.io/docs/creating_integration_manifest#zeroconf

chemelli74 commented 4 years ago

Are you able to control the soundbar? If not, it would be helpful if you could show the output of upnp-client. We should exclude the device otherwise.

Didn't try at all, as the integration is called "Samsung TV" ;-) Should work as well for soundbar ?

Simone

Nope, I receive this screen:

image

and of course no display on the sound bar, so no way to "authorize". Soundbar should be excluded; take care that usually they are controlled via HDMI from the TV remote so anyway not really useful.

Simone

chemelli74 commented 4 years ago

BSDP? This is nothing we can work with. We need Zeroconf, SSDP or Homekit as described here: https://developers.home-assistant.io/docs/creating_integration_manifest#zeroconf

After leaving wireshark running all the night I can say that:

image

no other discovery protocols found.

Simone

escoand commented 4 years ago

Not sure how to exclude them, need more details, eg. the upnp-client output.

escoand commented 4 years ago

Is the TV working when added manually?

chemelli74 commented 4 years ago

Is the TV working when added manually?

How should I proceed ?

Simone

escoand commented 4 years ago

Click on the floating action button (+ button at the bottom), select "Samsung TV", type in your IP address.

chemelli74 commented 4 years ago

Not sure how to exclude them, need more details, eg. the upnp-client output.

{
    "CACHE-CONTROL": "max-age=1800",
    "DATE": "Wed, 29 Apr 2020 09:56:39 GMT",
    "EXT": "",
    "LOCATION": "http://192.168.188.37:9197/dmr",
    "SERVER": "Samsung-Linux/4.1, UPnP/1.0, Samsung_UPnP_SDK/1.0",
    "ST": "upnp:rootdevice",
    "USN": "uuid:27bde2d0-7533-4d59-b9cb-0fddd9754c12::upnp:rootdevice",
    "Content-Length": "0",
    "BOOTID.UPNP.ORG": "4",
    "_timestamp": "2020-04-29 11:56:46.810486",
    "_address": "192.168.188.37:33155",
    "_udn": "uuid:27bde2d0-7533-4d59-b9cb-0fddd9754c12",
    "_source": "search"
}
{
    "CACHE-CONTROL": "max-age=1800",
    "DATE": "Wed, 29 Apr 2020 09:56:39 GMT",
    "EXT": "",
    "LOCATION": "http://192.168.188.37:7676/rcr/",
    "SERVER": "Samsung-Linux/4.1, UPnP/1.0, Samsung_UPnP_SDK/1.0",
    "ST": "upnp:rootdevice",
    "USN": "uuid:c67f8ac8-d57d-43f6-9b26-5d5c6a6e9d80::upnp:rootdevice",
    "Content-Length": "0",
    "BOOTID.UPNP.ORG": "4",
    "_timestamp": "2020-04-29 11:56:46.812509",
    "_address": "192.168.188.37:35790",
    "_udn": "uuid:c67f8ac8-d57d-43f6-9b26-5d5c6a6e9d80",
    "_source": "search"
}
{
    "CACHE-CONTROL": "max-age=1800",
    "DATE": "Wed, 29 Apr 2020 09:56:39 GMT",
    "EXT": "",
    "LOCATION": "http://192.168.188.37:9197/dmr",
    "SERVER": "Samsung-Linux/4.1, UPnP/1.0, Samsung_UPnP_SDK/1.0",
    "ST": "uuid:27bde2d0-7533-4d59-b9cb-0fddd9754c12",
    "USN": "uuid:27bde2d0-7533-4d59-b9cb-0fddd9754c12",
    "Content-Length": "0",
    "BOOTID.UPNP.ORG": "4",
    "_timestamp": "2020-04-29 11:56:46.814692",
    "_address": "192.168.188.37:41055",
    "_udn": "uuid:27bde2d0-7533-4d59-b9cb-0fddd9754c12",
    "_source": "search"
}
{
    "CACHE-CONTROL": "max-age=1800",
    "DATE": "Wed, 29 Apr 2020 09:56:39 GMT",
    "EXT": "",
    "LOCATION": "http://192.168.188.37:7676/rcr/",
    "SERVER": "Samsung-Linux/4.1, UPnP/1.0, Samsung_UPnP_SDK/1.0",
    "ST": "uuid:c67f8ac8-d57d-43f6-9b26-5d5c6a6e9d80",
    "USN": "uuid:c67f8ac8-d57d-43f6-9b26-5d5c6a6e9d80",
    "Content-Length": "0",
    "BOOTID.UPNP.ORG": "4",
    "_timestamp": "2020-04-29 11:56:46.816653",
    "_address": "192.168.188.37:52226",
    "_udn": "uuid:c67f8ac8-d57d-43f6-9b26-5d5c6a6e9d80",
    "_source": "search"
}
{
    "CACHE-CONTROL": "max-age=1800",
    "DATE": "Wed, 29 Apr 2020 09:56:39 GMT",
    "EXT": "",
    "LOCATION": "http://192.168.188.37:9197/dmr",
    "SERVER": "Samsung-Linux/4.1, UPnP/1.0, Samsung_UPnP_SDK/1.0",
    "ST": "urn:schemas-upnp-org:device:MediaRenderer:1",
    "USN": "uuid:27bde2d0-7533-4d59-b9cb-0fddd9754c12::urn:schemas-upnp-org:device:MediaRenderer:1",
    "Content-Length": "0",
    "BOOTID.UPNP.ORG": "4",
    "_timestamp": "2020-04-29 11:56:46.818619",
    "_address": "192.168.188.37:41189",
    "_udn": "uuid:27bde2d0-7533-4d59-b9cb-0fddd9754c12",
    "_source": "search"
}
escoand commented 4 years ago

I'm afraid I can't help you. When the TV is not sending any discoverable data but the sound bar does the only I can imagine is: add your TV manually and ignore the sound bar.

chemelli74 commented 4 years ago

Maybe, reset the network settings. Or is there an option to disable something? You could also try https://play.google.com/store/apps/details?id=com.tjjang.upnptool for SSDP discovery. Additionally you could try https://play.google.com/store/apps/details?id=com.druk.servicebrowser for Zeroconf discovery, maybe they have a new way of discovery.

Seems SSDP is legacy: https://developer.samsung.com/smarttv/develop/legacy-platform-library/art00030/index.html

Simone

chemelli74 commented 4 years ago

I'm afraid I can't help you. When the TV is not sending any discoverable data but the sound bar does the only I can imagine is: add your TV manually and ignore the sound bar.

Sound bar should be ignored for sure. What about mDNS for detecting the TV ?

Simone

escoand commented 4 years ago

Interesting, didn't know about this side. Do you have a similar one for mDNS/Zeroconf as well?

chemelli74 commented 4 years ago

Interesting, didn't know about this side.

?

Do you have a similar one for mDNS/Zeroconf as well?

A tool to suggest ?

Simone

escoand commented 4 years ago

I meant site, not side. A similar documentation for mDNS would be great.

The tools I use are here: https://github.com/home-assistant/core/issues/34810#issuecomment-621870396

chemelli74 commented 4 years ago

Is the TV working when added manually?

Yup, works fine. I get the popup on the TV for authorization and then I see the mediaplayer entity created:

image

Not much info compared to SmartThings integration, but working.

Simone

chemelli74 commented 4 years ago

I meant site, not side. A similar documentation for mDNS would be great.

The tools I use are here: #34810 (comment)

I browsed a bit the site above and found this matrix: https://developer.samsung.com/smarttv/develop/specifications/general-specifications.html

About mDNS, I posted the discovery from Wireshark. You need anything more ?

Simone

escoand commented 4 years ago

About mDNS, I posted the discovery from Wireshark. You need anything more ?

Do you mean the _airplay._tcp._local? This is not quite Samsung specific. This is not going to work.

chemelli74 commented 4 years ago

About mDNS, I posted the discovery from Wireshark. You need anything more ?

Do you mean the _airplay._tcp._local? This is not quite Samsung specific. This is not going to work.

What are you looking more than that :

image

IMHO it's enough to know it's a Samsung tv. Why you say it won't work ?

Simone

escoand commented 4 years ago

Ahh OK, the whole string is Samsung TV Q85 Series (55)._airplay._tcp._local is the mDNS name. Have to look if we could use patterns or placeholders for this string.

chemelli74 commented 4 years ago

Ahh OK, the whole string is Samsung TV Q85 Series (55)._airplay._tcp._local is the mDNS name. Have to look if we could use patterns or placeholders for this string.

Thx a lot... and don't forget to exclude Soundbar ;-)

Simone

escoand commented 4 years ago

When you explain how to exclude, I can do it.

chemelli74 commented 4 years ago

When you explain how to exclude, I can do it.

Checking protocol details to see if there is a clean way to go, but at worst you have the device string identifier (HW-Q70R). All sound bar are named "HW-xxxx".

Can I log somehow a full reply of the device ? You get the string from there, maybe there is also some more fields.

Simone

chemelli74 commented 4 years ago

Ok, I think I found something better @ http://192.168.188.37:9197/dmr :

<root>
  <device>
     <modelDescription>Samsung SOUNDBAR DMR</modelDescription>

or

<root>
  <device>
     <sec:ProductCap>
               ... , ... , vdProductType=SOUNDBAR , ...

EDIT: My TV answers fine @ http://192.168.188.34:9197/dmr.

Simone

escoand commented 4 years ago

The point is, it's not allowed to implement protocol specific things in integrations. It has to be done in libraries. So we need to interpret the SSDP data or the library is able to determine the type of the device.

Your posted upnp-client output was from your TV, right? Can you show me the one of the sound bar?

escoand commented 4 years ago

The used lib is https://pypi.org/project/samsungtvws/

chemelli74 commented 4 years ago

Your posted upnp-client output was from your TV, right? Can you show me the one of the sound bar?

As already told, TV doesn't show in SSDP so nothing in upnp-client. Output is from soundbar.

Simone

chemelli74 commented 4 years ago

The used lib is https://pypi.org/project/samsungtvws/

Issue created: [FR] Detect device type

Simone

xchwarze commented 4 years ago

Hi! the rest_device_info() method maybe fix this response.type ==="Samsung SmartTV"

escoand commented 4 years ago

@xchwarze Is this request usable without authorization? So can we check this before any user interaction?

xchwarze commented 4 years ago

@escoand yes

escoand commented 4 years ago

Could anybody give a full result of this function. I don't own such a device but would be interested what to expect.

escoand commented 4 years ago

Ahh OK, the whole string is Samsung TV Q85 Series (55)._airplay._tcp._local is the mDNS name. Have to look if we could use patterns or placeholders for this string.

@chemelli74 Wildcards are not allowed. Not using a fixed string (and having the TV name as an attribute) seems quite weird for me.

escoand commented 4 years ago

@chemelli74 Forget my last comment, I did a test with my Kodi, so we have to look for _airplay._tcp.local.. Could you please try to run this script like this and show me the output:

pip3 install zeroconf
python test.py
chemelli74 commented 4 years ago

@escoand , here the output:

root@ubuntu:/tmp# python3 test.py Press enter to exit...

Service Samsung TV Q85 Series (55)._airplay._tcp.local. added, service info: ServiceInfo(type='_airplay._tcp.local.', name='Samsung TV Q85 Series (55)._airplay._tcp.local.', addresses=[b'\xc0\xa8\xbc"'], port=38585, weight=0, priority=0, server='Samsung-2.local.', properties={b'acl': b'0', b'deviceid': b'24:FC:E5:1E:94:E4', b'features': b'0x7F8AD0,0x38BCB46', b'rsf': b'0x3', b'fv': b'p20.0.1', b'flags': b'0x244', b'model': b'QRQ85_OC', b'manufacturer': b'Samsung', b'serialNumber': b'0EB03HNM300665R', b'protovers': b'1.1', b'srcvers': b'377.17.24.6', b'pi': b'66:99:06:76:D2:2F', b'psi': b'00000000-0000-0000-0000-66990676D22F', b'gid': b'00000000-0000-0000-0000-66990676D22F', b'gcgl': b'0', b'pk': b'24f1aff3a80a4fbeedebd3263daef223428820ad3b6336db96a559ec5155ce6e'})

Simone

escoand commented 4 years ago

Would be nice we would know what this all means. Could you answer my comments below?

ServiceInfo(
  type='_airplay._tcp.local.',
  # is this user defined?
  name='Samsung TV Q85 Series (55)._airplay._tcp.local.',
  # this is the ip
  addresses=[b'\xc0\xa8\xbc"'],
  port=38585,
  weight=0,
  priority=0,
  server='Samsung-2.local.',
  properties={
    b'acl': b'0',
    # is this the mac?
    b'deviceid': b'24:FC:E5:1E:94:E4',
    # this would be quite interesting
    b'features': b'0x7F8AD0,0x38BCB46',
    b'rsf': b'0x3',
    b'fv': b'p20.0.1',
    b'flags': b'0x244',
    # why is this scrambled? Not helpful
    b'model': b'QRQ85_OC',
    b'manufacturer': b'Samsung',
    b'serialNumber': b'0EB03HNM300665R',
    b'protovers': b'1.1',
    # is this the firmware version?
    b'srcvers': b'377.17.24.6',
    # is this the mac?
    b'pi': b'66:99:06:76:D2:2F',
    b'psi': b'00000000-0000-0000-0000-66990676D22F',
    b'gid': b'00000000-0000-0000-0000-66990676D22F',
    b'gcgl': b'0',
    b'pk': b'24f1aff3a80a4fbeedebd3263daef223428820ad3b6336db96a559ec5155ce6e'
  }
)
chemelli74 commented 4 years ago
is this user defined?
name='Samsung TV Q85 Series (55)._airplay._tcp.local.',

It's the default device name, can be changed.

this is the ip
addresses=[b'\xc0\xa8\xbc"'],

Is the network class: 192.168.188

is this the mac?
b'deviceid': b'24:FC:E5:1E:94:E4',

MAC address LAN port. I'm connect trough Wifi, not LAN

this would be quite interesting
b'features': b'0x7F8AD0,0x38BCB46',

If can be of any help, I found this: Unofficial AirPlay Protocol Specification

why is this scrambled? Not helpful
b'model': b'QRQ85_OC',

My specific model is QE55Q85R; Q85 is the family model, don't know about QR or OC

# is this the firmware version?
b'srcvers': b'377.17.24.6',

Don't think so, my tv reports firmware: "1356.2" See above for AirPlay details

# is this the mac?
b'pi': b'66:99:06:76:D2:2F',

Nope, I have MAC address for LAN, Wifi, Bluetooth and Remote but none is the one above.

Simone

chemelli74 commented 4 years ago
why is this scrambled? Not helpful
b'model': b'QRQ85_OC',

My specific model is QE55Q85R; Q85 is the family model, don't know about QR or OC

Sorry, just found it's a official TV "group": https://developer.samsung.com/smarttv/develop/specifications/tv-model-groups.html

Simone

escoand commented 4 years ago

https://github.com/home-assistant/core/issues/34810#issuecomment-623528761

@chemelli74 Are you able to provide the requested output?