Files
core/homeassistant/components
Ong Vairoj d7b7370c82 Samsung TV can't turn off after idle period (#14587)
When Samsung TV is idle for a period of time after issued a command,
subsequent 'turn_off' command won't turn off the TV. The issue is seen
in Samsung models with websocket as discussed in #12302.

== Reproducible Steps
1. Turn on TV (either via HA or directly).
2. Issue some commands e.g. volume ups / downs.
3. Wait for ~1 minute.
4. Issue turn_off command via HA. TV won't turn off.
5. Issue subsequent turn off commands won't turn off TV still.
6. However, issue some other commands e.g. volume ups / downs multiple
times in a row and then turn_off will turn off the TV.

== Root Cause
The underlying websocket connection opened by samsungctl get closed
after some idle time. There was no retry mechanism so issued commands
would intermittently fail but the subsequent one would succeed when
`_remote` get recreated. With `turn_off()`, however, there is an
additional call to `self.get_remote().close()` which indirectly caused
new connection to be created and then closed immediately. This causes the
component to stuck in failure mode when turn_off command is repeatly
issued.

== The Fix
Recreate the connection and retry the command if connection is closed
to avoid silent failures due to connection closed. Also set `_remote`
to None after calling close() to put it in correct state.

This fix eliminates intermittent command failure and failure mode in
turn_off().
2018-06-09 09:22:34 -04:00
..
2018-01-20 22:35:38 -08:00
2018-06-07 22:44:07 -04:00
2018-05-29 23:14:58 +02:00
2018-06-01 19:41:20 +02:00
2018-06-06 22:42:01 -04:00
2018-06-07 16:00:42 +02:00
2018-04-06 18:06:47 +02:00
2018-01-29 23:37:19 +01:00
2018-06-08 07:46:34 +02:00
2018-06-07 16:30:20 -04:00
2018-05-12 17:46:00 -04:00
2018-06-03 23:01:48 +02:00
2018-05-14 13:05:52 +02:00
2018-02-17 10:29:14 +01:00
2018-01-29 23:37:19 +01:00
2018-05-27 20:16:30 +02:00
2018-06-01 08:41:40 +02:00
2018-03-30 23:38:29 +02:00
2018-01-20 22:35:38 -08:00
2018-01-20 22:35:38 -08:00
2018-02-11 09:20:28 -08:00
2018-01-27 11:58:27 -08:00
2018-03-30 21:33:30 +02:00
2018-02-01 11:24:02 +01:00
2018-04-18 15:46:44 -04:00
2018-06-05 10:49:54 -04:00
2018-04-16 21:00:13 +02:00
2018-05-26 18:42:52 +02:00
2018-01-20 22:35:38 -08:00
2018-01-30 14:44:05 -08:00
2018-05-13 17:58:57 +02:00
2018-03-03 19:23:55 +01:00
2018-01-20 22:35:38 -08:00
2018-02-11 09:20:28 -08:00
2018-06-05 10:49:54 -04:00
2018-05-18 13:37:43 -04:00
2018-01-18 23:37:24 +01:00
2017-12-26 11:12:28 -08:00
2018-02-11 09:20:28 -08:00
2018-05-25 06:39:41 +02:00
2018-02-11 09:20:28 -08:00
2018-03-29 19:45:25 -07:00
2018-05-14 13:05:52 +02:00
2018-01-22 22:54:41 -08:00
2018-01-29 23:37:19 +01:00
2018-02-11 09:20:28 -08:00
2018-05-14 09:13:59 +02:00
2018-02-17 10:29:14 +01:00
2018-04-02 10:36:38 +02:00
2018-05-08 13:43:07 +02:00
2018-03-28 15:50:09 -07:00
2018-05-13 18:01:10 +02:00
2018-05-02 09:15:30 -04:00
2018-02-17 21:49:32 -08:00
2018-01-15 23:08:48 +01:00
2018-06-07 16:30:20 -04:00
2018-01-09 23:55:14 -08:00