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

New: Added support for Samsung vendor specific media input sources (USB-C & Display Port) #677

Closed
wants to merge 1 commit into from

Conversation

petarhristov94
Copy link

@petarhristov94 petarhristov94 commented Apr 25, 2024

Description

I've added the highly requested feature of supporting Samsung vendor specific inputs, like the ones available on their OLED smart monitor lineup - USB-C and Display Port (#644, #632, #569). The two new inputs are now available under the input dropdown, as well as under the switch dropdown. The request for switching the new inputs utilizes the samsungvd.mediaInputSource, which also supports the traditional inputs. Should the request fail, it gracefully falls back to the original capability of mediaInputSource used in traditional TVs and leaves a debug level message in the console.

Furthermore, I've renamed the field MAC Address to Network MAC Address, so that it's clear, that the Network (Ethernet/WLAN/Wi-Fi) address is the one relevant. Not to confuse it with the Bluetooth address for example.

I've tested the added feature on my Samsung OLED G8 and I can confirm the input switching works quite well.

Contribution

I'd be honored to be added to the credits section for this contribution! Of course, no worries at all if you prefer not to. Regardless, I'm happy to have been able to help out. Cheers! 😉

Screenshots

Inputs Dropdown

image

Switch Dropdown

image

HomeKit

  • DESKTOP utilizes Display Port
  • MacBook Air utilizes USB-C
  • HDMI is self explanatory

Screenshot 2024-04-25 at 22 04 42

Network MAC Address

image

@@ -66,7 +66,13 @@ module.exports = class SmartThings {
}

setInputSource(value) {
return this.sendCommands({component: 'main', capability: 'mediaInputSource', command: 'setInputSource', arguments: [value]});
// Try to set input source with Samsung-specific vendor extended capability (used in e.g. smart monitors)
return this.sendCommands({component: 'main', capability: 'samsungvd.mediaInputSource', command: 'setInputSource', arguments: [value]})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot merge this PR because of this.

The plugin is developed for TVs, not for Smart Monitors. So the main focus should be for TVs.

Also, this function should not catch errors.

If this is the implementation that helps you, please fork the plugin and change the code as it fits your specific needs :)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please show me a dump of http://TV_IP:8001/api/v2/ from your monitor? Maybe there is something we can relate to and change the capability based on that.

Copy link
Author

@petarhristov94 petarhristov94 Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate the plugin's focus on TVs, but considering the convergence between smart TVs and monitors - both running on Tizen OS - it's beneficial to expand the plugin's capabilities to include Samsung's smart monitors and similar devices. This addition doesn't detract from the TV functionality due to its fallback mechanism that ensures compatibility across existing devices. Furthermore, this feature responds to direct community requests (issues #644, #632, and #569) and reflects a natural extension of the plugin to handle special cases in Tizen OS devices. As one of those users myself, I do think integrating this support will not only meet existing demand but also enhance the plugin’s appeal.

Something I also forgot to mention is, that the samsungvd.mediaInputSource capability also completely supports the existing enumeration list. This means, that switching the input to HDMI1, digitalTv or even FM totally works and does not throw any errors, making the mediaInputSource capability redundant for newer devices. I'd still keep it there, as I can't ensure that older devices also have this capability.

As you requested, here's a dump of the response (I've anonymized some fields to empty GUIDs and placeholder MAC-addresses):

{
	"device": {
		"EdgeBlendingSupport": "false",
		"EdgeBlendingSupportGroup": "0",
		"FrameTVSupport": "false",
		"GamePadSupport": "true",
		"ImeSyncedSupport": "true",
		"Language": "en_GB",
		"OS": "Tizen",
		"PowerState": "on",
		"TokenAuthSupport": "true",
		"VoiceSupport": "true",
		"WallScreenRatio": "-1",
		"WallService": "false",
		"countryCode": "DE",
		"description": "Samsung DTV RCR",
		"developerIP": "0.0.0.0",
		"developerMode": "0",
		"duid": "uuid:00000000-0000-0000-0000-000000000000",
		"firmwareVersion": "Unknown",
		"id": "uuid:00000000-0000-0000-0000-000000000000",
		"ip": "192.168.X.X",
		"model": "22_PONTUSML_GMT8",
		"modelName": "LS34BG850SUXEN",
		"name": "Samsung Odyssey G8",
		"networkType": "wireless",
		"resolution": "3440x1440",
		"smartHubAgreement": "true",
		"ssid": "XX:XX:XX:XX:XX:XX",
		"type": "Samsung SmartTV",
		"udn": "uuid:00000000-0000-0000-0000-000000000000",
		"wifiMac": "XX:XX:XX:XX:XX:XX"
	},
	"id": "uuid:00000000-0000-0000-0000-000000000000",
	"isSupport": "{\"DMP_DRM_PLAYREADY\":\"false\",\"DMP_DRM_WIDEVINE\":\"false\",\"DMP_available\":\"true\",\"EDEN_available\":\"true\",\"FrameTVSupport\":\"false\",\"ImeSyncedSupport\":\"true\",\"TokenAuthSupport\":\"true\",\"remote_available\":\"true\",\"remote_fourDirections\":\"true\",\"remote_touchPad\":\"true\",\"remote_voiceControl\":\"true\"}\n",
	"name": "Samsung Odyssey G8",
	"remote": "1.0",
	"type": "Samsung SmartTV",
	"uri": "http://192.168.X.X:8001/api/v2/",
	"version": "2.0.25"
}

