Commit Graph

74 Commits (0458bd68d9aad50f5e21700eeb1ce4cb3cfaa511)

Author SHA1 Message Date
vexofp c5a3e58994
Pass timeout to httpx in RESTful Switch ()
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-12-19 10:47:42 -10:00
vexofp 327016eaeb
Accept HTTP 200 through 206 as success for RESTful Switch () 2023-12-09 12:45:33 -10:00
Erik Montnemery 25bea91683
Use modern platform path when reporting platform config errors ()
* Use modern platform path when reporting platform config errors

* Update tests

* Address review comment

* Explicitly pass platform domain to log helpers

* Revert overly complicated changes

* Try a simpler solution
2023-12-05 15:06:13 +01:00
Erik Montnemery 80813e992d
Improve formatting of component errors ()
* Improve formatting of component errors

* Update tests
2023-11-17 23:01:00 +01:00
Erik Montnemery dd7670cacf
Improve errors for component configuration with missing keys () 2023-11-15 10:47:05 +01:00
G Johansson 61c17291fb
Move TemplateEntity to template ()
* Move TemplateEntity to template

* Rename template_entity in helpers
2023-08-24 15:37:04 +02:00
G Johansson ed18c6a013
Refactor Rest Switch with ManualTriggerEntity ()
* Refactor Rest Switch with ManualTriggerEntity

* Fix test

* Fix 2

* review comments

* remove async_added_to_hass

* update on startup
2023-08-15 11:43:47 +02:00
G Johansson aacb8aecfc
Refactor Rest Sensor with ManualTriggerEntity ()
* ManualTriggerEntity for rest sensor

* add availability test

* review comments

* last fixes
2023-08-10 21:46:56 +02:00
G Johansson 4531dbbe62
Refactor Rest Binary sensor with ManualTriggerEntity ()
* Refactor Rest Binary sensor w/ ManualTriggerEntity

* test availability

* review comments

* Use super

* Fix config
2023-08-10 12:59:23 +02:00
Allen Porter 12129e9d21
Update service call return values and error handling ()
* Update return signature of service calls

* Add timeout error handling in websocket api for service calls

* Update recorder tests to remove assertion on service call

* Remove timeout behavior and update callers that depend on it today

* Fix tests

* Add missing else

* await coro directly

* Fix more tests

* Update the intent task to use wait instead of timeout

* Remove script service call limits and limit constants

* Update tests that depend on service call limits

* Use wait instead of wait_for and add test

* Update homeassistant/helpers/intent.py

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

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-06-16 07:01:40 -07:00
epenet 580b09d0f2
Refactor XML parsing in rest ()
* Refactor XML parsing in rest

* Adjust caplog check

* Adjust

* Rename

* Simplify
2023-06-15 09:15:25 +02:00
epenet 802e907a35
Migrate rest switch to httpx () 2023-05-05 14:43:39 +02:00
Michael 323d16cc21
Add ssl_cipher_list option to rest () 2023-04-15 11:22:41 -10:00
Michael 0916701a0b
Catch ssl errors in rest ()
* catch ssl.SSLError

* add test

* fail setup on ssl error

* adjust tests
2023-04-12 06:51:41 +02:00
epenet f24634e198
Use domain constants in rest tests () 2023-04-04 14:33:41 +02:00
epenet 02e2e4d039
Add rest encoding test ()
* Add rest encoding test

* docstring
2023-03-28 16:29:24 +02:00
Erik Montnemery cf7e500a8e
Support translating entity names () 2023-03-12 15:55:04 +01:00
epenet c1589d3c89
Adjust invalid test values in rest () 2023-01-16 13:37:38 +01:00
Michael 72d3fa6d89
Replace the usage of unit constants by enumerations in Tests [o-r] () 2023-01-15 14:50:24 +01:00
Franck Nijhof 2e92fefc0a
Fix uom/device class mismatches in tests () 2022-12-21 22:47:59 +01:00
Franck Nijhof 762eb57636
Validate state class and unit of measurement for non-numeric sensors ()
* Validate state class and unit of measurement for non-numeric sensors

* Remove duration

* Fix rest tests
2022-12-06 00:07:02 +01:00
epenet 1baa5c12c0
Fix rest schema () 2022-11-11 10:08:26 -06:00
epenet c585817e67
Adjust REST schema validation ()
fixes undefined
2022-11-08 11:18:58 +01:00
epenet 934cec9778
Modernize rest switch tests ()
* Adjust rest switch tests to use schema validation

