* Support HLS stream discontinuity.
* Clarify discontinuity comments
* Signal a stream discontinuity on restart due to stream error
* Apply suggestions from code review
Co-authored-by: uvjustin <46082645+uvjustin@users.noreply.github.com>
* Simplify stream discontinuity logic
SSDP scans no longer runs in the executor
This is an interim step that converts the async_upnp_client
response to netdisco's object to ensure fully backwards
compatibility
* Fix exception in stream idle callback
Fix bug where idle timeout callback fails if the stream previously exited.
* Add a test for stream idle timeout after stream is stopped.
* Add clarifying comment to idle timer clear method
* Clear hls timer only on stop
Separate the HLS stream view logic out of StreamOutput since the hls
stream view is about to get more complex to track discontinuities. This
makes the idle timeout, shutdown, and coupling between hls and record
more explicit.
HomeKit pairings and accessory ids from versions 0.109 and earlier are no longer
migrated on upgrade. Users upgrading directly to 2021.3 from 0.109
and older should upgrade to 2021.2 first if they wish to preserve
HomeKit configuration and avoid re-pairing the bridge.
This change does not affect upgrades from 0.110 and later.
* Remove stream_worker dependencies on Stream
Removee stream_worker dependencies on Stream and split out the logic
for writing segments to a stream buffer.
* Stop calling internal stream methods
* Update homeassistant/components/stream/worker.py
Co-authored-by: uvjustin <46082645+uvjustin@users.noreply.github.com>
* Reuse self._outputs when creating new streams
Co-authored-by: uvjustin <46082645+uvjustin@users.noreply.github.com>
* Update test harness to allow discovery_info testing.
This is a needed update, before the whole config is converted
to the new structure, because it allows test of both the old
and new configuration style.
The following changes have been made:
- Combine test functions into a single base_test.
- Prepare for new mock by combining the 2 common test functions into one.
- Change mock to be only modbusHub
- Do not replace whole modbus class, but only the class that
connects to pymodbus (modbusHub). This allows test of modbus
configurations and not only component configurations, and is needed
when testing discovery activated platform.
- Add test of climate.
Warning this is merely test of discovery,
the real cover tests still needs to be added.
- Add test of cover.
Warning this is merely test of discovery,
the real cover tests still needs to be added.
* Update comment for old config
* Do not use hass.data, but instead patch pymodbus library.
* Add test of configuration (old/new way as available).
* Move assert to test function.
Make assert more understandable by removing it from the helper.
add base_config_test (check just calls base_test) to make it clear if
test is wanted or just controlling the config.
* use setup_component to load Modbus since it is an integration.
* Optimized flow in test helper.
* Correct missed review changes
* Adjust return value for device trigger
* Drop cannot connect
* Always assume there is a unique id
* No need to yield
* Update homeassistant/components/philips_js/media_player.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Move typing to init
* Adjust typing instead of returning lambda
* Explicity return None
* Coerce into int
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add config flow to philips_js
* Adjust name of entry to contain serial
* Use device id in event rather than entity id
* Adjust turn on text
* Deprecate all fields
* Be somewhat more explicit in typing
* Switch to direct coordinator access
* Refactor the pluggable action
* Adjust tests a bit
* Minor adjustment
* More adjustments
* Add missing await in update coordinator
* Be more lenient to lack of system info
* Use constant for trigger type and simplify
* Apply suggestions from code review
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: J. Nick Koston <nick@koston.org>
* Add target to service call API
* Fix _async_call_service_step
* CONF_SERVICE_ENTITY_ID overrules target
* Move merging up before processing schema
* Restore services.yaml
* Add test
* Change the API boundary between stream and camera
Shift more of the stream lifecycle management to the camera. The motivation is to support stream urls that expire
giving the camera the ability to change the stream once it is created.
* Document stream lifecycle and simplify stream/camera interaction
* Reorder create_stream function to reduce diffs
* Increase test coverage for camera_sdm.py
* Fix ffmpeg typo.
* Add a stream identifier for each stream, managed by camera
* Remove stream record service
* Update homeassistant/components/stream/__init__.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Unroll changes to Stream interface back into camera component
* Fix preload stream to actually start the background worker
* Reduce unncessary diffs for readability
* Remove redundant camera stream start code
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Unlikely sqlite and mysql, postgresql throws ProgrammingError instead
of InternalError or OperationalError when trying to create an index
that already exists.
* Remove dependencies on keepalive from StremaOutput and stream_worker
Pull logic from StreamOutput and stream_worker into the Stream
class, unifying keepalive and idle timeout logic. This prepares
for future changes to preserve hls state across stream url changes.
* Enhance MQTT cover platform
Allow combining of position and state of MQTT cover
Add template and fix optimistic in set tilt position
Add tests
* Add abbreviations
* Add tests and stopped state
* Cleanup & fix range for templates
* Apply suggestions from code review
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Add support for limited templates (no HASS access)
* Pass variables to automation triggers
* Support templates in MQTT triggers
* Spelling
* Handle trigger referenced by variables
* Raise on unsupported function in limited templates
* Validate MQTT trigger schema in MQTT device trigger
* Add trigger_variables to automation config schema
* Don't print stacktrace when setting up trigger throws
* Make pylint happy
* Add trigger_variables to variables
* Add debug prints, document limited template
* Add tests
* Validate MQTT trigger topic early when possible
* Improve valid_subscribe_topic_template
* Mark entities as unavailable when they are removed but are still registered
* Add sync_entity_lifecycle to collection helper
* Remove debug print
* Lint
* Fix tests
* Fix tests
* Update zha
* Update zone
* Fix tests
* Update hyperion
* Update rfxtrx
* Fix tests
* Pass force_remove=True from integrations
Co-authored-by: Erik <erik@montnemery.com>
* Simplify configuration structure by removing the controller key
* Fix flake8
* Fix review comments
* Don't use migrate_entry mechanism to flatten configuration
Keep legacy configuration when creating new entries as well
* Convert old groups unique ids
Work around for walrus operator not working properly :/
* Remove CONF_GROUP_ID_BASE once entities unique id are updated
* Don't use migrate_entry mechanism to update unique_ids of groups
* Remove walrus operator :(
* Fix review comments
* Walrusify assignment to old_unique_id
* Fix backwards compatiblity with fans update to new model
There were some non-speeds and devices that report a none
speed. These problems were discovered when updating zha
tasmota and vesync to the new model in #45407
* Update coverage
* fix check
* Removed pylint disable on unused after updating CI files that were out of date.
* Pylint still fails due to bug on DOMAIN import. Added disable check.
* Addressed PR comments
* Added import for ClientError to test_config_flow.py
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Do not require admin account for foscam cameras.
Foscam cameras require admin account for getting the MAC address,
requiring an admin account in the integration is not desirable as
an operator one is good enough (and a good practice).
Old entries using the MAC address as unique_id are migrated to the
new unique_id format so everything is consistent.
Also fixed unhandled invalid responses from the camera in the
config flow process.
* Make RTSP port configurable again as some cameras reports wrong port
* Remove periods from new log lines
* Set new Config Flow version to 2 and adjust the entity migration
* Create a proper error message for the InvalidResponse exception
* Change crafted unique_id to use entry_id in the entity
* Abort if same host and port is already configured
* Fix entry tracking to use entry_id instead of unique_id
* Remove unique_id from mocked config entry in tests
* MySensors: Add type annotations
Adds a bunch of type annotations that were created
while understanding the code.
* MySensors: Change GatewayId to string
In preparation for config flow.
The GatewayId used to be id(gateway).
With config flows, every gateway will have its own
ConfigEntry. Every ConfigEntry has a unique id.
Thus we would have two separate but one-to-one related ID systems.
This commit removes this unneeded duplication by using the id of the ConfigEntry
as GatewayId.
* MySensors: Add unique_id to all entities
This allows entities to work well with the frontend.
* MySensors: Add device_info to all entities
Entities belonging to the same node_id will now by grouped as a device.
* MySensors: clean up device.py a bit
* MySensors: Add config flow support
With this change the MySensors can be fully configured from the GUI.
Legacy configuration.yaml configs will be migrated by reading them once.
Note that custom node names are not migrated. Users will have to re-enter
the names in the front-end.
Since there is no straight-forward way to configure global settings,
all previously global settings are now per-gateway. These settings include:
- MQTT retain
- optimistic
- persistence enable
- MySensors version
When a MySensors integration is loaded, it works as follows:
1. __init__.async_setup_entry is called
2. for every platform, async_forward_entry_setup is called
3. the platform's async_setup_entry is called
4. __init__.setup_mysensors_platform is called
5. the entity's constructor (e.g. MySensorsCover) is called
6. the created entity is stored in a dict in the hass object
* MySensors: Fix linter errors
* MySensors: Remove unused import
* MySensors: Feedback from @MartinHjelmare
* MySensors: Multi-step config flow
* MySensors: More feedback
* MySensors: Move all storage in hass object under DOMAIN
The integration now stores everything under hass.data["mysensors"]
instead of using several top level keys.
* MySensors: await shutdown of gateway instead of creating a task
* MySensors: Rename Ethernet to TCP
* MySensors: Absolute imports and cosmetic changes
* MySensors: fix gw_stop
* MySensors: Allow user to specify persistence file
* MySensors: Nicer log message
* MySensors: Add lots of unit tests
* MySensors: Fix legacy import of persistence file name
Turns out tests help to find bugs :D
* MySensors: Improve test coverage
* MySensors: Use json persistence files by default
* MySensors: Code style improvements
* MySensors: Stop adding attributes to existing objects
This commit removes the extra attributes that were being
added to the gateway objects from pymysensors.
Most attributes were easy to remove, except for the gateway id.
The MySensorsDevice class needs the gateway id as it is part of its DevId
as well as the unique_id and device_info.
Most MySensorsDevices actually end up being Entities.
Entities have access to their ConfigEntry via self.platform.config_entry.
However, the device_tracker platform does not become an Entity.
For this reason, the gateway id is not fetched from self.plaform but
given as an argument.
Additionally, MySensorsDevices expose the address of the gateway
(CONF_DEVICE). Entities can easily fetch this information via self.platform,
but the device_tracker cannot. This commit chooses to remove the gateway
address from device_tracker. While this could in theory break some automations,
the simplicity of this solution was deemed worth it.
The alternative of adding the entire ConfigEntry as an argument to MySensorsDevices
is not viable, because device_tracker is initialized by the async_setup_scanner function
that isn't supplied a ConfigEntry. It only gets discovery_info.
Adding the entire ConfigEntry doesn't seem appropriate for this edge case.
* MySensors: Fix gw_stop and the translations
* MySensors: Fix incorrect function calls
* MySensors: Fewer comments in const.py
* MySensors: Remove union from _get_gateway and remove id from try_connect
* MySensors: Deprecate nodes option in configuration.yaml
* MySensors: Use version parser from packaging
* MySensors: Remove prefix from unique_id and change some private property names
* MySensors: Change _get_gateway function signature
* MySensors: add packaging==20.8 for the version parser
* MySensors: Rename some stuff
* MySensors: use pytest.mark.parametrize
* MySensors: Clean up test cases
* MySensors: Remove unneeded parameter from devices
* Revert "MySensors: add packaging==20.8 for the version parser"
This reverts commit 6b200ee01a.
* MySensors: Use core interface for testing configuration.yaml import
* MySensors: Fix test_init
* MySensors: Rename a few variables
* MySensors: cosmetic changes
* MySensors: Update strings.json
* MySensors: Still more feedback from @MartinHjelmare
* MySensors: Remove unused strings
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* MySensors: Fix typo and remove another unused string
* MySensors: More strings.json
* MySensors: Fix gateway ready handler
* MySensors: Add duplicate detection to config flows
* MySensors: Deal with non-existing topics and ports.
Includes unit tests for these cases.
* MySensors: Use awesomeversion instead of packaging
* Add string already_configured
* MySensors: Abort config flow when config is found to be invalid while importing
* MySensors: Copy all error messages to also be abort messages
All error strings may now also be used as an abort reason,
so the strings should be defined
* Use string references
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Fix issue with control of cover when the target value is Up/Down instead of Open/Close
* Adjust open/close/stop cover control to account for no Open/Up or Close/Down targets
* Revert back to using values of 0/99 to close/open a cover since it is supported by all covers
* Replace RELEASE_BUTTON with False and remove unused PRESS_BUTTON in zwave_js cover
* Fix homekit options not being prefilled
When changing homekit options, the existing ones
were not being prefilled on the form.
* hide camera screen if no cameras
* Convert ozw climate values to correct units
* Remove debugger logging
* Fix black code formatting
* Remove extra spaces
* Add method descriptions and change to use setpoint
* Fix build and respond to comments
* Remove self from convert_units call
* Move method to top
* Move method outside class
* Add blank lines
* Fix test to use farenheit
* Update another value to farenheit
* Change to celsius
* Another test fix
* test fix
* Fix a value
* missed one
* Add unit test for convert_units
* fix unit test import
* Add new line to end of test file
* fix convert units import
* Reorder imports
* Grab const from different import
Co-authored-by: Trevor <tboyce021@gmail.com>
* Enable setting XY color and transition time by client
* New test for setting XY color value
* Correct block outdent
* New test for setting transition time value
* Fixed commented out code
* Add support for iCloud 2FA
* Updated dependency for iCloud
* Updated dependency and logic fix
* Added logic for handling incorrect 2FA code
* Bug fix on failing test
* Added myself to codeowners
* Added check for 2FA on setup
* Updated error message
* Remove v4 multilevel transitional currentValue workaround
This was only needed because the get-after-set was reporting a
transitional currentValue instead of the final one.
zwave-js v6.1.1 removes the get-after-set functionality completely, so
this is no longer required (and breaks status reporting entirely)
* Fix tests to check currentValue instead of targetValue as well
* Use new zwave_js client
* Remove client callbacks
* Clean up on connect and on disconnect
* Clean log
* Add stop listen to unsubscribe callbacks
* Fix most tests
* Adapt to new listen interface
* Fix most tests
* Remove stale connection state feature
* Bump zwave-js-server-python to 0.16.0
* Clean up disconnect
* Remove zwave_js devices that the controller is no longer connected to on initialization
* remove extra line break
* fix test
* Clean up
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Lint
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Do less inside try statements
* Replace controller id with config entry id since it doesn't serve a purpose anymore
* Improve how controller connection state is communicated in the client and device tracker
Remove the need to disable arguments-differ lint
* Remove broad exception handling from config flow
I'm not sure there ever was a reason for this more than to catch all exceptions
* Replace site string with constant for SSDP title_placeholders
* Unload platforms in the defacto way
* Noone reads the method descriptions
* Improve file descriptions
* Update dyson for the new fan entity model
* Fix test
* tweak
* fix
* adj
* Update homeassistant/components/dyson/fan.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* move percentage is None block
* move percentage is None block
* no need to list comp
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add first two testcases
* Remove repetition
* Add first two testcases
* Remove repetition
* Add connection error test case
* add test_setup_entry_credentials_valid
* First attempt to use fixtures
* Use markers
* Optimize patch
* Optimize marker use
* Always patch mydevolo
* Add first two testcases
* Remove repetition
* Add first two testcases
* Remove repetition
* Add connection error test case
* add test_setup_entry_credentials_valid
* First attempt to use fixtures
* Use markers
* Optimize patch
* Optimize marker use
* Always patch mydevolo
* Add unload entry test case
* Catch up with reality
* Use unittest patch
* Use core interface to start tests
* Use entry state
* Consistently assert entry state
* Patch class instead of init
Co-authored-by: Markus Bong <2Fake1987@gmail.com>