Git Product home page Git Product logo

Comments (24)

simonysck avatar simonysck commented on June 28, 2024 1

@branislavbudzak, @germn

I figured out how to switch to USB-C directly on Samsung Odyssey G8 without using 'KEY_HDMI' which actually switches between inputs.
The trick is to send the command 'ST_VD:name of your USB-C'
It seems like ST_VD recognized the name you give the inputs instead of the nature of the input.
To change the name , go to Home > Connected Devices (should be on the left) > Sources (and pick the USB-C, then press down) >Edit and type what you want it to call in the Edit Name textbox. In my case, I called it ' Laptop'.

Then in the source list configuration , I wrote
USB-C: ST_VD:Laptop
and it switches to USB-C everytime. If I am already on USB-C, the monitor shows that you are on USB-C again on the top

from ha-samsungtv-smart.

ollo69 avatar ollo69 commented on June 28, 2024

I suppose that Samsung Smart TV is the native integration. This one do not use SmartThings so it just display what is possible via WebSocket (TV/HDMI)
SamsungTV Smart (this integration) use SmartThings if you configure token during setup, but I don't know what is samsungvd.mediaInputSource. If you can provide more detail (example and syntax of your call, may be with some screenshot) I could take a look to understand if this command can be implemented.

Anyway I strongly suggest to not have both integration configured, because for sure they interfere with each other.

from ha-samsungtv-smart.

kaixla avatar kaixla commented on June 28, 2024

Hi @ollo69 I have a smart monitor too. M5 version in my case. I believe the issue is that we cannot link our SmartThings account to this.
I have other Samsung regular TVs at home and are listed and can be selected when introducing the Smartthings API Key, but the monitor isn't listed.
Therefore if we cannot add the Smartthings integration to the Smart Monitor to control the input source (apart from TV or HDMI).

from ha-samsungtv-smart.

ollo69 avatar ollo69 commented on June 28, 2024

Hi @kaixla,

clear, but seems that @AfcaEric can control his monitor from SmartThings:

Now, from the SmartThings webpage, i'm able to call the "samsungvd.mediaInputSource" command with a value of "PC" and it switches to the DisplayPort source

from ha-samsungtv-smart.

kaixla avatar kaixla commented on June 28, 2024

Hi @ollo69 what a fast reply! Thanks.

Yes, I can control the monitor from the SmartThings app in my phone.

But unfortunately I cannot use the functionality in this module as I am unable to link it. I can use basic functionality such as on and off, or change from TV to HDMI. But not to select app source, or even HDMI1 or HDMI2.

from ha-samsungtv-smart.

ollo69 avatar ollo69 commented on June 28, 2024

To understand if is possible to do something, you should try to connect to SmartThings with your token using a software like postman and report here available commands and syntax. If some specific command is available to detect additional source and select them, I could try to implement inside integration.

from ha-samsungtv-smart.

kaixla avatar kaixla commented on June 28, 2024

I would love to help, but I am not an IT expert, and have never worked with APIs. I have made a quick search of Postman and the Smartthings API, but unfortunately I understand very little of it.
I have my API token that I could use to test, but I am unable to do what you ask for. If you would like to guide me I would be happy to help.
Thanks!

from ha-samsungtv-smart.

AfcaEric avatar AfcaEric commented on June 28, 2024

Hi ollo,

Thanks for helping out. I'll try to explain a bit further, but please bear with me since i'm pretty new to Smartthings.
Ok, so the monitor is the Samsung G8 OLED. I've started using the Smartthings CLI to see what i would need and found the following (funny) thing:

