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

Samsung TV disappears after latest update #2

Closed
Krocko opened this issue Dec 26, 2019 · 25 comments
Closed

Samsung TV disappears after latest update #2

Krocko opened this issue Dec 26, 2019 · 25 comments

Comments

@Krocko
Copy link

Krocko commented Dec 26, 2019

My Samsung TV (QE55Q7CGM) disappeared from home assistant after the update 1.2.4.
I have the following error in the log:

Thu Dec 26 2019 19:46:18 GMT+0100 (CET)

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 408, in _async_add_entity
    await entity.async_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 286, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 796, in state_attributes
    for attr in ATTR_TO_PROPERTY
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 797, in <dictcomp>
    if getattr(self, attr) is not None
  File "/config/custom_components/samsungtv_custom/media_player.py", line 319, in source_list
    self._gen_installed_app_list()
  File "/config/custom_components/samsungtv_custom/media_player.py", line 229, in _gen_installed_app_list
    app_list = self._remote.app_list()
TypeError: 'NoneType' object is not callable
@jaruba jaruba closed this as completed in 390e7e2 Dec 26, 2019
@jaruba
Copy link
Owner

jaruba commented Dec 26, 2019

I've made a new release, please try it.

@Krocko
Copy link
Author

Krocko commented Dec 26, 2019

I updated to v.1.2.5
After the first reboot of home assistant the tv was visible but error again in the log.
After the second reboot all is working again.

Thanks for your fast fix.

@jaruba
Copy link
Owner

jaruba commented Dec 26, 2019

glad to hear it! if the new feature works correctly, it should now also show the running app in HA

@Krocko
Copy link
Author

Krocko commented Dec 26, 2019

I can‘t see the running app in ha.

@jaruba
Copy link
Owner

jaruba commented Dec 26, 2019

Are you setting app_list? (as explained in Configuration)

Make sure to "Allow" the HA connection on the TV again (you should get a pop-up about it), updating this component requires refreshing permission on the TV.

@Krocko
Copy link
Author

Krocko commented Dec 26, 2019

No I don‘t set up app_list. It is autogenerated. All apps are visible in the dropdown. Should i add app_list to my config? How to get this numbers?
I allowed the connection again.

@jaruba
Copy link
Owner

jaruba commented Dec 26, 2019

There is a list here of some known tizen apps and their IDs:
tavicu/homebridge-samsung-tizen#26 (comment)

But running apps should be visible with the autogenerated list too.. Although I didn't test it yet with autogenerated lists..

@jaruba
Copy link
Owner

jaruba commented Dec 26, 2019

I've added a link to that list in the Readme and published a new release.. You can skip the update to not need to "Allow" HA again, as there are no code changes 😄

@Krocko
Copy link
Author

Krocko commented Dec 27, 2019

I updated again and added 'Prime Video', 'YouToube' and 'DS Video' to the app_list.
The running app is showing for 'YouTube' and 'DS Video', but not for 'Prime Video'.

@jaruba
Copy link
Owner

jaruba commented Dec 27, 2019

Not entirely sure what to say about that. But I found a new way of checking for the running app which might give better results. I'll ping you when I get it implemented.

@Krocko
Copy link
Author

Krocko commented Dec 27, 2019

Great. Thanks.

@Krocko
Copy link
Author

Krocko commented Dec 27, 2019

With the latest version I get this error:

Fri Dec 27 2019 16:13:16 GMT+0100 (CET)

'visible'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 133, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1235, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 205, in handle_service
    self._platforms.values(), func, call, service_name, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 336, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 369, in _handle_service_platform_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 286, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 796, in state_attributes
    for attr in ATTR_TO_PROPERTY
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 797, in <dictcomp>
    if getattr(self, attr) is not None
  File "/config/custom_components/samsungtv_custom/media_player.py", line 337, in source
    self._source = self._remote.get_running_app()
  File "/config/custom_components/samsungtv_custom/samsungtvws/remote.py", line 234, in get_running_app
    if root['visible']:
KeyError: 'visible'

