Closed steve-gombos closed 3 years ago
Hey there @escoand, mind taking a look at this issue as its been labeled with a integration (samsungtv
) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)
I suppose you've added the TV manually, not by discovery, right? Then it should be visible after a restart of HA.
I did add it manually since discovery wasn't picking it up. I have restarted a couple of times and still hasn't shown up.
OK, when you say it's a completely new TV it's maybe a matter of a new discovery protocol. Are you familiar with git and code checkout and able to test this PR? https://github.com/home-assistant/core/pull/35773
Yeah, I will try this out later this evening.
@escoand So I got the patch-1 branch from your repo setup on my dev environment. Discovery is finding the TV, but once it is added I am still not seeing any devices get added. I have restarted a few times. This is all I see in the logs.
2020-06-18 19:24:32 DEBUG (SyncWorker_0) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-06-18 19:24:32 DEBUG (SyncWorker_0) [samsungtvws.remote] WS url ws://192.168.1.219:8001/api/v2/channels/samsung.remote.control?name=SG9tZUFzc2lzdGFudA==
2020-06-18 19:24:32 DEBUG (SyncWorker_0) [samsungtvws.remote] Connection closed.
2020-06-18 19:24:32 DEBUG (SyncWorker_0) [samsungtvws.remote] Get device info via rest api
I verified in fiddler I am able to hit the endpoint it looks like this is stopping at.
edit: Didn't check the HA UI log, but I do see this error:
Logger: homeassistant.components.media_player
Source: helpers/device_registry.py:133
Integration: Media player (documentation, issues)
First occurred: 10:34:19 PM (1 occurrences)
Last logged: 10:34:19 PM
Error while setting up samsungtv platform for media_player
Traceback (most recent call last):
File "/mnt/c/src/HomeAssistant/escoand/home-assistant/homeassistant/helpers/entity_platform.py", line 186, in _async_setup_platform
await asyncio.gather(*pending)
File "/mnt/c/src/HomeAssistant/escoand/home-assistant/homeassistant/helpers/entity_platform.py", line 295, in async_add_entities
await asyncio.gather(*tasks)
File "/mnt/c/src/HomeAssistant/escoand/home-assistant/homeassistant/helpers/entity_platform.py", line 362, in _async_add_entity
device = device_registry.async_get_or_create(**processed_dev_info)
File "/mnt/c/src/HomeAssistant/escoand/home-assistant/homeassistant/helpers/device_registry.py", line 131, in async_get_or_create
connections = {
File "/mnt/c/src/HomeAssistant/escoand/home-assistant/homeassistant/helpers/device_registry.py", line 133, in <setcomp>
for key, value in connections
ValueError: too many values to unpack (expected 2)
Interesting, will check this.
@escoand I will have a commit to your branch here in a little bit.
@escoand Sent a PR to your branch since I couldn't commit to it directly. Made a fix for the connections in the media_player, this gets the device added to the UI. Device is always showing as off now.
Nice, thanks, one step further. My problem is, I don't own such a new TV.
Could you try to use samsungtvws directly? Is this able to show the state and control the device?
http://{host}:8001/api/v2/ api endpoint is returning data. Sample:
{
"device": {
"FrameTVSupport": "false",
"GamePadSupport": "true",
"ImeSyncedSupport": "true",
"Language": "en_US",
"OS": "Tizen",
"PowerState": "on",
"TokenAuthSupport": "true",
"VoiceSupport": "true",
"WallScreenRatio": "0",
"WallService": "false",
"countryCode": "US",
"description": "Samsung DTV RCR",
"developerIP": "0.0.0.0",
"developerMode": "0",
"duid": "uuid:33ADA541-6483-4CC1-A5AD-9D2EEFE8B7C7",
"firmwareVersion": "Unknown",
"id": "uuid:33ADA541-6483-4CC1-A5AD-9D2EEFE8B7C7",
"ip": "192.168.1.123",
"model": "20_NIKEL_UHD_BASIC",
"modelName": "UN50TU8000FXZA",
"name": "[TV] Samsung 8 Series",
"networkType": "wireless",
"resolution": "3840x2160",
"smartHubAgreement": "true",
"ssid": "12:34:56:78:90:12",
"type": "Samsung SmartTV",
"udn": "uuid:33ADA541-6483-4CC1-A5AD-9D2EEFE8B7C7",
"wifiMac": "12:34:56:12:34:56"
},
"id": "uuid:33ADA541-6483-4CC1-A5AD-9D2EEFE8B7C7",
"isSupport": "{\"DMP_DRM_PLAYREADY\":\"false\",\"DMP_DRM_WIDEVINE\":\"false\",\"DMP_available\":\"true\",\"EDEN_available\":\"true\",\"FrameTVSupport\":\"false\",\"ImeSyncedSupport\":\"true\",\"TokenAuthSupport\":\"true\",\"remote_available\":\"true\",\"remote_fourDirections\":\"true\",\"remote_touchPad\":\"true\",\"remote_voiceControl\":\"true\"}\n",
"name": "[TV] Samsung 8 Series",
"remote": "1.0",
"type": "Samsung SmartTV",
"uri": "http://192.168.1.123:8001/api/v2/",
"version": "2.0.25"
}
Functions I tested/verified (checked) against samsungtvws directly:
I will do some more research tomorrow, since I didn't try anything with sources or buttons.
Uhhh, there is a property "PowerState": "on"
. Is this API endpoint also request-able when switched off? And is there a way to switch it on with samsungtvws (without wake-on-lan)?
No the endpoint is not available. I have only gotten it to turn on with wakeonlan, I tried just using the power toggle in the samsungtvws library, but didn't do anything to power it on.
So I am talking a look at this again tonight. Seems like this isn't setting up the remote right. A WebSocketException is being thrown here: https://github.com/escoand/home-assistant/blob/200754217418f7ef3365d218ca2b461e4578d718/homeassistant/components/samsungtv/bridge.py#L281
I just sent another PR to your repo. It increases the timeout in the _get_remote method. This seems to resolve most of the issues I was having. I will do some more testing tomorrow.
Thanks. A timeout of 5 seconds on a local network seems quite much. I wouldn't even on the internet expect that much. Probably the TV device is responding too slow.
I think I've merged too fast, some tests will fail because of the changed values...
@escoand Sorry about that. I did some more testing with the time out. 1 second just isn't enough and closes before receiving anything from the WS. The minium I have gotten this to work with is 2 seconds. So we can leave it 5 or reduce to 2 potentially.
Wondering if what I am seeing is the same issue. I keep seeing the Allow prompt on the TV continuously and even after allowing it the TV entity is not being created:
Here are the logs (the initial failures were probably due to the time it took to me to allow on the TV):
2020-08-05 09:14:52 DEBUG (SyncWorker_6) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:15:00 DEBUG (SyncWorker_6) [homeassistant.components.samsungtv] Access denied in getting remote object
2020-08-05 09:15:02 DEBUG (SyncWorker_18) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:15:22 DEBUG (SyncWorker_14) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:15:42 DEBUG (SyncWorker_32) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:15:52 DEBUG (SyncWorker_38) [homeassistant.components.samsungtv] Try config: {'name': 'HomeAssistant', 'description': 'HomeAssistant', 'id': 'ha.component.samsung', 'host': '192.168.2.252', 'method': 'legacy', 'port': None, 'timeout': 31}
2020-08-05 09:15:52 DEBUG (SyncWorker_38) [homeassistant.components.samsungtv] Failing config: {'name': 'HomeAssistant', 'description': 'HomeAssistant', 'id': 'ha.component.samsung', 'host': '192.168.2.252', 'method': 'legacy', 'port': None, 'timeout': 31}, error: [Errno 111] Connection refused
2020-08-05 09:15:52 DEBUG (SyncWorker_38) [homeassistant.components.samsungtv] Try config: {'name': 'HomeAssistant', 'host': '192.168.2.252', 'method': 'websocket', 'port': 8001, 'timeout': 31}
2020-08-05 09:15:55 DEBUG (SyncWorker_38) [homeassistant.components.samsungtv] Failing config: {'name': 'HomeAssistant', 'host': '192.168.2.252', 'method': 'websocket', 'port': 8001, 'timeout': 31}, error: {'event': 'ms.channel.unauthorized'}
2020-08-05 09:15:55 DEBUG (SyncWorker_38) [homeassistant.components.samsungtv] Try config: {'name': 'HomeAssistant', 'host': '192.168.2.252', 'method': 'websocket', 'port': 8002, 'timeout': 31}
2020-08-05 09:16:02 DEBUG (SyncWorker_38) [homeassistant.components.samsungtv] Working config: {'name': 'HomeAssistant', 'host': '192.168.2.252', 'method': 'websocket', 'port': 8002, 'timeout': 31, 'token': '*****'}
2020-08-05 09:16:02 DEBUG (SyncWorker_12) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:16:12 DEBUG (SyncWorker_16) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:16:15 DEBUG (SyncWorker_32) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:16:22 DEBUG (SyncWorker_5) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:16:25 DEBUG (SyncWorker_30) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:16:32 DEBUG (SyncWorker_22) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:16:34 DEBUG (SyncWorker_33) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:16:42 DEBUG (SyncWorker_39) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:16:44 DEBUG (SyncWorker_36) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:16:52 DEBUG (SyncWorker_5) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:16:54 DEBUG (SyncWorker_13) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:17:02 DEBUG (SyncWorker_1) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:17:04 DEBUG (SyncWorker_7) [homeassistant.components.samsungtv] Create SamsungTVWS
2020-08-05 09:17:12 DEBUG (SyncWorker_31) [homeassistant.components.samsungtv] Create SamsungTVWS
The Create SamsungTVWS
just keeps repeating.
@arsaboo This is the same issue I was having. The linked PR here has resolved the issues for me, it just needs to be code reviewed/merged. You can probably try pulling it down and running it to verify if you are seeing the same. https://github.com/home-assistant/core/pull/35773
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
The problem
Disclaimer: Just got this TV today, so don't have any prior history of this working in Home Assistant. Integration: samsungtv Model: UN50TU8000 (not listed on the integration page) OS: Tizen
The
samsungtv
integration doesn't add any entities after setting up via the config flow. I input my IP address and name, click submit, then there is a notification on the TV. I hit allow on the Home Assistant TV notification and I get a success message:After hitting finish, no entities are added, no more popup on the TV.
Environment
Problem-relevant
configuration.yaml
Traceback/Error logs
Initial Configuration:
After restart:
Additional information