Response Headers:

NAME VALUE
content-type application/json; charset=utf-8
content-length 1363

@carl-gustafson
Copy link

How do add this to the plugin I have installed on HomeBridge?

@Thund3r1
Copy link

I copied the @tavicu config.schema.json. File and pasted into my own in the plugin. This gave me the option for Display Port but it still didn't work with my Samsung G9 49" OLED. Just a guess, I think, until they change something in the Tizen Firmware that allows switch of the display port I don't think it will work. But I'm sure some people here would have a better explanation than me.

@carl-gustafson
Copy link

@Thund3r1 I was able to get it working with DisplayPort by installing @petarhristov94's forked version with the following line in the terminal:
npm install github:petarhristov94/homebridge-samsung-tizen

I'd like to make additional edits (using SmartThings API to pull power status), but I don't know how to edit the plugin code

@tavicu
Copy link
Owner

tavicu commented Jan 12, 2025

For those who don't understand, SmartThings API is using a different command for monitors to support USB-C or DisplayPort.

From the local API there is no way to find out if the device is a TV or a monitor to be able to use different commands depending on what device it is.

SmartThings have an api which will tell you what commands the device supports.

So the correct implementation will be to query SmartThings api and see if the device supports the command that changes to USB-C or DisplayPort. Then if it does, to use that command. Otherwise to use the command which is used now.

A not so good option but fast to implement is if the setInputSource receives USB-C or Display Port value to use the monitor command. I will make this change tomorrow but I will need one of you to help me test it since I don't have a samsung monitor.

@carl-gustafson would you be able to do it tomorrow? :)

@tavicu
Copy link
Owner

tavicu commented Jan 12, 2025

If one of you could get me a screenshot from ST Web App with supported inputs I would really appreciate it and help me :)

I am looking for someone that has an USB-C and Display Port connected to their monitor so we could see what SmartThings API expects.

So, steps:

  1. Login to https://my.smartthings.com/advanced
  2. From the left side select Devices
  3. Select the monitor from the list
  4. On the attributes search for samsungvd.mediaInputSource and send me a screenshot.
  5. What i'm looking for is the value from supportedInputSourcesMap
Screenshot 2025-01-12 at 22 41 11

tavicu pushed a commit that referenced this pull request Jan 12, 2025
@tavicu
Copy link
Owner

tavicu commented Jan 12, 2025

If any of you want to test it before release it: npm install "git://github.com/tavicu/homebridge-samsung-tizen.git#9c57612"

@carl-gustafson
Copy link

carl-gustafson commented Jan 13, 2025

My monitor (Samsung Odyssey OLED G9) does not support video over USB-C, but it does support DisplayPort. Below is value of the attribute "supportedInputSourcesMap":
[{"id":"HDMI1","name":"PC"},{"id":"Display Port","name":"PC"}]

I will test it tonight and let you know if I get it working. While I have your attention, I was wondering if you'd be willing to release a separate version / forked plugin that supports pulling monitor power status via the SmartThings API. I know it goes against the original purpose of the project (not relying on internet connection), but it seems I and others are having the same issue of TVs showing they are on even when they are not.

@carl-gustafson
Copy link

If any of you want to test it before release it: npm install "git://github.com/tavicu/homebridge-samsung-tizen.git#9c57612"

I installed and tested it. At first, I had trouble - debug log said request was unauthorized, but after a generated a new SmartThings API key, it worked very well. Switched between HDMI 1 and Display Port without issues. Thank you!

@Thund3r1
Copy link

If one of you could get me a screenshot from ST Web App with supported inputs I would really appreciate it and help me :)

I am looking for someone that has an USB-C and Display Port connected to their monitor so we could see what SmartThings API expects.

So, steps:

  1. Login to https://my.smartthings.com/advanced
  2. From the left side select Devices
  3. Select the monitor from the list
  4. On the attributes search for samsungvd.mediaInputSource and send me a screenshot.
  5. What i'm looking for is the value from supportedInputSourcesMap
Screenshot 2025-01-12 at 22 41 11

image

@Thund3r1
Copy link

If any of you want to test it before release it: npm install "git://github.com/tavicu/homebridge-samsung-tizen.git#9c57612"

This works! Amazing! Thank you!

@tavicu
Copy link
Owner

tavicu commented Jan 13, 2025

Awesome :)

I have published the new version which includes the changes. v5.3.3

I also removed "PC" option from the options because from your screenshots it appears that PC is actually "Display Port".

I was wondering if you'd be willing to release a separate version / forked plugin that supports pulling monitor power status via the SmartThings API

Not for now. I am working on a new version of the plugin which will change the method that checks if TV is on (#696). It may work with monitors too, but don't know to tell now since I don't have a Samsung Monitor. The focus remains on TVs but will see :)

I am also planning to get a G9 monitor in the future, so there is a big chance for monitors to begin being a priority too :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants