Commit Graph

139 Commits (678d1e367d4b78fa7e8bd5c49fca1eb29206c0b5)

Author SHA1 Message Date
epenet 3abf7ea18a
Add type hints to integration tests (m-p) (#87705) 2023-02-08 07:48:54 -08:00
epenet 4142f0d15d
Add return type to tests without arguments (#87613)
* Add return type to tests without arguments

* Black

* Cancel fixture amends
2023-02-07 14:20:06 +01:00
Franck Nijhof ca1a12898c
Enable Ruff D212 (#87347) 2023-02-03 23:08:48 +01:00
PeteRager d22e670334
Avoid Nest climate set_temperature eating error (#86920)
* Update climate_sdm.py

* Update test case to detect KeyError

* Throw a defined exception if the condition in encoutered

Include keys from device_traits in error message

* Less diagnostic information in error message
2023-01-30 08:01:41 -08:00
PeteRager a7ddd592fb
Nest improve error message on climate actions (#86853)
* Nest - Climate - Error Messages

1. Error messages were incorrect for some methods, for example async_set_temperature was reporting failure to set hvac_mode. This is corrected.
2. Error messages were incomplete and were not including the entity_id,and the operation being performed that failed.
3. Add unit tests to test the exception handling

* Move tests into exiisting error test

* Improve readability of error message
2023-01-28 12:58:28 -08:00
Michael 104f74054b
Replace the usage of unit constants by enumerations in Tests [m-n] (#85935)
* replace unit conts by enums m-n

* fix mqtt
2023-01-15 15:45:00 +01:00
Joakim Plate c576a68d33
Upgrade pytest-aiohttp (#82475)
* Upgrade pytest-aiohttp

* Make sure executors, tasks and timers are closed

Some test will trigger warnings on garbage collect, these warnings
spills over into next test.

Some test trigger tasks that raise errors on shutdown, these spill
over into next test.

This is to mimic older pytest-aiohttp and it's behaviour on test
cleanup.

Discussions on similar changes for pytest-aiohttp are here:
https://github.com/pytest-dev/pytest-asyncio/pull/309

* Replace loop with event_loop

* Make sure time is frozen for tests

* Make sure the ConditionType is not async

  /home-assistant/homeassistant/helpers/template.py:2082: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    def wrapper(*args, **kwargs):
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

* Increase litejet press tests with a factor 10

The times are simulated anyway, and we can't stop the normal
event from occuring.

* Use async handlers for aiohttp

tests/components/motioneye/test_camera.py::test_get_still_image_from_camera
tests/components/motioneye/test_camera.py::test_get_still_image_from_camera
tests/components/motioneye/test_camera.py::test_get_stream_from_camera
tests/components/motioneye/test_camera.py::test_get_stream_from_camera
tests/components/motioneye/test_camera.py::test_camera_option_stream_url_template
tests/components/motioneye/test_camera.py::test_camera_option_stream_url_template
  /Users/joakim/src/hass/home-assistant/venv/lib/python3.9/site-packages/aiohttp/web_urldispatcher.py:189: DeprecationWarning: Bare functions are deprecated, use async ones
    warnings.warn(

* Switch to freezegun in modbus tests

The tests allowed clock to tick in between steps

* Make sure skybell object are fully mocked

Old tests would trigger attempts to post to could services:

```
DEBUG:aioskybell:HTTP post https://cloud.myskybell.com/api/v3/login/ Request with headers: {'content-type': 'application/json', 'accept': '*/*', 'x-skybell-app-id': 'd2b542c7-a7e4-4e1e-b77d-2b76911c7c46', 'x-skybell-client-id': '1f36a3c0-6dee-4997-a6db-4e1c67338e57'}
```

* Fix sorting that broke after rebase
2022-11-29 22:36:36 +01:00
Marc Mueller 63d519c1a8
Spelling updates (#82867) 2022-11-28 16:51:43 +01:00
Allen Porter 7b8b73f826
Update nest climate to avoid duplicate set mode commands (#79445) 2022-10-01 21:59:10 -04:00
PeteRager 504ce8e93a
Set nest entities as unavailable on lost connection (#78773)
* NEST - Issues with lost internet connectivity #70479

Update Climate and Sensor entities to be unavailable when the device connectivity trait indicates the device is offline.

The prior behavior, the last known values would be displayed indefinitely if the device lost internet connectivity.  This was creating the illusion that the device was still connected.  With this change, the Home Assistant entities will become unavailable when the device loses connectivity.

* Update formatting

* Add doc strings, fix indentation

* Fix doc strings

* Update test_climate_sdm.py

* Update test_climate_sdm.py

* Update test_sensor_sdm.py

* Update test_sensor_sdm.py

* more formatting fixes

* Place availability logic in mixin

1. Consolidate repeated code into mixin and apply mixin to Climate and Sensor entities
2. Return true instead of super.available()
3. No unit test changes required to maintain code coverage

* Define self._device is mixin to make linter happier

* Remove logger used for debugging

* restore whitespace

* Fix test due to underlying merge change

* Update availability_mixin.py

* Move availability logic into device_info

* Update sensor_sdm.py
2022-09-28 19:23:11 -07:00
epenet f453726b18
Cleanup HVACAction and HVACMode in tests (#78813) 2022-09-20 20:30:54 +02:00
epenet fe747601ff
Cleanup DeviceClass and StateClass in tests (#78811) 2022-09-20 10:49:11 -04:00
epenet 7e41afe660
Adjust root-import in nest tests (#78769) 2022-09-19 15:41:45 +02:00
Franck Nijhof af2feb3d40
Update pyupgrade to v2.37.1 (#74989) 2022-07-11 16:54:01 +02:00
Allen Porter 1c4fee65c0
Migrate nest to new entity naming style (#74724) 2022-07-09 19:21:53 +02:00
Franck Nijhof 7cd68381f1
Search/replace RESULT_TYPE_* by FlowResultType enum (#74642) 2022-07-07 19:57:36 +03:00
Allen Porter 0cf922cc4e
Allow legacy nest integration with no configuration.yaml (#74222) 2022-06-30 08:54:51 +02:00
epenet 35df012b6e
Fix reauth step in nest (#74090) 2022-06-28 10:06:05 +02:00
Allen Porter cf9cab900e
Allow multiple configuration entries for nest integration (#73720)
* Add multiple config entry support for Nest

* Set a config entry unique id based on nest project id

* Add missing translations and remove untested committed

* Remove unnecessary translation

* Remove dead code

* Remove old handling to avoid duplicate error logs
2022-06-21 16:36:13 +02:00
Allen Porter b014d558ff
Add application credentials platform for nest and deprecate yaml for SDM API (#73050)
* Update the nest integration to be useable fully from the config flow

* Support discovery in nest config flow

* Remove configuration entries

* Remove unused import

* Remove dead code

* Update homeassistant/components/nest/strings.json

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Remove commented out code

* Use config flow for app auth reauthentication path

* Improves for re-auth for upgrading existing project and creds

* More dead code removal

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Remove outdated code

* Update homeassistant/components/nest/config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-06-15 07:15:53 -07:00
Allen Porter 0b7a030bd4
Fix fan support in nest, removing FAN_ONLY which isn't supported (#73422)
* Fix fan support in nest, removing FAN_ONLY which isn't supported

* Revert change to make supported features dynamic
2022-06-14 06:19:22 -07:00
Allen Porter 7a5fa8eb58
Update more nest tests to use common fixtures (#73303)
Update nest tests to use fixtures
2022-06-10 07:14:43 +02:00
uvjustin 73f2bca377
Make Stream.stop() async (#73107)
* Make Stream.start() async
* Stop streams concurrently on shutdown
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-06-08 00:10:53 +08:00
Allen Porter 3a8a816584
Cleanup nest config flow tests to use common setup fixtures (#72878)
* Cleanup nest config flow tests to use common setup

* Remove some conditionals in test setup
2022-06-02 21:42:52 -07:00
Erik Montnemery 47d0cc9b09
Update integrations to pass target player when resolving media (#72597) 2022-05-27 09:05:06 -07:00
Allen Porter c181af92a2
Throw nest climate API errors as HomeAssistantErrors (#72474) 2022-05-25 13:00:48 -07:00
Allen Porter 775be354a6
Cleanup nest async methods that do not need to actually await (#72170)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2022-05-20 07:47:18 -07:00
Allen Porter 5e49457c65
Add camera/stream platform diagnostics, exercised with nest (#69780) 2022-04-26 22:33:04 -07:00
Allen Porter bab9f4ba76
Fix nest error handling and bug in tests for media fetches (#70596) 2022-04-24 10:17:59 -10:00
Erik Montnemery 5e50a8abd5
Mark device triggers from hidden or auxiliary entities as secondary (#70335)
* Mark device triggers from hidden or auxiliary entities as secondary

* Update tests
2022-04-21 08:01:32 +02:00
Franck Nijhof c93c7e8eff
Replace Camera STREAM_ constants with StreamType enum (#69871) 2022-04-11 16:27:27 -07:00
Allen Porter 66a183cfe3
Add nest device level diagnostics (#68024) 2022-03-29 16:56:03 -10:00
Marc Mueller 8f69d31322
Make TypeVars private (3) (#68207) 2022-03-17 19:11:14 +01:00
Allen Porter 2678d8120a
Update nest media source to make device play most recent event (#67557) 2022-03-03 08:16:03 -08:00
Paulus Schoutsen 2a8dc38d2d
Move media_source to after_deps (#67195) 2022-02-24 14:54:46 -08:00
Allen Porter f3add292d5
Update nest climate set_temperature to allow hvac_mode (#66909) 2022-02-19 20:57:29 -08:00
Allen Porter 58551ec66d
Update nest camera tests to use common test fixture (#66192) 2022-02-17 23:08:29 -08:00
Allen Porter 572fa7d055
Update nest camera to pull still images from stream component (#66427)
* Update nest to use stream thumbnail when it exists

* Update nest camera to always pull still image from stream

Update nest camera to always pull the still iamge from the stream component,
removing the use of the separate ffmpeg call, and removing use of the nest event
image. Image for events can now be pulled using the media source APIs, rather
than relying on the camera snapshot.

* Simplify a comment

* Remove more unused variables

* Simplify comments, image, and test code

* Remove assertions for placeholder images
2022-02-14 21:45:09 -08:00
Allen Porter b2f5ab2008
Publish Nest Motion/Person events with optional user defined zone information (#66187)
Publish Nest events with zone information if present. User defined zones are configured
in the Google Home app, and are published with Motion/Person event.
2022-02-11 21:22:53 -08:00
Allen Porter ddd198de37
Fix legacy nest diagnostics to return empty rather than fail (#65824)
Fix legacy nest diangostics to return gracefully, rather than a TypError
by checking explicitiy for SDM in the config entry. Update diagnostics
to use the common nest test fixture, and extend with support for the
legacy nest config. Use the sdm test fixture in the existing legacy
tests so they all share the same config files.
2022-02-06 14:14:25 -08:00
Allen Porter 956ceb6c68
Update nest diagnostics (#65141) 2022-01-28 21:50:38 +01:00
Allen Porter ebaaa13759
Update nest climate and sensor test fixtures (#64800)
Update nest climate tests to use shared fixtures for component setup. Add an additional
fixture for creating devices shared between the climate and sensor tests.
2022-01-23 16:06:04 -08:00
Allen Porter a5fb60fd3a
Update nest media player device thumbnails (#64738) 2022-01-22 23:46:00 -08:00
Allen Porter cdf7742c3e
Refactor nest test_init_sdm tests to use fixtures with varied config types (#64736) 2022-01-22 20:56:03 -08:00
Allen Porter e56e25180b
Strip whitespace in nest cloud project id (#64503) 2022-01-20 09:13:49 +01:00
Allen Porter f1435b1385
Add diagnostic information for nest (#64405)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-01-19 09:30:48 +01:00
Allen Porter 849abaca8b
Bump google-nest-sdm to 1.5.0 and add nest mp4 clip transcoding to animated gif (#64155) 2022-01-15 12:31:02 -08:00
Allen Porter 64c5f69c3d
Add thumbnails to nest media player (#62532) 2022-01-13 22:31:33 -08:00
Marc Mueller d057850971
Update typing - collections.abc (3) (#63947) 2022-01-12 08:04:17 +01:00
Allen Porter 789c0a24dd
Improve nest media player clip/image and event handling for multiple events in a short time range (#63149) 2022-01-11 20:54:49 -08:00