* 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>
When using fuzzy matching to match entity names for intents, whichever
entity is first is preferred in the case of equal matches. This leads
to situations where entities with similar names (such as entities named
for their area and then specific area location) may be used when the
whole area is wanted.
I ran into this with the my Phillips Hue lights. I have each individual
light named such that its room is the first part of the name, and its
location within the room after. So my living room has:
Living Room West
Living Room Northwest
Living Room North
Living Room Northeast
I then have a group for the whole room:
Living Room
Because the group is the last of the entities, trying to adjust the
whole room only activates one light, because all of the lights match
equally well.
By preferring the shortest of equal matches, we prefer keys that have
the least amount of extra information, causing "Living Room" to match
the group instead of an individual light.
This adds a `cycle` attribute to select_previous/next, and
select_first and select_last services.
This is quite useful for streamlining using input_select via
automations, such as when they represent a list of states to step
through; if the first option is the dimmest and the last the brightest,
one may not want to accidentally cycle from the first to the last, for
example.
Similarly, being able to directly select the first or last removes
adjustment in related automations.
* Add typing information
* Small improvments
* Use %r for exceptions
* Added exception handlers for aiohttp.ClientError
* Added testcase
* Changes after review
* Bugfixes
* Add WiLight Fan
Add fan to WiLigt integration
* Updated fan.py and test_fan.py
* Creating new fan test
* Update homeassistant/components/wilight/__init__.py
OK!
Done!
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/wilight/fan.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/wilight/fan.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/wilight/fan.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* As MartinHjelmare requested
* Update fan.py
* Update tests/components/wilight/test_fan.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update tests/components/wilight/test_fan.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update test_fan.py
As Martin Hjelmare suggested
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Fully working proposal of config option to select what video source camera entity should use
* Bump dependency to v43
Reflect dependency changes in how image sources is now a dict
* Fix bdracos comment
* Fix memory leak in dhcp integration
Passing the L2socket to AsyncSniffer caused a memory
leak on some systems. To ensure we can create a socket,
we do a test creation before starting AsyncSniffer
since the sniffer will create it in another thread
and we cannot see any permission error otherwise.
* Update tests
* space
* do not store packets
* Add DemoCover with only tilt controls
* Add default tilt position to Pergola Roof
* Apply githooks (isort)
* Add new demo device to Google Assistant fixtures
* Improve site selection
* Reauth flow and tests
Add **kwargs to mock_aiohttp_client create_session to support inputting verify_ssl and cookie_jar
* Update homeassistant/components/unifi/config_flow.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Minor improvements
* Improve coverage
Co-authored-by: J. Nick Koston <nick@koston.org>
* add zwave_js support for climate
* fix
* add fixture
* rename fixture
* fix variable name error
* add tests
* fix tests and handle set_temp properly based on unit
* update call being tested
* fix tests
* improve coverage
* fix docstring
* address review comments
* fix test
* update enum class name
* bump zwave-js-server-python version and assume primary_value is always set
* add additional coverage
* fix docstrings and move populating modes/presets into initialization
* attempt to address comments
* improve comment
* move mode value into a variable so its easier to iterate in the future
* dont assume mode as a discovery point
* assume all values are available when node is ready
* fix order of operations
* switch to valueerror
* use primary value
* readd property and type to discovery schema