Improving Samsung TV Control

I Got a RU7100, too. Would you mind sharing your config? Thanks a lot!

Hello

I’m looking to make the Smart Things API work for channel change. On the Samsung <-> Google Home integration, we can directly ask Google to put a channel and it does so even from an application like on Netflix.

Without the API with Home Assistant, I have to do KEY_EXIT + KEY_TV + KEY_1 for example

Is there a way with the API Smartthings integration to make a channel change directly from Home Assistant? If yes what’s the command ST_XXXX ?

I tried to change source to “ST_TV” with from Home Assistant and with Google and it’s cleary more faster than KEY_XX for me.

Otherwise I tried to do ST_TV + KEY_X but it doesn’t work. If I combine the ST_X with KEY_X it doesn’t work.

Thank you in advance for your return.

Which integration? I would like to know how to do this, having a Samsung Smart TV and google home.
Thx

1 Like

Command https://www.samsung.com/au/support/tv-audio-video/google-home-voice-commands-for-samsung-tvs/

Integration. : https://www.samsung.com/au/support/tv-audio-video/how-to-setup-google-home-on-a-samsung-tv/

All works a charm in English (I tested). But in French i can’t get it to work for me.
Maybe Google haven’t integrate commands in French

1 Like

@alex7614

Otherwise I tried to do ST_TV + KEY_X but it doesn’t work. If I combine the ST_X with KEY_X it doesn’t work.

Yes, you can’t mix remote keys with SmartThings keys, it could be added, but given we only have SmartThings codes to change input, your example is the only use case that I can think of. If I could find SmartThings codes to change the channel directly, even that use case would stop being useful… So I’m not entirely sure it’s worth adding support to mix remote keys and SmartThings keys yet.

yes the best would be to find a command to change the channel with Smartthings as is currently the case with SmartThings integration - Google Home

Is anyone having issues in combination with 0.106.5? I updated to the tizen component last week while I was still on 0.106.0 and everything worked fine.

I updated to 0.106.5 yesterday and nothing seems to be working anymore. Can’t even turn on the TV now. I have updated to version v1.4.3 of the component a couple hours before that. I’m not completely sure whether it stopped working after that or after the upgrade to Home Assistant 0.106.5.

Weird thing is… everything shows up fine (media_player) and I don’t see any errors in the log. Nothing seems to respond though.

Even tried to downgrade to v1.4.2, but that doesn’t seem to work either.

Anyway else with the same issue?

@thmry nobody else reported having issues with HA 0.106.5, I’m still on 0.105.2 myself… there shouldn’t be issues though…

@jaruba When do you expect the latest PR will be available in HACS?

https://github.com/jaruba/ha-samsungtv-tizen/pull/32

Thanks for your work!

ha-samsungtv-tizen work on q70r but not perfect

i have to turn on Intelligent mode of brightness
KEY_SOURCE+KEY_DOWN+KEY_LEFT+KEY_UP+KEY_RIGHT+KEY_ENTER+KEY_EXIT

and game mode
KEY_SOURCE+KEY_DOWN+KEY_LEFT+KEY_UP+KEY_RIGHT+KEY_RIGHT+KEY_RIGHT+KEY_RIGHT+KEY_RIGHT+KEY_ENTER+KEY_EXIT

Sometimes KEY_SOURCE dont work at the first time

any other way to turn on/off Intelligent mode of brightness and game mode ?
can i send ,for example, “turn on dynamic brightness” as a text to media_player such as i say voice to samsung smart remote ?

@msmits2011 I made a new release.

@Terr There are two key codes: “KEY_GAME” and “KEY_MAGIC_BRIGHT”, I did not try them though. They are both listed in the key code list here:

can i send ,for example, “turn on dynamic brightness” as a text

Samsung’s voice assistant is called Bixby, I haven’t found any way of interacting with it through text yet…

1 Like

unfortunately i tried all codes before ask
dont work

ps such codes work
KEY_POWEROFF
KEY_POWERON
KEY_AMBIENT
KEY_HDMI
KEY_SOURCE
KEY_PMODE
KEY_MENU
KEY_HOME
KEY_GUIDE
KEY_TOOLS
KEY_SUB_TITLE
KEY_CONVERGENCE
and a few more

So, I went back to the non-Tizen (samsungtv_custom) version and Home Assistant 0.106.0 because those versions definitely worked for me. I turned on debug logging and started seeing the following with every command:

2020-03-11 10:59:42 DEBUG (SyncWorker_9) [custom_components.samsungtv_custom.media_player] Error in send_command() -> OSError

So, for the keep-alive (I think thats what it is) and e.g. simply turning the volume down:

2020-03-11 11:01:51 INFO (SyncWorker_16) [root] Sending key KEY
2020-03-11 11:01:54 DEBUG (SyncWorker_16) [custom_components.samsungtv_custom.media_player] Error in send_command() -> OSError
2020-03-11 11:02:05 INFO (SyncWorker_0) [root] Sending key KEY_VOLDOWN
2020-03-11 11:02:08 DEBUG (SyncWorker_0) [custom_components.samsungtv_custom.media_player] Error in send_command() -> OSError

I decided to install samsungtv_tizen (version 1.4.0) again to check the logs, because as I said in my previous post those versions still worked two weeks (or so) ago. This is what I see in the logs related to that component:

