* Rename BinarySensorDevice to BinarySensorEntity
* Tweak
* Move deprecation warning to __new__, add test
* Move deprecation warning back to __init__
* Move deprecation warning to __init_subclass
* Support XML conversion for RESTful sensors
Many devices continue to use XML for RESTful
APIs. Interfacing with these APIs requires custom
integrations or command line fork()/exec() overhead
which many of these devices can work with as if
they were JSON using xmltojson via this spec:
https://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html
This change implements converting XML output to
JSON via xmltojson so it can work with the existing
rest sensor component. As the attributes that
usually need to be scraped are deeper in the document
support for passing in a template to find the
JSON attributes that have been added. JSON APIs that
do not have their attributes at the top level
can also benefit from this change.
* Auto convert xml, change out the template for jsonpath
* Address review items and potentially unexpected normalize behavior with jsonpath
* Revert "Address review items and potentially unexpected normalize behavior with jsonpath"
This reverts commit fe9e179092.
* json_dict[0] turned out to be needed
* Make rest sensor a little bit more flexible and allow the response to be a list with 0th element being a dictionary
* Black formatter wanted a different formatting
* Added test case for a list response with dict as 0th element
* Fixed lint error - it thinks a + STRING is an avoidance of using % sequences for log messages; I generally prefer explicit + rather than string juxtaposition for combining string literals, but sounds like that's not the standard
* Fixed test case -- I added it to the wrong scenario and need to use the one with json_attrs.
* Fix digest auth rest sensors
* Refactor to use request()
* Fix black complaints
* Don't rename data variable
Don't rename the data variable, appears several other sensors have been coded to rely on it
* Fix tests
test_setup_missing_schema:
Change the exception to check for to PlatformNotReady. With the change away from prepared statements, we no longer get the MissingSchema error during setup - we get it when we attempt to call the endpoint. Since the result is PlatformNotReady, which is what we want, and the error log clearly contains a note that the schema is incorrect I think this is fine.
test_setup_failed_connect & test_setup_timeout:
These aren't checking for minimum config, and they're not invoking the correct method to have the default config filled in. Therefore I've just added the correct minimum config so these can continue to test what they're there to test.
test_update_request_exception:
Testing a request exception with the assert on line 404! Excellent. Anyway, we've moved from using the requests Session object to the requests.request function - so the patch needed to be altered to ensure the RequestException was raised.
* Remove no longer needed import
* Fix binary sensor test in same way
* 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.