Improving Samsung TV Control

Hey, using your component works fine thanks.

Is there any way of getting back the current app open on the tv? i know if you go to the url;

http://ip:8080/ws/app/Netflix

You get xml back which shows you if the app is running or not. just a thought

working at my UE40MU6400 :slight_smile:

Thank you for sharing, Seem to work fine on my tv RU7100, I took a whole afternoon to make it work with the other repo until I found the huge delay between Keypresses and came here.

1 Like

For anyone interested i have updated the component and it now returns a source if an app is open on the tv. It currently only goes between 3 apps (plex netflix & youtube) but can add more, These are the only apps i use. I would like to try using the app list generated but not really sure how. I have tested with 2 different TVs and both work so far so good.

I am just learning python so this could probably be written better or in a different way

2 Likes

Thanks for this. Are you going to integrate it on HACS?

I’ll check ur PR soon, sorry, I’ve been busy with work lately…

1 Like

Don’t say sorry it’s all good. It works, it could probably be written better I don’t know, I am not a developer i just like to try things lol.

It would be cool to be able to use the generated app list rather than the 3 I have put in the code, but I don’t know if that would slow everything down due to it doing atleast 10 requests at a time. I thought to use the app list your code generates or add an optional config variable in configuration.yaml ‘Fave_apps:’ or something. Would be nice to maybe add the TV / hdmi source as well. I tried but it just broke the component.

I think having the source is handy because I now have a template sensor and automation set up to dim the lights when Netflix is open on the TV.

I tried to include the custom components today.
Do you also get the following errors in your logs several times?

home-assistant   | 2019-12-22 13:40:06 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
home-assistant   | Traceback (most recent call last):
home-assistant   |   File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 408, in _async_add_entity
home-assistant   |     await entity.async_update_ha_state()
home-assistant   |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 286, in async_update_ha_state
home-assistant   |     self._async_write_ha_state()
home-assistant   |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
home-assistant   |     attr.update(self.state_attributes or {})
home-assistant   |   File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 796, in state_attributes
home-assistant   |     for attr in ATTR_TO_PROPERTY
home-assistant   |   File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 797, in <dictcomp>
home-assistant   |     if getattr(self, attr) is not None
home-assistant   |   File "/config/custom_components/samsungtv_jaruba/media_player.py", line 306, in is_volume_muted
home-assistant   |     self._muted = self._remote.get_mute()
home-assistant   |   File "/config/custom_components/samsungtv_jaruba/samsungtvws/remote.py", line 227, in get_mute
home-assistant   |     if (int(mute) == 0):
home-assistant   | UnboundLocalError: local variable 'mute' referenced before assignment

No, I don’t have that issue. What Home Assistant version are you using? Maybe it’s an incompatibility error.

I am using the latest version 0.103.5

Almost installed this one but then i read your, will try it one of these days

Install this version instead:

Can’t wait to try this out, so much more useful than official component.

Using this integration, my tv doesn’t update its status to “off” when turning off the tv, using the remote. Its updates instantly if I use turn it off via Home Assistant.

Is this normal or would there be a solution to this?

Pretty sure that the remote will remain our main “turn-off-instrument” for the foreseeable future, and this would render having the tv in Home Assistant not all that useful, since the status could be wrong.

Yeah, I know that there are some issues now with the on / off states:

Did you fix this? I’m trying to install this but gets loads of these errors.

Try setting:

update_method: "ping"

in your config, it might fix the on / off state issues you’ve been having.

Will try to do that later today, thanks!

Haven’t fixed the state-error, but so far the error seems to be on/off, meaning that the state of the tv is sometimes shown correctly, even when turning off via the remote, and sometimes it’s not.

What kind of errors are you getting?

I got tons of the error you posted. But I see now that this doesn’t support my TV, I have the JU from 2015 which I think uses ctl. Haven’t made it work so not sure…