Edit:
I get this if I specify app_list
Also the tv disappeared again.
If I use autogenerated the tv is visible and I don‘t get the error.

@jaruba
Copy link
Owner

jaruba commented Dec 27, 2019

@Krocko made a new release, try it pls

@Krocko
Copy link
Author

Krocko commented Dec 27, 2019

The error is gone. But the input is showing TV/HDMI all the time.

@jaruba
Copy link
Owner

jaruba commented Dec 27, 2019

I hope the new one that I just released works for you, won't be able to work on this in the next few days.

@Krocko
Copy link
Author

Krocko commented Dec 27, 2019

It is still the same.

@jaruba
Copy link
Owner

jaruba commented Dec 27, 2019

I just reinstalled it to test, i had to accept about 20 pop-ups (for some reason) on 2 TVs, but after that, it works perfectly fine for me.

@zbeky
Copy link

zbeky commented Dec 29, 2019

Hi, thanks for your work on this project. Unfortunatelly I can't get running app neither - alway showing TV/HDMI. No errors in log. Deleted all known devices on TV and generated new token file. App list is autogenerated

@Krocko
Copy link
Author

Krocko commented Dec 29, 2019

This don‘t work with app_list: autogenerated
U must specify the apps. An also with specified apps this don‘t work for all apps.

@zbeky
Copy link

zbeky commented Dec 29, 2019

Is there some way to list all apps with their IDs? Something like http://TV_IP:8001/api/v2/applications/ (which just returns 404)? Because I am mainly using local apps that are not listed in those 2 app lists in documentation. Thanks

@Krocko
Copy link
Author

Krocko commented Dec 29, 2019

I am also interested in this but I don‘t found any other list.

@jaruba
Copy link
Owner

jaruba commented Dec 29, 2019

@Krocko I hope it started working for you again after the last update.

@zbeky @Krocko I have thoroughly investigated all the APIs I could find from Samsung. I could not find any way of getting the app list from the TV, except the method that the component already uses, which is a WebSocket API, not a HTTP(s) API, so just opening a link in the browser to get the app list isn't an option.. Or at least not one that I know of yet.

The current method that is used to get the autogenerated list can be viewed here:
https://github.com/jaruba/ha-samsungtv-custom/blob/master/custom_components/samsungtv_custom/samsungtvws/remote.py#L169-L184

With all this said, I can't imagine why some apps wouldn't work, as @Krocko says one app doesn't show when it's running.. @Krocko please try the following link: http://{host}:8001/api/v2/applications/{value} and replace {host} with the TV IP and {value} with the ID of the app that is not working, do this when the app is running, and post the content from that page here so I can see what's going on.

@zbeky @Krocko I also don't know yet why it doesn't work with the autogenerated list, it should, but I didn't get to debugging this scenario yet.. I'll try fixing it in the future when I get some time.

(still out of country btw)

@Krocko
Copy link
Author

Krocko commented Dec 29, 2019

Thank you for working on this.
This is the output with opened Prime Video App.

{"id":"3201512006785","name":"Prime Video","running":false,"version":"1.2.4","visible":false}

@jaruba
Copy link
Owner

jaruba commented Dec 29, 2019

There is definitely something wrong with that response.. we're monitoring the visible state of the apps. So you can better understand this:

  • "running": false means the app is not even currently started, keep in mind, an app can be running but not visible, as in.. it can be running but in the background

  • "visible": false means that the app is not currently visible, in this case, the app can be either running or not.. if it's running, then the app is running in the background

So your TV not only says this app isn't visible, but also that it's not even running. I guess this can be either a bug in the Tizen OS version, or the app itself.. We can't really do something about what the TV says about apps..

But I know a WebSocket endpoint to get app info, that hopefully includes visible, that might help with this or it might not.. Can't be sure as your TV has issues with this one app, it might have issues with it through the WebSocket API too..

Maybe you're using the wrong app ID for Prime Video? Can you open the Prime Video app by clicking it in the list from HA?

@Krocko
Copy link
Author

Krocko commented Dec 29, 2019

Yes, i can open the app if I select the entry in the app list.

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

No branches or pull requests

3 participants