With Smartthings CLI i find the following 2 capabilities of interest (omitted the rest that's not interesting in this one):

Capabilities:
────────────────────────────────────
 6   mediaInputSource
 20  samsungvd.mediaInputSource
────────────────────────────────────

For the default "mediaInputSource", it lists the following and you can see DisplayPort is missing:

─────────────────────────────
 1  setInputSource(mode<enum
      - AM
      - CD
      - FM
      - HDMI
      - HDMI1
      - HDMI2
      - HDMI3
      - HDMI4
      - HDMI5
      - HDMI6
      - digitalTv
      - USB
      - YouTube
      - aux
      - bluetooth
      - digital
      - melon
      - wifi>)
─────────────────────────────

For the samsungvd.mediaInputSource (which seems to use the same 'mediaInputSource' command but in a slight different way, it gives me the free option to input something:

Commands:
───────────────────────────────
 1  setInputSource(id<string>)
───────────────────────────────

? Enter command 1
? Enter command arguments (id) "PC"

If i enter "PC" or "Display Port" here, it works fine.

Unfortunately, i'm not a scripter/programmer, but if there somehow would be a way to use the setInputSource that's being used in your Smartthings.py script (COMMAND_SET_SOURCE variable) the same way it would be used through the samsungvd.mediaInputSource capability (which in turn looks to me as it uses the same setInputSource command but in a different syntax), i think we would have the complete freedom to create our own Source list.

Not sure if it would be helpful, but i think i'm able to dump the JSON or XML code that's being run with these commands. So if that could be helpful, please let me know.

I think it's safe to say that this is just deficiency from the Smartthings API, but the possibility is there.
I hope this made any sense. If not, please feel free to tell me what i could help out with

from ha-samsungtv-smart.

ollo69 avatar ollo69 commented on June 28, 2024

Not sure if it would be helpful, but i think i'm able to dump the JSON or XML code that's being run with these commands. So if that could be helpful, please let me know.

Yes, it could help. Please attach it

from ha-samsungtv-smart.

AfcaEric avatar AfcaEric commented on June 28, 2024

Sure, hopefully this is what you are looking for:

mediaInputSource:

{
    "id": "mediaInputSource",
    "version": 1,
    "status": "live",
    "name": "Media Input Source",
    "ephemeral": false,
    "attributes": {
        "supportedInputSources": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "items": {
                            "title": "MediaSource",
                            "enum": [
                                "AM",
                                "CD",
                                "FM",
                                "HDMI",
                                "HDMI1",
                                "HDMI2",
                                "HDMI3",
                                "HDMI4",
                                "HDMI5",
                                "HDMI6",
                                "digitalTv",
                                "USB",
                                "YouTube",
                                "aux",
                                "bluetooth",
                                "digital",
                                "melon",
                                "wifi"
                            ],
                            "type": "string"
                        },
                        "type": "array"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "enumCommands": []
        },
        "inputSource": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "title": "MediaSource",
                        "enum": [
                            "AM",
                            "CD",
                            "FM",
                            "HDMI",
                            "HDMI1",
                            "HDMI2",
                            "HDMI3",
                            "HDMI4",
                            "HDMI5",
                            "HDMI6",
                            "digitalTv",
                            "USB",
                            "YouTube",
                            "aux",
                            "bluetooth",
                            "digital",
                            "melon",
                            "wifi"
                        ],
                        "type": "string"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "setter": "setInputSource",
            "enumCommands": []
        }
    },
    "commands": {
        "setInputSource": {
            "name": "setInputSource",
            "arguments": [
                {
                    "name": "mode",
                    "optional": false,
                    "schema": {
                        "title": "MediaSource",
                        "enum": [
                            "AM",
                            "CD",
                            "FM",
                            "HDMI",
                            "HDMI1",
                            "HDMI2",
                            "HDMI3",
                            "HDMI4",
                            "HDMI5",
                            "HDMI6",
                            "digitalTv",
                            "USB",
                            "YouTube",
                            "aux",
                            "bluetooth",
                            "digital",
                            "melon",
                            "wifi"
                        ],
                        "type": "string"
                    }
                }
            ]
        }
    }
}

samsungvd.mediaInputSource:

{
    "id": "samsungvd.mediaInputSource",
    "version": 1,
    "status": "proposed",
    "name": "Media Input Source",
    "ephemeral": false,
    "attributes": {
        "supportedInputSourcesMap": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "string"
                                },
                                "name": {
                                    "type": "string"
                                }
                            }
                        },
                        "required": []
                    }
                },
                "additionalProperties": false,
                "required": []
            },
            "enumCommands": []
        },
        "inputSource": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "string"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "enumCommands": []
        }
    },
    "commands": {
        "setInputSource": {
            "name": "setInputSource",
            "arguments": [
                {
                    "name": "id",
                    "optional": false,
                    "schema": {
                        "type": "string"
                    }
                }
            ]
        }
    }
}

from ha-samsungtv-smart.

github-actions avatar github-actions commented on June 28, 2024

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days.

from ha-samsungtv-smart.

github-actions avatar github-actions commented on June 28, 2024

This issue was closed because it has been stalled for 7 days with no activity.

from ha-samsungtv-smart.

ollo69 avatar ollo69 commented on June 28, 2024

Reopen this adding FT label, I just do not have any time to take a look...

from ha-samsungtv-smart.

veeroohre avatar veeroohre commented on June 28, 2024

Would be great to get the ability to switch to DP. I'd like to do it, too. My use case is that I'm switching a lot between my PC and my work laptop. Using the remote is pain so I plan to use an Ikea switch to do just that. Unfortunately I cannot do it yet. As @AfcaEric wrote it's possible via the SmartThings website.

Maybe the attached screenshot from the SmartThings page is useful...

image

from ha-samsungtv-smart.

branislavbudzak avatar branislavbudzak commented on June 28, 2024

I have the same issue but with USB-C port on my Samsung M7 Smart Monitor, where I am connecting my Macbook. So it will be cool to be able to switch inputs. HDMI port where I have my Xbox is working, but USB-C is not for some reason and under attributes it is always showing HDMI1 even if I have USB-C opened.

from ha-samsungtv-smart.

germn avatar germn commented on June 28, 2024