* Simplify

* Use async_setup_component in tests

* Rewrite tests

* Add patch

* Remove patch

* Adjust mock
2022-11-07 13:08:05 +01:00
epenet a0ed91e30c
Add type hints to rest tests () 2022-10-31 15:30:29 +01:00
Erik Montnemery 146ff83a16
Migrate rest binary_sensor and switch to TemplateEntity () 2022-06-28 13:53:38 -07:00
J. Nick Koston dca4d3cd61
Significantly improve yaml load times when the C loader is available () 2022-06-13 08:44:46 -10:00
Erik Montnemery 5987266e56
Refactor template entity to allow reuse ()
* Refactor template entity to allow reuse

* Fix schema and default name

* Add tests

* Update requirements

* Improve test

* Tweak TemplateSensor initializer

* Drop attributes and availability from TemplateEntity

* Use rest sensor for proof of concept

* Revert changes in SNMP sensor

* Don't set _attr_should_poll in mixin class

* Update requirements
2022-06-08 15:55:49 +02:00
epenet 831e2ace9c
Prettify yaml (tests) () 2022-03-30 11:26:08 +02:00
Simone Chemelli 969930b9c9
Remove debug print () 2022-01-05 15:34:33 +01:00
Robert Hillis d9788c2447
Use platform enums in rest tests () 2021-12-22 07:31:55 -05:00
Robert Hillis 1bd904b5b5
Use enums for rest tests ()
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-12-19 18:01:33 +01:00
Erik Montnemery aa36dde148
Correct rest sensor configured to generate timestamps () 2021-12-10 09:59:27 -08:00
Paulus Schoutsen 31153ac155
Move fixtures part 1 () 2021-11-01 20:47:05 -07:00
Chris Browet b1b782419b
Add REST sensor/binary_sensor/switch templated headers & params () 2021-10-29 16:36:47 -05:00
Ville Skyttä 5626cc4524
Use http.HTTPStatus in components/r* () 2021-10-23 20:53:39 +02:00
Chris Browet 1867d24b18
Add state_class support to Rest () 2021-10-22 13:48:13 -07:00
Paulus Schoutsen a4d9019ffc
Refactor persistent notification to no longer route all data via a service ()
* 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
Ville Skyttä 2730a27fd0
Use HTTPStatus instead of HTTP_* constants in various test mocks () 2021-10-01 15:52:45 -07:00
J. Nick Koston 30382c3dbe
Limit log spam from rest and include reason in platform retry ()
- Each retry was logging the error again
- Now we set the cause of the PlatformNotReady to allow Home Assistant to log as needed
2021-04-04 20:26:18 -07:00
Franck Nijhof 5a2b5fe7c5
Yoda assertion style removed is () 2021-03-20 13:55:10 +01:00
J. Nick Koston dd56cc8010
Fix rest sensor data misalignment with multiple sensors ()
If there were multiple rest data sources, the index needed
to be incremented by type instead of by data source/type
2021-03-17 22:47:42 +01:00
J. Nick Koston 2f3c2f5f4d
Add support for using a single endpoint for rest data () 2021-02-19 21:44:15 -08:00
Franck Nijhof 65cf2fcb6f
Drop asynctest () 2021-01-01 22:31:56 +01:00
J. Nick Koston dd0afc3b66
Create httpx helper to wrap a shared httpx.AsyncClient ()
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-12-09 17:18:57 +01:00
Jonas Lundberg a5279cc279
Upgrade respx to 0.16.2 ()
* Bump respx to 0.16.2

* Align sensor tests to use new respx mock api
2020-12-04 04:27:25 +01:00
Moritz Schmitz von Hülst 434d39a5ea
Add initial rest query params ()
* add initial rest query params

* of course I didn't run black

* fix tests

* fix tests

* add test

* reformat

* add binary sensor test

* fix tests

* add one more test and fix switch

* should not have touched that

* if you don't pay attention once
2020-11-11 09:03:55 -10:00
J. Nick Koston 9e0043fb17
Fix rest sensors with resource templates () 2020-11-04 08:52:47 +01:00
Julian Engelhardt 5230ff6640
Rest test style () 2020-10-22 10:00:48 +02:00
J. Nick Koston ad6ce5fa83
Convert rest sensors to async using httpx () 2020-10-16 19:21:13 -05:00