Commit Graph

80 Commits (9180243a542c0edd51f28ee1d66803993b362d58)

Author SHA1 Message Date
Paulus Schoutsen 8bbbd1947d
Raise if referenced entity does not support service (#68394) 2022-03-20 16:01:58 -07:00
epenet 125ab5eb2b
Handle ConnectionClosed in SamsungTV try_connect (#68125)
* Handle ConnectionClosed in SamsungTV try_connect

* Add tests

* Add quotes around the error message

Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-03-15 08:20:24 +01:00
epenet 23b8229143
Adjust ms.remote.control error logging in SamsungTV (#67988)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-03-12 01:20:04 -10:00
epenet 9ab56bd5c8
Allow discovery to update invalid unique_id in SamsungTV (#67859)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-03-08 22:27:53 +01:00
epenet d12118a425
Fix reauth trigger in SamsungTV (#67850)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-03-08 11:02:00 +01:00
epenet 36049ac514
Batch send commands in SamsungTV (#67847)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-03-08 10:10:17 +01:00
epenet 6f38eda114
Adjust power_off for TheFrame in SamsungTV (#67841)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-03-08 08:20:58 +01:00
epenet 5b23b9a617
Adjust get_mac routine in SamsungTV (#67804)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-03-08 07:54:12 +01:00
epenet 2d4ccddd99
Fix SSDP unique id in SamsungTV config flow (#67811)
Co-authored-by: epenet <epenet@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-03-08 07:53:59 +01:00
epenet 1793c29fac
Move key sequences to bridge in SamsungTV (#67762)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-03-08 07:46:34 +01:00
epenet c70bed86ff
Adjust websocket bridge logging in SamsungTV (#67809)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-03-07 23:31:57 +01:00
epenet c5f7e7d1b0
Refactor run app in SamsungTV (#67616)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-03-04 14:37:27 -10:00
epenet 9db3e321e4
Add message for unsupported models in samsungtv (#67549)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-03-04 12:06:15 -10:00
epenet 8e3b0f6554
Cleanup mac fixtures in samsungtv tests (#67529)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-03-03 08:07:08 -10:00
epenet 74483d2669
Fix Samsung TV state when the device is turned off (#67541)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-03-03 08:06:33 -10:00
epenet b8861578ff
Implement async websocket in samsungtv (#67127)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-03-02 09:30:33 -10:00
epenet 1556868d56
Use async rest api in SamsungTV (#67369)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-02-28 09:53:42 -10:00
epenet 715d7f70f0
Adjust SamsungTV abstraction layer (#67216)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-02-25 17:15:45 +01:00
epenet a60c37cdb8
Expose Samsung wrapper as async (#67042)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-02-22 08:31:16 -10:00
epenet 3aa18ea5d8
Add installed apps to samsungtv sources (#66752)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-02-18 13:33:49 -08:00
epenet 8bf19655f1
Fix samsung mocks (#66765)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-02-17 13:04:48 -08:00
epenet 6d0a06c57a
Add type hints in samsungtv tests (#66632)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-02-17 12:47:58 -08:00
epenet a9aefb66b5
Add device info to samsungtv diagnostics (#66728)
* Add device-info to samsungtv diagnostics

* Adjust tests

Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-02-17 12:35:02 +01:00
epenet 2687f61428
Fix slow samsungtv test (#66696) 2022-02-16 16:04:50 -06:00
epenet 0138caa277
Fix side_effect patching in samsungtv tests (#66651)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-02-16 12:40:11 -08:00
epenet 2d33e435b9
Fix token refresh in samsungtv (#66533) 2022-02-16 12:28:01 -08:00
epenet 14e48bac3a
Fix SamsungTVWS mocking in samsungtv tests (#66650)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-02-16 12:13:11 -08:00
epenet cf5652737a
Cleanup samsungtv tests (#66570)
* Drop unused init method

* Add type hints to media_player tests

* Adjust test_init

* Adjust media_player

* Add type hints to conftest

* Use Mock in test_media_player

* Use lowercase in test_init

* Use relative import in diagnostics

* Add type hints to config_flow

* Adjust coveragerc

* Make gethostbyname autouse

* Cleanup gethostbyname and remote fixtures

* Drop unused fixtures

* Undo type hints and usefixtures on media_player

* Undo type hints and usefixtures in test_init

* Undo type hints in conftest

* Undo usefixtures in test_config_flow

* Format

Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-02-16 09:29:52 +01:00
epenet 52ebe58b14
Add tests for samsungtv diagnostics (#66563)
* Add tests for samsungtv diagnostics

* Adjust coveragerc

* Adjust type hints

Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-02-15 16:24:13 +02:00
Joshua Roys 9134e5c844
Get discovered zeroconf IPv6 addresses (#65462) 2022-02-11 16:46:17 -06:00
Franck Nijhof 4732e37005
Remove passing loop into sleep in SamsungTV (#66030) 2022-02-07 20:08:54 +01:00
Robert Hillis 3bd1f00b76
Use enums in samsungtv tests (#62195)
* Use enums in samsungtv tests

* uno mas
2021-12-17 16:26:53 +01:00
epenet f292691b7b
Use SsdpServiceInfo for ssdp tests (part 3) (#60334)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-25 11:46:20 -06:00
Simone Chemelli 15f62a7237
More tests optimizations for SamsungTV (#60297)
* More tests optimizations

* Apply review comments
2021-11-24 22:54:49 +01:00
Simone Chemelli 8e6a3b2799
Fix init slow tests for SamsungTV (#60245) 2021-11-24 11:25:25 +01:00
epenet 77dfeb062f
Update ZeroconfServiceInfo in tests (n-t) (#60219)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-23 10:35:44 -06:00
epenet 560546f65e
Use dataclass for DhcpServiceInfo (#60136)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-23 13:35:53 +01:00
Simone Chemelli e673d9dbd0
Fix missing mocking (#60181) 2021-11-23 11:56:16 +01:00
epenet a72a5486c2
Use ServiceInfo in samsungtv tests (#60097) 2021-11-21 16:00:59 -06:00
Paulus Schoutsen a4d9019ffc
Refactor persistent notification to no longer route all data via a service (#57157)
* 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>
2021-10-07 12:58:00 +02:00
Erik Montnemery ec52763706
Prevent 3rd party lib from opening sockets in samsungtv tests (#56334) 2021-09-18 22:24:27 -10:00
Simone Chemelli 2025afe14b
Add MAC to SamsungTV when missing (#53479)
* Add MAC when missing

* Fix I/O

* Add test for missing MAC address
2021-07-26 16:43:05 +02:00
J. Nick Koston 19b4d2e4d2
Add OUIs for legacy samsungtv (#52928) 2021-07-15 14:43:35 +02:00
Simone Chemelli 13c142a402
Fix Soundbar exclusion from SamsungTV (#51023)
* Improved check

* Fix tests

* Fix logic and tests

* Update tests
2021-07-12 08:58:53 +02:00
J. Nick Koston a71af8e9d3
Abort samsungtv config flow for existing hosts when the unique id is set (#52138)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-06-25 10:31:33 -10:00
J. Nick Koston d009f06a55
Handle connection being closed in legacy samsungtv (#52137)
* 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
2021-06-25 07:31:44 +02:00
J. Nick Koston 5695710463
Add mac address to samsungtv config entry data if missing (#51634)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-06-24 08:15:16 -10:00
J. Nick Koston 4722fdf465
Fix race condition in samsungtv turn off (#51716)
- The state would flip flop if the update happened before the TV had fully shutdown
2021-06-10 19:24:30 +02:00
J. Nick Koston ab490bc769
Ensure samsungtv reloads after reauth (#51714)
* Ensure samsungtv reloads after reauth

- Fixes a case of I/O in the event loop

* Ensure config entry is reloaded
2021-06-10 19:23:00 +02:00
J. Nick Koston b3d826f2e2
Fix samsungtv yaml import without configured name (#51204) 2021-05-28 16:06:17 +02:00