Some useful info for those who has OLED G8 and wants to use it with HA:

  1. You can use SmartThings API to switch to Display Port:

curl -X POST 'https://api.smartthings.com/v1/devices/DEVICE_ID/commands' -H 'Authorization: Bearer API_TOKEN' --data '{"commands":[{"component":"main","capability":"samsungvd.mediaInputSource","command":"setInputSource","arguments":["PC"]}]}'
Get and replace above DEVICE_ID from https://api.smartthings.com/v1/devices (you need an auth on smartthings.com) and API_TOKEN from https://account.smartthings.com/tokens

  1. You can use standard HA Samsung Smart TV integration and provided remote service to switch to USB:
service: remote.send_command
target:
  device_id: ID_FOR_REMOTE
data:
  command:
    - KEY_HDMI  # It says HDMI, yes, but it actually switches to USB ¯\_(ツ)_/¯

I don't remember where I got ID_FOR_REMOTE from :(

Surprisingly, I didn't manage to switch to USB using API despite USB being a valid MediaSource for both mediaInputSource and samsungvd.mediaInputSource.


Anyway, it's enough to switch between Display Port / USB. The API call can be wrapped with https://www.home-assistant.io/integrations/rest_command/

My results:

secrets.yaml

display_uid: jhjghjghjghjghjghjghjghjghj
display_api_url: https://api.smartthings.com/v1/devices/ghjghjhgjhgjhgjghjghj/commands
display_api_auth: "Bearer ghjhgjhgjghjhgjghjghj"

configuration.yaml

rest_command:
  34_odyssey_oled_g8_api:
    url: !secret display_api_url
    method: POST
    headers:
      authorization: !secret display_api_auth
    payload: '{"commands":[{"component":"main","capability":"{{capability}}","command":"{{command}}","arguments":["{{arguments}}"]}]}'
    content_type: "application/json; charset=utf-8"
    verify_ssl: false

scripts I use

  display_to_desktop:
    sequence:
      - service: rest_command.34_odyssey_oled_g8_api
        data:
          capability: "samsungvd.mediaInputSource"
          command: "setInputSource"
          arguments: "PC"
      - service: script.display_remove_popup

  display_to_macbook:
    sequence:
      - service: remote.send_command
        target:
          device_id: !secret display_uid
        data:
          command:
            - KEY_HDMI
      - service: script.display_remove_popup

  display_remove_popup:
    sequence:
      - delay:
          milliseconds: 500
      - service: remote.send_command
        target:
          device_id: !secret display_uid
        data:
          command:
            - KEY_RETURN

from ha-samsungtv-smart.

ollo69 avatar ollo69 commented on June 28, 2024

Based on information collected in this thread I released a new version that support the key code "ST_PC" via SmartThings. Please check a let me know if it works as expected.

from ha-samsungtv-smart.

veeroohre avatar veeroohre commented on June 28, 2024

Switch to Display Port does not work for me with "ST_PC". It switches to HDMI1.

Using
curl -X POST 'https://api.smartthings.com/v1/devices/DEVICE-ID/commands' -H 'Authorization: Bearer API-Token' --data '{"commands":[{"component":"main","capability":"samsungvd.mediaInputSource","command":"setInputSource","arguments":["Spiele-PC"]}]}'
works.

from ha-samsungtv-smart.

ollo69 avatar ollo69 commented on June 28, 2024

Why Spiele-PC. This is the name that you assign to the input? Can you just rename it PC and try again from integration?

from ha-samsungtv-smart.

veeroohre avatar veeroohre commented on June 28, 2024

Yes, I renamed it.

After renaming to "PC" it still switches to HDMI1 and not DisplayPort.

from ha-samsungtv-smart.

ollo69 avatar ollo69 commented on June 28, 2024

But after renaming did you try to change the input using curl command?

from ha-samsungtv-smart.

ollo69 avatar ollo69 commented on June 28, 2024

Anyway I released a new version where I rewrite this command to be more generic.
You can now use, for instance, ST_VD:Spiele-PC to activate the input Spiele-PC.
In this way this is more generic a is possible to use any input name (of course it must exist on the TV).

Tested my side and it work properly, I wait for yours feed-back.

from ha-samsungtv-smart.

veeroohre avatar veeroohre commented on June 28, 2024

I works now, but only if I rename the source to e. g. "Spiele-PC". If it's the default name "PC" it still switches to HDMI1 and not DisplayPort.

Thank you for your help!

from ha-samsungtv-smart.

rusty6285 avatar rusty6285 commented on June 28, 2024

Thanks folks, I wasnt unable to figure out how to send this via API command, but I can confirm that using a script that sends the command 'ST_VD:PCdp' as a 'Remote: Send Command' to the entity works perfectly! just be sure to rename the displayport input to that first.

I'm hoping the renamed input sticks on this new firmware, I had an issue of it always reverting last time I did this.. fingers crossed

from ha-samsungtv-smart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.