2020-03-11 11:29:07 WARNING (MainThread) [homeassistant.helpers.entity] Updating state for media_player.tv (<class 'custom_components.samsungtv_tizen.media_player.SamsungTVDevice'>) took 7.827 seconds. Please report it to the custom component author.
2020-03-11 11:29:07 WARNING (MainThread) [homeassistant.components.media_player] Setup of media_player platform samsungtv_tizen is taking over 10 seconds.
2020-03-11 11:29:53 DEBUG (SyncWorker_4) [custom_components.samsungtv_tizen.media_player] Error in send_command() -> OSError
2020-03-11 11:29:56 INFO (SyncWorker_11) [homeassistant.loader] Loaded samsungtv from homeassistant.components.samsungtv

And again the same OSError with the Keep-Alive and e.g. when turning the volume up:

2020-03-11 11:34:11 INFO (SyncWorker_0) [root] Sending key KEY
2020-03-11 11:34:14 DEBUG (SyncWorker_0) [custom_components.samsungtv_tizen.media_player] Error in send_command() -> OSError
2020-03-11 11:34:20 INFO (SyncWorker_1) [root] Sending key KEY_VOLUP
2020-03-11 11:34:23 DEBUG (SyncWorker_1) [custom_components.samsungtv_tizen.media_player] Error in send_command() -> OSError

Nothing seems to work, so I just upgraded to Home Assistant 0.106.5 (still with version 1.4.0 of samsungtv_tizen installed) and I’m still seeing the same debug messages (OSError) as can be seen above.

As a last step I upgraded samsungtv_tizen to 1.4.4 (the latest version) and now I’m seeing different debug messages (probably because of the updates), I’m e.g. not seeing the ‘Keep-Alive’ messages anymore:

2020-03-11 11:55:32 DEBUG (SyncWorker_12) [custom_components.samsungtv_tizen.websockets] Sending key KEY_VOLUP
2020-03-11 11:55:32 DEBUG (SyncWorker_12) [custom_components.samsungtv_tizen.websockets] WS url ws://192.168.178.20:8001/api/v2/channels/samsung.remote.control?name=dHY=
2020-03-11 11:55:35 DEBUG (SyncWorker_12) [custom_components.samsungtv_tizen.websockets] Connection closed.
2020-03-11 11:55:35 DEBUG (SyncWorker_12) [custom_components.samsungtv_tizen.media_player] Error in send_command() -> OSError
2020-03-11 11:55:36 DEBUG (SyncWorker_18) [custom_components.samsungtv_tizen.websockets] Sending key KEY_VOLDOWN
2020-03-11 11:55:36 DEBUG (SyncWorker_18) [custom_components.samsungtv_tizen.websockets] WS url ws://192.168.178.20:8001/api/v2/channels/samsung.remote.control?name=dHY=
2020-03-11 11:55:39 DEBUG (SyncWorker_18) [custom_components.samsungtv_tizen.websockets] Connection closed.
2020-03-11 11:55:39 DEBUG (SyncWorker_18) [custom_components.samsungtv_tizen.media_player] Error in send_command() -> OSError

@jaruba Do you have any idea what is going on here? Why is the connection closed?

@thmry You can read about OSError here:
https://docs.python.org/3/library/exceptions.html#OSError

The gist of it is that the error comes from the System, not Python, so it’s not a component error, it’s a System error. That’s all I can help you with.

Hello jaruba,

Do you know by any chance what is the format for doing “send_key” in the standard Samsungtv component? I used a custom component which worked well, but then stopped working for some reason. I switched to the standard component (have an pre-2016 tv), and got most of the commands working. But some do not work as these need a specific string to be sent via “send_key”. Your above data structure does not work. Any thoughts on how to approach this in the standard component?

@Jan_Willem_Maas Both my TVs are 2016+, I don’t use, nor have ever used the standard HA component, so I can’t help you with that.

with new tizen version HA send command later, Alexa not switch off and HA logs:
Updating state for media_player.tv (<class’custom_components.samsungtv_tizen.media_player.SamsungTVDevice’>) took 0.441 seconds. Please report it to the custom component author.
(HA 106.5 and samsung TV tizen v1.4.4)

@robertopiumatti Yes, a compromise was made to add another long running method in the update method for better media_title handling (specifically showing which apps are running).

If you use the app IDs that start with org. when you declare your app_list in the config. Then this excess of update time should be mitigated.

Hello, A I am new here and I am starting wiht home assitant, I have a Smart Samsung TV control by HA is working fine. I need criate a button to channel up and down, how can I make this script and where save this script?

@amkochaki there is a /config/scripts.yaml, some example scripts to get you started:

channel_up:
  alias: "TV Channel Up"
  sequence:
    - service: media_player.play_media
      data:
            entity_id: media_player.samsungtv
            media_content_id: "KEY_CHUP"
            media_content_type: send_key
channel_down:
  alias: "TV Channel Down"
  sequence:
    - service: media_player.play_media
      data:
            entity_id: media_player.samsungtv
            media_content_id: "KEY_CHDOWN"
            media_content_type: send_key
channel_404:
  alias: "TV Channel 404"
  sequence:
    - service: media_player.play_media
      data:
            entity_id: media_player.samsungtv
            media_content_id: "KEY_EXIT+KEY_TV+KEY_4+KEY_0+KEY_4+KEY_ENTER"
            media_content_type: send_key

(you will need to change “media_player.samsungtv” to your TV’s entity ID)