* 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
* Add support for displaying Daf Yomi
* Ran black --fast
* Added docstring to get_daf
* Further lint fixes
* Remove unnecessary else
* clarify code
* Use fstrings
* pull daf yomi from hdate
* Update manifest version for daf_yomi support
* fix variable usage
* Update requirements
* Also pass in today's date as well
* Rename date variable to daytime_date
* Add tests for daf yomi sensor
* Update stale test IDs
An AtaDevice has a boolean flag describing whether it supports energy
consumption metering. The flag was ignored resulting in sensor entities
reporting constant 0 kWh consumption.
* Update pymelcloud dependency to support the has_energy_consumed_meter
flag.
* Add ATTR_ENABLED_FN to sensor definitions for filtering out
unsupported sensors.
* Fix typing issue in sensor constructor.
* Remove unused UnitSystem constructor parameter.
* Add support for real-time data from SimpliSafe
* Updated requirements
* Linting
* Ensure dispatcher topic contains the domain
* Don't bother with a partial
* Websovket dataclass and other code review
* Ensure initial_event_to_use works with error
* Don't inline methods
* Don't abuse loop variable
* Simplify initial event retrieval
* Add connection lost and restored events
* Revert "Add connection lost and restored events"
This reverts commit e7ffe05938.
* Make _on_disconnect a static method
* Code review comments
* Allow entities to opt out of REST and/or websocket API updates
* Revert "Allow entities to opt out of REST and/or websocket API updates"
This reverts commit 1989f2e00e.
* Code review comments
* Fix issues with events not triggering correct entities
* Bug fixes
* Initial implementation of Vilfo router integration.
This commit is a combination of several commits, with commit messages in bullet form below.
* Added additional files to Vilfo integration.
* Added generated files.
* Fixed alphabetic order in generated config_flows.
* Continued implementation of config flow for Vilfo integration.
* Continued work on config_flow for Vilfo.
* Updated requirements in manifest for Vilfo Router integration.
* Some strings added to Vilfo Router integration.
* Vilfo Router integration updated with sensor support.
* Code style cleanup.
* Additional cleanup of config flow.
* Added additional UI strings for Vilfo Router
* Updated tests of config flow and fixed formatting
* Updated requirement upon vilfo-api-client.
* Sensor refactoring including support for icons
* Code style changes for Vilfo Router integration
* Code cleanup
* Fixed linting issues in Vilfo Router integration
* Fixed import order in test for Vilfo integration.
* Updates to Vilfo Router integration based on feedback
Based on the feedback received, updates have been made to the Vilfo Router integration.
A couple of the points mentioned have not been addressed yet, since the appropriate action has not yet been determined. These are:
* https://github.com/home-assistant/home-assistant/pull/31177#discussion_r371124477
* https://github.com/home-assistant/home-assistant/pull/31177#discussion_r371202896
This commit consists of:
* Removed unused folder/submodule
* Fixes to __init__
* Fixes to config_flow
* Fixes to const
* Refactored sensors and applied fixes
* Fix issue with wrong exception type in config flow
* Updated tests for Vilfo integration config_flow
* Updated dependency upon vilfo-api-client to improve testability
* Import order fixes in test
* Use constants instead of strings in tests
* Updated the VilfoRouterData class to only use the hostname as unique_id when it is the default one (admin.vilfo.com).
* Refactored based on feedback during review.
* Changes to constant names,
* Blocking IO separated to executor job,
* Data for uptime sensor changed from being computed to being a timestamp,
* Started refactoring uptime sensor in terms of naming and unit.
* Updated constants for boot time (previously uptime) sensor.
* Refactored test of Vilfo config flow to avoid patching code under test.
* UI naming fixes and better exception handling.
* Removed unused exception class.
* Various changes to Vilfo Router integration.
* Removed unit of measurement for boot time sensor,
* Added support for a sensor not having a unit,
* Updated the config_flow to handle when the integration is already configured,
* Updated tests to avoid mocking the code under test and also to cover the aforementioned changes.
* Exception handling in Vilfo Router config flow refactored to be more readable.
* Refactored constant usage, fixed sensor availability and fix API client library doing I/O in async context.
* Updated signature with hass first
* Update call to constructor with changed order of arguments
* Refresh the august access token
when needed.
Currently august will stop working when the token
expires about every six month.
This resolves issue #23788
* Make refresh_access_token_if_needed private since we do not want additional callers
* Add init
* fix unique_id computation for switches
* update konnected component to use async, config entries, registries. Pro board support and tests
* clean up formatting comments from PR
* use standard interfaces in tests
* migrate config flow to use options
* address latest pr feedback
* format for import as part of config schema validation
* address pr feedback
* lint fix
* simplify check based on pr feedback
* clarify default schema validation
* fix other schema checks
* fix translations
Co-authored-by: Nate Clark <nate@nateclark.com>
* Initial commit
* ran hassfest and gen_requirements_all scripts
* fixes per request from Paulus Schoutsen
* ran gen_requirements_all
* updated library version - removed some debug leftover
* get_requirements again...
* added documentation URL
* ran isort
* changed storage in hass.data[DOMAIN] to use entry_id instead of host
* adopted unit tests to latest fix
* Update const.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Add MELCloud integration
* Provides a climate and sensor platforms. Multiple platforms on one go
is not the best option, but it does not make sense to remove them and
commit them later either.
* Email and access token are stored to the ConfigEntry. The token can be
updated by adding the integration again with the same email address. The
config flow is aborted and the update is performed on the background.
* Run isort
* Fix pylint errors
* Run black
* Increase coverage
* Update pymelcloud dependency
* Add HVAC_MODE_OFF emulation
* Remove print
* Update pymelcloud to enable device type filtering
* Collapse except blocks and chain ClientNotReadys
* Add preliminary documentation URL
* Use list comp for creating model info
Filters out empty model names form units.
* f-string galore
Dropped 'HVAC' from AtaDevice name template.
* Delegate fan mode mapping to pymelcloud
* Fix type annotation
* Access AtaDevice through self._device
* Prefer list comprehension
* Update pymelcloud to leverage device type grouping
The updated backend lib returns devices in a dict grouped by the device
type. The devices do not necessarily need to be in a single list and
this way isinstance is not required to extract devices by type.
* Remove DOMAIN presence check
This does not seem to make much sense after all.
* Fix async_setup_entry
Entry setup used half-baked naming from few experimentations back.
The naming conventiens were unified to match the platforms.
A redundant noneness check was also removed after evaluating the
possible return values from the backend lib.
* Simplify empty model name check
* Improve config validation
* Use config_validation strings.
* Add CONF_EMAIL to config schema. The value is not strictly required
when configuring through configuration.yaml, but having it there makes
things more consistent.
* Use dict[key] to access required properties.
* Add DOMAIN in config check back to async_setup. This is required if an
integration is configured throught config_flow.
* Remove unused manifest properties
* Remove redundant ClimateDevice property override
* Add __init__.py to coverage exclusion
* Use CONF_USERNAME instead of CONF_EMAIL
* Use asyncio.gather instead of asyncio.wait
* Misc fixes
* any -> Any
* Better names for dict iterations
* Proper dict access with mandatory/known keys
* Remove unused 'name' argument
* Remove unnecessary platform info from unique_ids
* Remove redundant methods from climate platform
* Remove redundant default value from dict get
* Update ConfigFlow sub-classing
* Define sensors in a dict instead of a list
* Use _abort_if_unique_id_configured to update token
* Fix them tests
* Remove current state guards
* Fix that gather call
* Implement sensor definitions without str manipulation
* Use relative intra-package imports
* Update homeassistant/components/melcloud/config_flow.py
Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add Minecraft Server integration
* Add unit test for config flow
* Fixed some review findings and increased unit test coverage
* Fixed docstrings of new test cases
* Removed unnecessary debug log messages
* Added unique IDs and device infos and removed duplicate name validation
* Attempt to fix unit test on CI
* Return state OFF instead of UNAVAILABLE in case connection to server drops
* Added property decorator to server properties, even less debug messages, improved sensor dispatcher connection and other review findings fixed
* Moved special property handling to sensors, fixed name confusion in sensor entity, switch to HA const for scan_interval, simplified building players list string
* Improved periodic update, speeded up unit tests
* Added type hints, added callback decorator to entity update callback, added const.py to unit test exclusions
* Changed state sensor to binary sensor, removed empty unit test file, added constants for icons and units
* Let HA handle unknown state, check for None in description and players list sensor
* Removed periods at end of log messages, removed constant for default host
* Updated requirements_test_pre_commit.txt, fixed codespell findings
* Use localhost as default host
* Removed passing hass to entities, moved log message from init, moved host lower to vol, use proper patch library, patch library instead of own code
* Replaced server properties with global instance attributes, removed config option scan_interval, switch back to async_track_time_interval
* Removed description and players list sensors, added players list as state attributes to online players sensor, raise OSError instead of deprecated IOError, other minor review findings fixed
* Use MAC address for unique_id in case of an IP address as host, added getmac to manifest.json, added invalid_ip to strings.json, added new test cases for changes in config_flow, replace all IOError's with OSError, other review findings fixed
* Removed double assignment
* Call get_mac_address async safe
* Handle unavailable and unknown states to reach silver quality scale, added quality scale to manifest.json
* initial version of gdacs integration
* updated translations
* generated files
* added abbreviation
* bumped library version
* small feed entry attribute fixes
* add unit tests
* need to use original mdi name
* bumped library version
* improved entity name for earthquakes
* round vulnerability number
* typo
* support for categories
* testing support for categories
* tie longitude and latitude together
* validating categories
* simplifying setup
* passing domain as parameter
* simplified test setup
* moved test code
* simplified test code
* removed superfluous code
* changed approach to unique identifier
* changed code structure
* simplified unit system handling
* made schema a constant
* comment added
* simplifying code
* added message if location already configured
* removed unnecessary code
* simplified test code
* avoid mocking __init__
* pylint
* simplified code
* fetch categories from integration library
* setting PARALLEL_UPDATES
* setting PARALLEL_UPDATES to zero/unlimited
* added quality scale
* bump pyvizio version and add additional device info
* add patches for get_model and get_version
* change keywrod argument to positional for _test_service
* added support for multiple attachments to signal_messenger integration
* updated pysignalclirestapi version in requirements_all.txt
* reworked multiple attachments feature in signal_messenger integration
* stay backwards compatible by both allowing the "attachment" and
the "attachments" attribute.
* reworked multiple attachments feature in signal_messenger integration
* stay backwards compatible by both allowing the "attachment" and
the "attachments" attribute.
* small change in signal_messenger integration
* added deprecation warning for 'attachment' attribute
* small changes in signal_messenger integration
* use 'warning' instead of 'warn' when logging the warning message
* re-generated requirements_test_pre_commit.txt
* added tests for signal_messenger integration
* regenerated requirements_test_all.txt for signal_messenger integration
* added more signal_messenger tests
* remove signal_messenger integration files from .coveragerc
* Rewrite UniFi integration to use push messaging
* Add signalling for new clients/devices
* Update list of known wireless clients when we get events of them connecting
* Reconnection logic for websocket
* Fix failing tests
* Bump requirement to v12
* Add new tests
* Update homeassistant/components/unifi/controller.py
Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>
* Add OPNSense device_tracker
This commit adds a new component for using an OPNSense router as a
device tracker. It uses pyopnsense to query the api to look at the
arptable for a list of devices on the network.
* Run black formatting locally to appease azure
* Apply suggestions from code review
Co-Authored-By: Fabian Affolter <mail@fabian-affolter.ch>
* Fix issues identified during code review
This commit updates several issues found in the module during code
review.
* Update homeassistant/components/opnsense/__init__.py
Co-Authored-By: Fabian Affolter <mail@fabian-affolter.ch>
* Update CODEOWNERS for recent changes
* Fix lint
* Apply suggestions from code review
Co-Authored-By: Martin Hjelmare <marhje52@kth.se>
* More fixes from review comments
This commit fixes several issues from review comments, including
abandoning all the use of async code. This also completely reworks the
tests to be a bit clearer.
* Revert tests to previous format
* Add device detection to opnsense device_tracker test
This commit adds actual device detection to the unit test for the setup
test. A fake api response is added to mocks for both api clients so that
they will register devices as expected and asserts are added for that.
The pyopnsense import is moved from the module level to be runtime in
the class. This was done because it was the only way to make the
MockDependency() call work as expected.
* Rerun black
* Fix lint
* Move import back to module level
* Return false on configuration errors in setup
This commit updates the connection logic to return false if we're unable
to connect to the configured OPNsense API endpoint for any reason.
Previously we would not catch if an endpoint was incorrectly configured
until we first tried to use it. In this case it would raise an unhandled
exception. To handle this more gracefully this adds an api call early in
the setup and catches any exception raised by that so we can return
False to indicate the setup failed.
* Update tests
* Add pyopnsense to test requirements
* Rerun gen_requirements script
* Fix failing isort lint job step
Since opening the PR originally yet another lint/style checker was added
which failed the PR in CI. This commit makes the adjustments to have
this pass the additional tool's checks.
* Fix comment
* Update manifest.json
Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Pascal Vizeli <pascal.vizeli@syshack.ch>
* Rewrite of Spotify integration
* Update homeassistant/components/spotify/config_flow.py
Co-Authored-By: Paulus Schoutsen <balloob@gmail.com>
* Remove configurator dependency
* Strip whitespace from device model in case Spotify product is missing
* Ensure domain dict exists in hass data on setup entry
* Simply config validation for client id and secret
* Abort flow on any exception from spotipy
* Add tests for config flow
* Gen requirements all
* Add test package __init__
* Remove Spotify from coveragerc
* Made alias handling more robuust
* Fix supported_features for Spotify free and open accounts
* Improve error message in the logs
* Re-implement Spotify media_player
* Change media content type when play a playlist
* Process review suggestions
* Move Spotify init, static current user and supported_features
* Remove unneeded me call
* Remove playlist content type due to frontend issues
* Improve playlist handling, when context is missing
* Handle entity disabled correctly
* Handle being offline/unavailable correctly
* Bump Spotipy to 2.7.1
* Update coverage RC, mark integration silver
* Remove URI limitation, lib supports all Spotify URI's now
* Final cleanup
* Addresses Pylint error
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* upgrade to aiopylgtv 0.3.0 and corresponding simplification and cleanup of webostv state tracking
* properly handle case where Live TV is not reported in list of apps
* fix tests (entity state is no longer linked to source id)
* fix pylint checks
* avoid unnecessary retrieval of channel list
* use only standard home assistant states
* add missing tests
* readd removed test
* add zeroconf discovery support for vizio integration
* no mock_coro_func needed
* add reasonable timeout and don't log exceptions from pyvizio due to timeout
* add test to test options update and bump pyvizio to avoid timeout issues
* update requirements_*
* fix gaps in coverage
* change return hint for async_setup_entry
* use source variables instead of strings
* only get unique ID if about to create entry
* update based on review
* Revert "update based on review"
This reverts commit 0d612a90eb7d02c92061f902973e527267e3110a.
* f-string
* fix last review
* revert cleanup changes to simplify PR
* remove unnecessary ConfigFlow object variables to simplify logic
* revert cleanup changes to make review easier, noted for future cleanup
* revert cleanup changes to make review easier, noted for future cleanup
* move zeroconf service type constant to test module
* add config flow support, device registry support, available property
* raise PlatformNotReady if HA cant connect to device
* remove test logging statement and fix integration title
* store import and last user input values so user can see errors next to value that caused error
* add PARALLEL_UPDATES
* add missing type hints
* add missing type hints to tests
* fix options config flow title
* changes based on review
* better key name for message when cant connect
* fix missed update to key name
* fix comments
* remove logger from test which was used to debug and update test function names and docstrings to be more accurate
* add __init__.py to vizio tests module
* readded options flow and updated main component to handle options updates, set unique ID to serial, fixes based on review
* pop hass.data in media_player unload instead of in __init__ since it is set in media_player
* update requirements_all and requirements_test_all
* make unique_id key name a constant
* remove additional line breaks after docstrings
* unload entries during test_user_flow and test_import_flow tests to hopefully reduce teardown time
* try to speed up tests
* remove unnecessary code, use event bus to track options updates, move patches to pytest fixtures and fix patch scoping
* fix comment
* remove translations from commit
* suppress API error logging when checking for device availability as it can spam logs
* update requirements_all and requirements_test_all
* dont pass hass to entity since it is passed to entity anyway, remove entity unload from tests, other misc changes from review
* fix clearing listeners
* use config_entry unique ID for unique ID and use config_entry entry ID as update signal
* update config flow based on suggested changes
* update volume step on config import if it doesn't match config_entry volume step
* update config_entry data and options with new volume step value
* copy entry.data and entry.options before updating when updating config_entry
* fix test_import_entity_already_configured
* Refactor to use ids in data class
* Use station_id
* Refactor Netatmo to use oauth
* Remove old code
* Clean up
* Clean up
* Clean up
* Refactor binary sensor
* Add initial light implementation
* Add discovery
* Add set schedule service back in
* Add discovery via homekit
* More work on the light
* Fix set schedule service
* Clean up
* Remove unnecessary code
* Add support for multiple entities/accounts
* Fix MANUFACTURER typo
* Remove multiline inline if statement
* Only add tags when camera type is welcome
* Remove on/off as it's currently broken
* Fix camera turn_on/off
* Fix debug message
* Refactor some camera code
* Refactor camera methods
* Remove old code
* Rename method
* Update persons regularly
* Remove unused code
* Refactor method
* Fix isort
* Add english strings
* Catch NoDevice exception
* Fix unique id and only add sensors for tags if present
* Address comments
* Remove ToDo comment
* Add set_light_auto back in
* Add debug info
* Fix multiple camera issue
* Move camera light service to camera
* Only allow camera entities
* Make test pass
* Upgrade pyatmo module to 3.2.0
* Update requirements
* Remove list comprehension
* Remove guideline violating code
* Remove stale code
* Rename devices to entities
* Remove light platform
* Remove commented code
* Exclude files from coverage
* Remove unused code
* Fix unique id
* Address comments
* Fix comments
* Exclude sensor as well
* Add another test
* Use core interfaces
* Add tests
* Add FileSync test
* Fill in services.yaml for 'androidtv.adb_filesync' service
* Update example paths in services.yaml
* Bump androidtv to 0.0.37
* Bump androidtv to 0.0.37
* Bump androidtv to 0.0.37
* Import LockNotAcquiredException
* Import LockNotAcquiredException from androidtv.exceptions
* Rename 'host' to 'address'
* Add a logging statement when an ADB command is skipped
* Check hass.config.is_allowed_path(local_path)
* Add return
* Fix pylint
* Reduce duplicated code (AndroidTVDevice vs. FireTVDevice)
* Split 'adb_filesync' service into 'download' and 'upload' services
* Don't use '.get()' for required data; return if the services are already registered
* Replace "command" with ATTR_COMMAND
* Don't try to connect to a device if it is a duplicate
* Add LED control
* Bump python-velbus library to 2.0.35
To have LED control available in library
* Apply black formating
* Fix no-else-return pylint error
* Changed to f-string and more dry code
* Rewrite turn_on for LED control
* Preserve new BLE device name if one seen before the last scan but not on it
* Save an indented else block
* Use async_fire_time_changed and mock_device_tracker_conf in tests
* add KEF speakers platform for the integration
This will work with the KEF LS50 Wireless and KEF LSX speakers.
The development of this code happened on https://github.com/basnijholt/media_player.kef
* rename DATA_KEF -> DOMAIN
* use aiokef v0.2.0 and support LSX and new features
* sort imports
* fix @MartinHjelmare's suggestions
* remove _CONFIGURING
* change STATE_UNKNOWN to None
* use lat and long for unique_id
* bump aiokef to v0.2.2
* use config[ATTR] instead of config.get(ATTR)
* use getmac
* fix case when MAC is None
* use host as instance lifetime id
* fix requirements
* Use config entry unique id
* Clean up
* Backwards compatiblity note
* Fix some of Balloobs comments
* Bump dependency to v66
* Black somehow missed config flow tests...
* Move set unique ID til after possibility to update existing entry
* Add generic command functionality to denonavr
* add minimal unit tests for denonavr
* fix import order
* simplify denonavr unit test
* handle domain specific service calls with dispatcher
* update unit tests
* update unit tests
* remove unnecessary return value
* fix handling of mock instances in unit tests
* migrate webostv to new aiopylgtv version of the library and add support
for generic commands, input/button commands, and callback state updates
* update requirements
* cleanup and bump aiopylgtv version
* update webostv unit tests
* make webostv unit tests work with python 3.7
* cleanup for code checks
* cleanup and code review
* make all client request functions coroutines
* make host required for webostv configuration
* remove generic command and button functionality plus related cleanup
* fix previous track function
* update unit tests
* fix imports for unit tests
* update unit test
* further unit test updates
* remove unnecessary setup call in unit tests
* restore previous behaviour with client key config file in hass configuration directory
* Bump adb-shell to 0.1.0 and androidtv to 0.0.36
* Add test for setting up two devices
* Add test_setup_same_device_twice
* Fix test_setup_two_devices
* Fix coverage
* Coverage
* Fix flaky 'test_setup_two_devices'
* Another stab at coverage
* Rename 'address' back to 'host'
* iCloud: setup ConfigFlow and prepare for more platforms
- add config flow + tests
- fix existing services
- add play_sound & display_message services
- document services
- can use devices with the same name
- prepare to add sensor platform
* Review : not copy account conf
* Review: Safer test patch
* Review: remove reset_account
* Review: Use executor_job while IO
* Review: Use executor_job while IO 2
* Review: use hass.helpers.storage.Store()
* Review: no IO in tests
* Remove reset from services.yaml
* Review: remove authenticate.return_value = Mock()
* Review: do not initialize the api with the mocked service
* isort
* Review: @MartinHjelmare Test config flow with all steps
* Review: Fix failed tests names
* Codevov: Add one missing test
* Adding tests for vera component.
Fixing update bug in the vera climate platform.
* Updating requrements file.
* Moving vera stop to a job.
Sorting imports.
* Addressing simple PR feedback.
* Splitting tests into platforms.
* Mocking controller instead of using requests_mock.
* Updating pyvera to use version that stops threads quickly.
* Updating requirements files.
* Mocking the pyvera module, not the API.
* Addressing PR feedback.
Handling start/stop of patch in fixture.
Removing unecessary code.
* Using generator
* Add Elgato Key Light integration
* Remove passing in of hass loop
* Tweaks a comment
* Tweaks a function name
* Ensure domain namespace in data exists in entry setup
* Only create cloud user if cloud in use
* Pass context to alexa
* Update requirements
* Fix handing & design pattern for 0.30
* fix tests
* Fix lint & tests
* rename internal user
* first version of new integration
* moved icon to shared consts
* added unit tests
* transformed from geolocation to sensor integration
* alert level is now the state of the sensor
* adopted unit tests
* fixed comment
* keep all sensors registered even if the feed update fails intermittently
* bumped version of upstream library
* bumped version of integration library
* regenerated requirements
* bumped version of integration library
* bumped version of integration library
* fixed generated file
* removed commented out code
* regenerated config flow file
* update to latest integration library version
* simplified code
* removed debug log statement
* simplified code structure
* defined constant
* use core interfaces
* moved test and fixture
* sorted imports
* simplified patching
* moved fixture to central config file
* Add bandit to pre-commit and CI, use to catch known vulnerable XML parsing
* Use defusedxml instead of direct xml.etree to parse XML
* Move config to tests/bandit.yaml