* Convert persistent notification tests to async
* Create/dismiss persistent notifications in exposed functions, not service calls
* Fix notify persistent_notification
* Remove setting up persistent_notification
* Drop more setups
* Empty methods
* Undeprecate sync methods because too big task
* Fix setup clearing notifications
* Fix a bunch of tests
* Fix more tests
* Uno mas
* Test persistent notification events
* Clean up stale comment
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Handle connection being closed in legacy samsungtv
- Mirror the websocket behavior
Fixes
```
2021-06-24 02:54:13 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.89_guestroom fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 401, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 609, in async_device_update
raise exc
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/samsungtv/media_player.py", line 124, in update
self._state = STATE_ON if self._bridge.is_on() else STATE_OFF
File "/usr/src/homeassistant/homeassistant/components/samsungtv/bridge.py", line 113, in is_on
return self._get_remote() is not None
File "/usr/src/homeassistant/homeassistant/components/samsungtv/bridge.py", line 232, in _get_remote
self._remote = Remote(self.config.copy())
File "/usr/local/lib/python3.8/site-packages/samsungctl/remote.py", line 9, in __init__
self.remote = RemoteLegacy(config)
File "/usr/local/lib/python3.8/site-packages/samsungctl/remote_legacy.py", line 32, in __init__
self._read_response(True)
File "/usr/local/lib/python3.8/site-packages/samsungctl/remote_legacy.py", line 77, in _read_response
raise exceptions.ConnectionClosed()
samsungctl.exceptions.ConnectionClosed
```
* add coverage
* pass instead
If we have the mac address from discovery, we can use it to wake
the TV. Currently the TV goes unavailable when you turn it off
as the only way to turn it back on is wake on lan or via the remote.
Users who are not using host networking can use a script instead.
Through some testing with the samsungtvws library, it was determined
that the issue is related to the short read timeout (1s). Increasing
the timeout to 10s should solve the issue.
* Added support for newer SamsungTV models
* Fixed legacy port
* store token in HA config directory
* Change token name
* rebasing and exception handling
* implement update
* fix error creating mediaplayer
* Debug logging
* Increase timeout
* Restore update timeout
* Store token_file path in config_entry
* Introduction of samsung bridge class
* Added bridge class functions
* Code cleanup
* more fixes
* Begin testing
* samsungtvws 1.2.0
* Config flow tests 0.1
* Fixed some mediaplayer tests
* Fixed fixture in media player
* use of constants and turn off
* more media player tests
* samsungtvws 1.3.1 and other fixes
* WS tv update rewritten
* more tests
* test_init
* fixed tests
* removed reset mock
* tests reset mock
* close_remote and tests
* deprecate port config
* deprecate port config 2
* deprecate port config 3
* save token only if needed
* cleanup
* better websocket protocol detection
* config removal
* added automatic protocol detection
* fix logger tests
* fix async tests
* add missin const.py
* fix log formatting
* wait for first update call
* migrate first tests
* migrated all test functions
* started to use state machine
* updated all tests to use async_setup_component
* slove hints
* update tests
* get state at correct position
* remove impossible tests
* fix autodetect tests
* use caplog fixture
* add test for duplicate
* catch concrete exceptions
* don't mock samsungctl exceptions
* add test for discovery
* get state when possible
* add test for autodetect without connection
* Moved climate components with tests into platform dirs.
* Updated tests from climate component.
* Moved binary_sensor components with tests into platform dirs.
* Updated tests from binary_sensor component.
* Moved calendar components with tests into platform dirs.
* Updated tests from calendar component.
* Moved camera components with tests into platform dirs.
* Updated tests from camera component.
* Moved cover components with tests into platform dirs.
* Updated tests from cover component.
* Moved device_tracker components with tests into platform dirs.
* Updated tests from device_tracker component.
* Moved fan components with tests into platform dirs.
* Updated tests from fan component.
* Moved geo_location components with tests into platform dirs.
* Updated tests from geo_location component.
* Moved image_processing components with tests into platform dirs.
* Updated tests from image_processing component.
* Moved light components with tests into platform dirs.
* Updated tests from light component.
* Moved lock components with tests into platform dirs.
* Moved media_player components with tests into platform dirs.
* Updated tests from media_player component.
* Moved scene components with tests into platform dirs.
* Moved sensor components with tests into platform dirs.
* Updated tests from sensor component.
* Moved switch components with tests into platform dirs.
* Updated tests from sensor component.
* Moved vacuum components with tests into platform dirs.
* Updated tests from vacuum component.
* Moved weather components with tests into platform dirs.
* Fixed __init__.py files
* Fixes for stuff moved as part of this branch.
* Fix stuff needed to merge with balloob's branch.
* Formatting issues.
* Missing __init__.py files.
* Fix-ups
* Fixup
* Regenerated requirements.
* Linting errors fixed.
* Fixed more broken tests.
* Missing init files.
* Fix broken tests.
* More broken tests
* There seems to be a thread race condition.
I suspect the logger stuff is running in another thread, which means waiting until the aio loop is done is missing the log messages.
Used sleep instead because that allows the logger thread to run. I think the api_streams sensor might not be thread safe.
* Disabled tests, will remove sensor in #22147
* Updated coverage and codeowners.