Commit graph

182 commits

Author SHA1 Message Date
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
Jan Bouwhuis
5d4c4a1293
Add humidifier support for Alexa (#81329) 2022-11-28 09:55:22 -10:00
epenet
e84e5f134e
Use US_CUSTOMARY_SYSTEM in tests (#80658)
* Use US_CUSTOMARY_SYSTEM in tests

* Don't update test_unit_system
2022-10-20 15:42:23 +02:00
epenet
0d696b84b2
Cleanup root component imports in tests (#78893) 2022-09-21 06:57:41 -10:00
epenet
fe747601ff
Cleanup DeviceClass and StateClass in tests (#78811) 2022-09-20 10:49:11 -04:00
epenet
52a377ca9d
Adjust root-import in alexa tests (#78766) 2022-09-19 15:38:33 +02:00
Erik Montnemery
d034ed1fc2
Remove some error prone code from Alexa tests (#76917) 2022-08-17 07:54:54 -04:00
Jan Bouwhuis
e6e5b98bc7
Allow climate operation mode fan_only as custom mode in Alexa (#76148)
* Add support for FAN_ONLY mode

* Tests for fan_only as custom mode
2022-08-04 09:13:20 +02:00
Thomas Hollstegge
f0cc565f6c
Fix Alexa: Only trigger doorbell event on actual state change to "ON" (#74924)
* Alexa: Only trigger doorbell event on actual state change to "ON"

* Remove unnecessary check for new_state

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>

* First check state is `on` before checking the old state

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2022-07-14 12:40:53 -07:00
Paulus Schoutsen
7573dc34aa
Treat thermostat unknown state like unavailable in alexa (#74220) 2022-06-30 10:00:10 -07:00
Mike Degatano
9392f59913
Trigger Alexa routines from toggles and buttons (#67889) 2022-06-29 13:56:02 +02:00
w35l3y
beab6e2e5f
Fix ended session when there isn't any response from the user (#72218)
* Fix end session when there isn't any response

This PR fixes #72153

* Added test case as requested

https://github.com/home-assistant/core/pull/72218#discussion_r881584812
2022-06-03 15:32:22 +02:00
J. Nick Koston
24d7a464e1
Refactor logbook to reduce overhead and complexity (#71509) 2022-05-08 21:47:26 -07:00
Erik Montnemery
1aaf78ef99
Remove entity category system in favor of hidden_by (#68550) 2022-05-02 09:33:16 -07:00
Erik Montnemery
e45d4d53dd
Correct time stamp format in Alexa responses (#70267) 2022-04-22 08:44:59 -07:00
Erik Montnemery
dc8e87a6f7
Exclude hidden entities from alexa (#68555) 2022-03-23 12:40:28 +01:00
Paulus Schoutsen
9c440d8aa6
Guard for non-string inputs in Alexa (#67348) 2022-02-27 12:59:05 -08:00
Paulus Schoutsen
bf138c4ffb
Alexa to handle brightness and catch exceptions (#65322) 2022-01-31 15:01:46 -08:00
w35l3y
076faaa4a4
Add support to reprompt user (#65256) 2022-01-31 10:23:26 -08:00
Erik Montnemery
7b8bbc37df
Include entity_id in Alexa state report error log (#64898) 2022-01-25 11:11:06 +01:00
Erik Montnemery
e6899416e1
Suppress Alexa state reports when not authorized (#64064) 2022-01-17 09:14:26 -08:00
Erik Montnemery
c109d59862
Fix comments in Alexa (#64289) 2022-01-17 14:22:04 +01:00
Erik Montnemery
be628a7c4d
Keep track of Alexa authorization status (#63979) 2022-01-13 09:47:31 -08:00
Erik Montnemery
6ffe04b788
Remove constant DEFAULT_CONFIG from alexa tests (#64031) 2022-01-13 11:35:16 +01:00
Franck Nijhof
99b2161365
Add input_button support to Alexa (#62592) 2021-12-23 07:36:45 +01:00
Erik Montnemery
af2e95d891
Guard against missing states in Alexa state updates (#61152) 2021-12-07 12:44:50 +01:00
Franck Nijhof
7a0ff4e2e1
Add button support to Alexa (#60163) 2021-11-23 08:19:13 -08:00
Ville Skyttä
a598d9f353
Use HTTPStatus instead of HTTP_ consts and magic values in components/a* (#57988) 2021-10-22 14:21:34 +02:00
Jan Bouwhuis
a679ebcee7
Patch for Alexa percentage_step to precision (#58062)
* speed_step must be an integer and a divider of 100

* use percentage_step in tests to test patch

* test with not supported percentage_step

* undo change in test_capabilities

* Use a default precision of one not percentage_step

* typo 2

* Update tests/components/alexa/test_smart_home.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/alexa/capabilities.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-10-20 13:05:11 +02:00
Jan Bouwhuis
e73ca9bd18
Alexa fix Fan support and cleanup (#56053)
* del PowerLevelController, ena fan PowerController

* Use AlexaRangeContoller for speed or default

* Update tests

* no-else-return

* Avoid cases with only one preset_mode

* Only report ghost_mode to Alexa - fix bug

* Add some tests for patched code

* pylint

* pylint and tests with one preset_mode

* correct ghost preset mode check in test

* add tests for RangeController

* ghost preset_mode locale agnostic

* isort

* Update homeassistant/components/alexa/capabilities.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/alexa/entities.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/alexa/entities.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/alexa/entities.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/alexa/entities.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update entities.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-09-24 08:14:45 +02:00
Elliot Morales Solé
097fae0348
Correct Alexa scene activation (#56469)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-09-20 22:51:17 -07:00
Jan Bouwhuis
755835ee2e
Alexa - Remove legacy speed support for fan platform (#55174)
* Remove legacy fan speed support

* remove fan range controller tests

* retrigger tests
2021-09-06 10:19:57 +02:00
J. Nick Koston
4d122fc366
Update alexa lock to support locking, unlocking, jammed (#52841) 2021-07-20 23:21:05 -05:00
Jan Bouwhuis
7403ba1e81
Alexa fan preset_mode support (#50466)
* fan preset_modes

* process preset mode updates from alexa correctly

* add tests

* codecov patch additional tests
2021-05-31 20:58:01 +02:00
Paulus Schoutsen
5ea2dd8ce3
Alexa: Set Equalizer property to retrievable (#50730) 2021-05-17 09:26:37 +02:00
Erik Montnemery
1230c46e1e
Use supported_color_modes in alexa (#49174) 2021-04-14 09:18:49 +02:00
Paulus Schoutsen
05aeff5591
Describe Google Assistant events (#49141)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-04-13 09:31:01 -07:00
Paulus Schoutsen
2ebca88950
Fix Alexa doorbells (#47257) 2021-03-02 15:13:45 +01:00
Paulus Schoutsen
7c2545af6e
Use async_capture_events to avoid running in executor (#47111) 2021-02-26 13:28:52 -08:00
J. Nick Koston
6707496c5d
Update alexa for new fan model (#45836) 2021-02-19 22:45:14 -08:00
Paulus Schoutsen
538df17a28
Restore Google/Alexa extra significant change checks (#46335) 2021-02-10 16:30:29 +01:00
Paulus Schoutsen
4739e8a207
Limit data sending to Alexa to significant changes (#45563) 2021-01-26 15:48:35 +01:00
Paulus Schoutsen
732cf47ff6
Filter some Alexa reports that are duplicate (#45093)
* Filter some Alexa reports that are duplicate

* When state changes during reporting, only report last state, not all state changes
2021-01-13 16:54:54 +01:00
Paulus Schoutsen
69b5176730
Make Alexa custom ID unique (#44839)
* Make Alexa custom ID unique

* Lint

* Lint
2021-01-05 17:35:28 +01:00
Franck Nijhof
65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
ochlocracy
178b2d8c22
Update display categories in Alexa (#41626)
* Add new display categories from Alexa Smart Home API

* Update Vacuum entities to use VACUUM_CLEANER category.

* Update Automation entities to use ACTIVITY_TRIGGER category.

* Update tests for Automation entities to use ACTIVITY_TRIGGER category.
2020-10-11 11:09:05 -05:00
springstan
6a7caad8dc
Use content type json constant (#40312) 2020-09-23 20:21:55 +02:00
Paulus Schoutsen
ba75856f2b
Do not break Alexa sync when encounter bad entity (#39380) 2020-08-30 14:36:00 +02:00
Franck Nijhof
1c2ebdf307
Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
J. Nick Koston
6b7a7939d2
Include the first seen context data in the logbook api (#39194)
* Include the context_entity_id in the logbook api

context_entity_id is the first entity seen during
a time period that includes the context

* update test

* more of them

* include friendly name

* pylint wants a ternary

* Refactor

* performance

* fix homekit context

* Fix self describing events

* Fix external_events
2020-08-24 12:44:40 -05:00