home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.01k stars 29.65k forks source link

SamsungTV integration re discover TV any time after reboot #64465

Closed landaisbenj closed 2 years ago

landaisbenj commented 2 years ago

The problem

HA discover my samsungtv (i just have one), and so i could add the integration. But after every restart, HA want to add my tv every time.. (with translation error).

image

I can ignore, but why this... [EDIT] After adding twice, i have this after rebooting: image

What version of Home Assistant Core has the issue?

core-2021.12.10

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

samsungtv

Link to integration documentation on our website

https://www.home-assistant.io/integrations/samsungtv

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

landaisbenj commented 2 years ago

So for information, after start by HA i have this :

log ``` 2022-03-08 13:59:27 DEBUG (MainThread) [custom_components.samsungtv] Samsung device found via DHCP: DhcpServiceInfo(ip='192.168.0.15', hostname='localhost', macaddress='e47dbd325f3a') 2022-03-08 13:59:27 DEBUG (MainThread) [samsungtvws.async_rest] Get device info via rest api 2022-03-08 13:59:27 DEBUG (MainThread) [samsungtvws.helper] Processing API response: {"event":"ms.channel.connect","data":{"id":"daaa2900-9e5b-11ec-8488-fbf32eaee30c","clients":[{"id":"daaa2900-9e5b-11ec-8488-fbf32eaee30c","connectTime":1646687788944,"attributes":{"name":"SG9tZUFzc2lzdGFudA==","token":"None"},"deviceName":"SG9tZUFzc2lzdGFudA==","isHost":false}]}} 2022-03-08 13:59:27 DEBUG (MainThread) [samsungtvws.connection] SamsungTVWS websocket event: {'event': 'ms.channel.connect', 'data': {'id': 'daaa2900-9e5b-11ec-8488-fbf32eaee30c', 'clients': [{'id': 'daaa2900-9e5b-11ec-8488-fbf32eaee30c', 'connectTime': 1646687788944, 'attributes': {'name': 'SG9tZUFzc2lzdGFudA==', 'token': 'None'}, 'deviceName': 'SG9tZUFzc2lzdGFudA==', 'isHost': False}]}} 2022-03-08 13:59:27 DEBUG (MainThread) [custom_components.samsungtv] Created SamsungTVWSBridge for 192.168.0.15 2022-03-08 13:59:27 DEBUG (MainThread) [samsungtvws.async_rest] Get device info via rest api 2022-03-08 13:59:27 DEBUG (MainThread) [samsungtvws.helper] Processing API response: { "id": "uuid:c6a2ea35-bba2-4a2c-96a5-b84cc702b90d", "name": "[TV] Samsung", "version": "2.1.0", "device": { "type": "Samsung SmartTV", "duid": "uuid:c6a2ea35-bba2-4a2c-96a5-b84cc702b90d", "model": "16_JAZZL_UHD", "modelName": "UE65KU6680", "description": "Samsung DTV RCR", "networkType": "wireless", "ssid": "70:fc:8f:f2:db:8c", "ip": "192.168.0.15", "firmwareVersion": "Unknown", "name": "[TV] Samsung", "id": "uuid:c6a2ea35-bba2-4a2c-96a5-b84cc702b90d", "udn": "uuid:c6a2ea35-bba2-4a2c-96a5-b84cc702b90d", "resolution": "3840x2160", "countryCode": "FR", "msfVersion": "2.1.0", "smartHubAgreement": "true", "VoiceSupport": "true", "GamePadSupport": "true", "wifiMac": "E4:7D:BD:32:5F:3A", "developerMode": "0", "developerIP": "", "OS": "Tizen" }, "type": "Samsung SmartTV", "uri": "https://192.168.0.15:8002/api/v2/", "remote": "1.0", "isSupport": "{\"remote_available\":\"true\",\"remote_fourDirections\":\"true\",\"remote_touchPad\":\"true\",\"remote_voiceControl\":\"true\",\"DMP_available\":\"true\",\"DMP_DRM_PLAYREADY\":\"false\",\"DMP_DRM_WIDEVINE\":\"false\",\"EDEN_available\":\"true\"}" } 2022-03-08 13:59:27 DEBUG (MainThread) [custom_components.samsungtv] Device info on 192.168.0.15 is: {'id': 'uuid:c6a2ea35-bba2-4a2c-96a5-b84cc702b90d', 'name': '[TV] Samsung', 'version': '2.1.0', 'device': {'type': 'Samsung SmartTV', 'duid': 'uuid:c6a2ea35-bba2-4a2c-96a5-b84cc702b90d', 'model': '16_JAZZL_UHD', 'modelName': 'UE65KU6680', 'description': 'Samsung DTV RCR', 'networkType': 'wireless', 'ssid': '70:fc:8f:f2:db:8c', 'ip': '192.168.0.15', 'firmwareVersion': 'Unknown', 'name': '[TV] Samsung', 'id': 'uuid:c6a2ea35-bba2-4a2c-96a5-b84cc702b90d', 'udn': 'uuid:c6a2ea35-bba2-4a2c-96a5-b84cc702b90d', 'resolution': '3840x2160', 'countryCode': 'FR', 'msfVersion': '2.1.0', 'smartHubAgreement': 'true', 'VoiceSupport': 'true', 'GamePadSupport': 'true', 'wifiMac': 'E4:7D:BD:32:5F:3A', 'developerMode': '0', 'developerIP': '', 'OS': 'Tizen'}, 'type': 'Samsung SmartTV', 'uri': 'https://192.168.0.15:8002/api/v2/', 'remote': '1.0', 'isSupport': '{"remote_available":"true","remote_fourDirections":"true","remote_touchPad":"true","remote_voiceControl":"true","DMP_available":"true","DMP_DRM_PLAYREADY":"false","DMP_DRM_WIDEVINE":"false","EDEN_available":"true"}'} 2022-03-08 13:59:27 DEBUG (MainThread) [samsungtvws.helper] Processing API response: { "id": "uuid:c6a2ea35-bba2-4a2c-96a5-b84cc702b90d", "name": "[TV] Samsung", "version": "2.1.0", "device": { "type": "Samsung SmartTV", "duid": "uuid:c6a2ea35-bba2-4a2c-96a5-b84cc702b90d", "model": "16_JAZZL_UHD", "modelName": "UE65KU6680", "description": "Samsung DTV RCR", "networkType": "wireless", "ssid": "70:fc:8f:f2:db:8c", "ip": "192.168.0.15", "firmwareVersion": "Unknown", "name": "[TV] Samsung", "id": "uuid:c6a2ea35-bba2-4a2c-96a5-b84cc702b90d", "udn": "uuid:c6a2ea35-bba2-4a2c-96a5-b84cc702b90d", "resolution": "3840x2160", "countryCode": "FR", "msfVersion": "2.1.0", "smartHubAgreement": "true", "VoiceSupport": "true", "GamePadSupport": "true", "wifiMac": "E4:7D:BD:32:5F:3A", "developerMode": "0", "developerIP": "", "OS": "Tizen" }, "type": "Samsung SmartTV", "uri": "https://192.168.0.15:8002/api/v2/", "remote": "1.0", "isSupport": "{\"remote_available\":\"true\",\"remote_fourDirections\":\"true\",\"remote_touchPad\":\"true\",\"remote_voiceControl\":\"true\",\"DMP_available\":\"true\",\"DMP_DRM_PLAYREADY\":\"false\",\"DMP_DRM_WIDEVINE\":\"false\",\"EDEN_available\":\"true\"}" } 2022-03-08 13:59:27 DEBUG (MainThread) [custom_components.samsungtv] Device info on 192.168.0.15 is: {'id': 'uuid:c6a2ea35-bba2-4a2c-96a5-b84cc702b90d', 'name': '[TV] Samsung', 'version': '2.1.0', 'device': {'type': 'Samsung SmartTV', 'duid': 'uuid:c6a2ea35-bba2-4a2c-96a5-b84cc702b90d', 'model': '16_JAZZL_UHD', 'modelName': 'UE65KU6680', 'description': 'Samsung DTV RCR', 'networkType': 'wireless', 'ssid': '70:fc:8f:f2:db:8c', 'ip': '192.168.0.15', 'firmwareVersion': 'Unknown', 'name': '[TV] Samsung', 'id': 'uuid:c6a2ea35-bba2-4a2c-96a5-b84cc702b90d', 'udn': 'uuid:c6a2ea35-bba2-4a2c-96a5-b84cc702b90d', 'resolution': '3840x2160', 'countryCode': 'FR', 'msfVersion': '2.1.0', 'smartHubAgreement': 'true', 'VoiceSupport': 'true', 'GamePadSupport': 'true', 'wifiMac': 'E4:7D:BD:32:5F:3A', 'developerMode': '0', 'developerIP': '', 'OS': 'Tizen'}, 'type': 'Samsung SmartTV', 'uri': 'https://192.168.0.15:8002/api/v2/', 'remote': '1.0', 'isSupport': '{"remote_available":"true","remote_fourDirections":"true","remote_touchPad":"true","remote_voiceControl":"true","DMP_available":"true","DMP_DRM_PLAYREADY":"false","DMP_DRM_WIDEVINE":"false","EDEN_available":"true"}'} 2022-03-08 13:59:27 DEBUG (MainThread) [samsungtvws.async_remote] Get app list 2022-03-08 13:59:27 DEBUG (MainThread) [samsungtvws.helper] Processing API response: {"event":"ed.installedApp.get","data":{"data":[{"appId":"111299001912","app_type":2,"icon":"/opt/down/webappservice/apps_icon/FirstScreen/111299001912/250x250.png","name":"YouTube"},{"appId":"3201909019271","app_type":2,"icon":"/opt/down/webappservice/apps_icon/FirstScreen/3201909019271/250x250.png","name":"PrivacyChoices"},{"appId":"3201606009910","app_type":2,"icon":"/opt/down/webappservice/apps_icon/FirstScreen/3201606009910/250x250.png","name":"CANAL+"},{"appId":"3201703012029","app_type":2,"icon":"/opt/down/webappservice/apps_icon/FirstScreen/3201703012029/250x250.png","name":"OCS"},{"appId":"3201601007250","app_type":2,"icon":"/opt/down/webappservice/apps_icon/FirstScreen/3201601007250/250x250.png","name":"Google Play Films et séries"},{"appId":"org.tizen.browser","app_type":4,"icon":"/opt/down/webappservice/apps_icon/LocalIcon/org.tizen.browser.png","name":"Web Browser"},{"appId":"20162100006","app_type":2,"icon":"/opt/down/webappservice/apps_icon/FirstScreen/20162100006/250x250.png","name":"e-Manual"},{"appId":"11101200001","app_type":2,"icon":"/opt/down/webappservice/apps_icon/FirstScreen/11101200001/250x250.png","name":"Netflix"},{"appId":"3201512006785","app_type":2,"icon":"/opt/down/webappservice/apps_icon/FirstScreen/3201512006785/250x250.png","name":"Prime Video"},{"appId":"3201511006428","app_type":2,"icon":"/opt/down/webappservice/apps_icon/FirstScreen/3201511006428/250x250.png","name":"Rakuten TV"},{"appId":"3201704012212","app_type":2,"icon":"/opt/down/webappservice/apps_icon/FirstScreen/3201704012212/250x250.png","name":"RMC Sport"},{"appId":"3201901017640","app_type":2,"icon":"/opt/down/webappservice/apps_icon/FirstScreen/3201901017640/250x250.png","name":"Disney+"},{"appId":"3201606009684","app_type":2,"icon":"/opt/down/webappservice/apps_icon/FirstScreen/3201606009684/250x250.png","name":"Spotify - Musique et podcasts"}]},"from":"host"} 2022-03-08 13:59:27 DEBUG (MainThread) [samsungtvws.connection] SamsungTVWS websocket event: {'event': 'ed.installedApp.get', 'data': {'data': [{'appId': '111299001912', 'app_type': 2, 'icon': '/opt/down/webappservice/apps_icon/FirstScreen/111299001912/250x250.png', 'name': 'YouTube'}, {'appId': '3201909019271', 'app_type': 2, 'icon': '/opt/down/webappservice/apps_icon/FirstScreen/3201909019271/250x250.png', 'name': 'PrivacyChoices'}, {'appId': '3201606009910', 'app_type': 2, 'icon': '/opt/down/webappservice/apps_icon/FirstScreen/3201606009910/250x250.png', 'name': 'CANAL+'}, {'appId': '3201703012029', 'app_type': 2, 'icon': '/opt/down/webappservice/apps_icon/FirstScreen/3201703012029/250x250.png', 'name': 'OCS'}, {'appId': '3201601007250', 'app_type': 2, 'icon': '/opt/down/webappservice/apps_icon/FirstScreen/3201601007250/250x250.png', 'name': 'Google Play Films et séries'}, {'appId': 'org.tizen.browser', 'app_type': 4, 'icon': '/opt/down/webappservice/apps_icon/LocalIcon/org.tizen.browser.png', 'name': 'Web Browser'}, {'appId': '20162100006', 'app_type': 2, 'icon': '/opt/down/webappservice/apps_icon/FirstScreen/20162100006/250x250.png', 'name': 'e-Manual'}, {'appId': '11101200001', 'app_type': 2, 'icon': '/opt/down/webappservice/apps_icon/FirstScreen/11101200001/250x250.png', 'name': 'Netflix'}, {'appId': '3201512006785', 'app_type': 2, 'icon': '/opt/down/webappservice/apps_icon/FirstScreen/3201512006785/250x250.png', 'name': 'Prime Video'}, {'appId': '3201511006428', 'app_type': 2, 'icon': '/opt/down/webappservice/apps_icon/FirstScreen/3201511006428/250x250.png', 'name': 'Rakuten TV'}, {'appId': '3201704012212', 'app_type': 2, 'icon': '/opt/down/webappservice/apps_icon/FirstScreen/3201704012212/250x250.png', 'name': 'RMC Sport'}, {'appId': '3201901017640', 'app_type': 2, 'icon': '/opt/down/webappservice/apps_icon/FirstScreen/3201901017640/250x250.png', 'name': 'Disney+'}, {'appId': '3201606009684', 'app_type': 2, 'icon': '/opt/down/webappservice/apps_icon/FirstScreen/3201606009684/250x250.png', 'name': 'Spotify - Musique et podcasts'}]}, 'from': 'host'} 2022-03-08 13:59:28 DEBUG (MainThread) [custom_components.samsungtv] Generated app list: {'CANAL+': '3201606009910', 'Disney+': '3201901017640', 'Google Play Films et séries': '3201601007250', 'Netflix': '11101200001', 'OCS': '3201703012029', 'Prime Video': '3201512006785', 'PrivacyChoices': '3201909019271', 'RMC Sport': '3201704012212', 'Rakuten TV': '3201511006428', 'Spotify - Musique et podcasts': '3201606009684', 'Web Browser': 'org.tizen.browser', 'YouTube': '111299001912', 'e-Manual': '20162100006'} 2022-03-08 13:59:32 DEBUG (MainThread) [custom_components.samsungtv] Checking if TV 192.168.0.15 is on using websocket 2022-03-08 13:59:42 DEBUG (MainThread) [custom_components.samsungtv] Checking if TV 192.168.0.15 is on using websocket 2022-03-08 13:59:52 DEBUG (MainThread) [custom_components.samsungtv] Checking if TV 192.168.0.15 is on using websocket 2022-03-08 14:00:02 DEBUG (MainThread) [custom_components.samsungtv] Checking if TV 192.168.0.15 is on using websocket 2022-03-08 14:00:12 DEBUG (MainThread) [custom_components.samsungtv] Checking if TV 192.168.0.15 is on using websocket ```

and this appear : image

epenet commented 2 years ago

Can you please download the full log, and attach it please (don't copy paste as it is harder to read)

epenet commented 2 years ago

Can you please also attach the latest diagnostics (they contain more information since 2022.3)?

landaisbenj commented 2 years ago

For sure, sorry. config_entry-samsungtv-d60f4b349f3570c2a46676978086bd5a.json.txt home-assistant.log

epenet commented 2 years ago

I have created PR #67859. You can test it before it is merged by replacing the config_flow.py file in your custom component with this patched file: https://raw.githubusercontent.com/home-assistant/core/971c6531ee9c40235be899215b9260c32f127efa/homeassistant/components/samsungtv/config_flow.py

landaisbenj commented 2 years ago

Ok seems to work 😊 all work and discover disappear

epenet commented 2 years ago

For reference can you post log here? And add comment on the PR

landaisbenj commented 2 years ago

home-assistant.log config_entry-samsungtv-d60f4b349f3570c2a46676978086bd5a.json.txt

landaisbenj commented 2 years ago

i'm too slow ^^

rootkgh commented 2 years ago

it is resolve only re dicover case

i confirm re-authentication everydays my TV is UN65KS8000 (2016 Ver.)

TV power off, log is "TimeoutError" flug out, log change "ConnectionRefusedError"

flug in, do something and require re-authentication

i attatch dev log and 2022.2.9 log (same situation, buy log is simple)

i erase DHCP line because it has macaddress in dev log home-assistant.log.2022.3.4-dev.txt home-assistant.log.2022.2.9.txt

epenet commented 2 years ago

@rootkgh please update to latest dev. The ConnectionFailure issue should have been fixed with #67850

rootkgh commented 2 years ago

when flug out and in, re-authentication is solved

change point

  1. when ha restart, samsungtv device is twice, so i do delete previous device and use new device it is only once core.device_registry's id is remain old and new id, so i delete old id others files is changed to new id

  2. when flug in, cause new warnning image

attatch log file home-assistant.log_2022.3.4_dev2.txt e

epenet commented 2 years ago

This one will be solved when https://github.com/xchwarze/samsung-tv-ws-api/pull/72 is merged and the library is updated inside HA:

2022-03-09 21:33:40 WARNING (MainThread) [custom_components.samsungtv] Unexpected ConnectionFailure trying to get remote for 192.168.1.6, please report this issue: ConnectionFailure({'event': 'ms.voiceApp.hide'})

For this one, I think it is only temporary. Maybe it happens because the TV is turning on (accepting connection, but not yet fully responding):

2022-03-09 21:33:19 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2022-03-09 21:33:19 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.samsung_un65ks8000 is taking over 10 seconds
2022-03-09 21:33:29 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
2022-03-09 21:33:39 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
djansen1987 commented 2 years ago

Issue is still not resolved for me. Still i get an access pop-up every time i turn on the TV

epenet commented 2 years ago

Check the settings on the TV: Device Connection Manager Make sure it is set to First Time Only.

djansen1987 commented 2 years ago

Check the settings on the TV: Device Connection Manager Make sure it is set to First Time Only.

This has solved it for me. Thank you!