* 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
* Mikrotik now uses the device_tracker standard attributes for "ip" and "mac"
The "mac_address" and "ip_address" attributes have been removed.
* Update homeassistant/components/mikrotik/device_tracker.py
* Change zeroconf name to be based of prettier name rather than hostname to help user understand what device is discovered
Have a full zeroconf discovery message in tests
Clean up unusued globals
* Use non-formatted serial number for config entry title as well
* Discover devices from device_trackers with router sources
* Update homeassistant/components/dhcp/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* fix stop being called on the wrong context
* clean
* move it to base
* cleanup was too agressive
* Update homeassistant/components/dhcp/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* coverage
* revert legacy changes
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Move adding unique id to config entry from setup_entry to migrate_entry
* Normalise unique ID
* MQTT subscribe should still use the serial number in the way the device itself expects
* Improve dhcp discovery for somfy_mylink to handle multiple devices
* Fix ip
* normalize
* logging debug
* force str
* we need a str
* fix tests
* add tests
* pylint
* Add bulb 6 multi color device state fixture
* Add light test foundation
* Add no cover comment for todo code
* Update hs_color
* Test turn on light
* Test light turn off
* Fix brightness comparison
* Test setting same brightness
* Test setting same rgb color
* Test color temp update
* Test setting same color temp
* Add entity module to coverage calculation
* Fix typing
* Move Plex->Sonos playback service from integration to platform
* Test against 'native' Plex media_players
* Add Plex to Sonos after_dependencies
* Remove circular dependency
* Raise exceptions in failed service calls
* Add test to forward service call from Sonos
* Additional Sonos->Plex tests
* Fix docstring
* No code duplication for profile application
* Refactor color profile as a dataclass
* Typing
* Make color_x and color_y of a Light profile optional
* Update tests
* Make brightness field of a Light profile optional
* Transition can be of a float type
* Allow fractional transition times in light profiles
Make transition of a float type.
Allow transition to be optional with 5 column CSV files.
* Make pylint happy
* Fix dropped async_mock
* Simplify CSV row schema
* Roomba cleanups
Remove async_step_init backwards compat
Move urls to description_placeholders.
Fix typos
* fix test
* fix fallback to manual when roomba is in the wrong state
* Clear cached nest event images after expiration
* Don't share removal cleanup with alarm cleanup
Don't share code across these functions since it would require a dummy timestamp values that is unnecessary.
* Increase test coverage on sdm camera remove
* Update homeassistant/components/nest/camera_sdm.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Allow picking default TTS language
* Fix test
* Fix coroutine function
* Improve test coverage
* Remove stale import
* Clean up hass
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Cleanups for somfy_mylink
* Use the target/unique_id to configure reverse
* Simplify options flow
* Various code review cleanups
* Deprecate YAML
* revert get change
* revert get change
* add note about empty response
* move CONF_DEFAULT_REVERSE out of loop
* Update homeassistant/components/somfy_mylink/config_flow.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Ensure we deepcopy options
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add entry setup and unload test
* Test home assistant stop
* Test on connect and on disconnect
* Test client connect timeout
* Test ready node added
* Test non ready node added
* Test existing node not ready
* Test device registry state
* Add common test tools module
* Add existing ready node test
* Include init module in coverage calculation
* Clean docstrings
* Unmark tests as flaky (though still flaky)
This put tests into the broken state where they are flaky and do not yet pass
* Fix bug in test_hls_stream with incorrect path
* Enable and de-flake HLS stream tests
Background: Tests encode a fake video them start a stream to be decoded. Test
assert on the decoded segments, however there is a race with the stream worker
which can finish decoding first, and end the stream which ereases all buffers.
Breadown of fixes:
- Fix the race conditions by adding synchronization points right before the
stream is finalized.
- Refactor StreamOutput.put so that a patch() can block the worker
thread. Previously, the put call would happen in the event loop which was
not safe to block. This is a bit of a hack, but it is the simplist possible
code change to add this synchronization and arguably provides slightly better
separation of responsibilities from the worker anyway.
- Fix bugs in the tests that make them not pass, likely due to changes
introduced while the tests were disabled
- Fix case where the HLS stream view recv() call returns None, indicating
the worker finished while the request was waiting.
The tests were previously failing anywhere from 2-5% of the time on a lightly
loaded machine doing 1k iterations. Now, have 0% flake rate. Tested with:
$ py.test --count=1000 tests/components/strema/test_hls.py
Safe mode was added to work around a race condition where
the mdns announcment was sent too early and would cause
pairing to fail. Since this has been corrected in
HAP-python, there is no longer a need to have
safe mode.
* Run zwave_js scaffold (#44891)
* Add zwave_js basic connection to zwave server (#44904)
* add the basic connection to zwave server
* fix name
* Fix requirements
* Fix things
* Version bump dep to 0.1.2
* fix pylint
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Bump zwave-js-server-python to 0.2.0
* Use zwave js server version check instead of fetching full state (#44943)
* Use version check instead of fetching full state
* Fix tests
* Use 0.3.0
* Also catch aiohttp client errors
* Update docstring
* Lint
* Unignore zwave_js
* Add zwave_js entity discovery basics and sensor platform (#44927)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Complete zwave_js typing (#44960)
* Type discovery
* Type init
* Type entity
* Type config flow
* Type sensor
* Require typing of zwave_js
* Complete zwave_js config flow test coverage (#44955)
* Correct zwave_js sensor device class (#44968)
* Fix zwave_js KeyError on entry setup timeout (#44966)
* Bump zwave-js-server-python to 0.5.0 (#44975)
* Remove stale callback signal from zwave_js (#44994)
* Add light platform to zwave_js integration (#44974)
* add light platform
* styling fix
* fix type hint
* Fix typing
* Update homeassistant/components/zwave_js/const.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/zwave_js/entity.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/zwave_js/entity.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/zwave_js/entity.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/zwave_js/entity.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/zwave_js/entity.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* color temp should be integer
* guard Nonetype error
* Update homeassistant/components/zwave_js/light.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/zwave_js/light.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* some fixes after merging
* add additional guards for None values
* adjustments for rgb lights
* Fix typing
* Fix black
* Bump zwave-js-server-python to 0.6.0
* guard value updated log
* remove value_id lookup as its no longer needed
* fiz sending white value
* Update homeassistant/components/zwave_js/light.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add zwave_js test foundation (#44983)
* Exclude text files from codespell
* Add basic dump fixture
* Add test foundation
* Fix test after rebase
* Exclude jsonl files from codespell
* Rename fixture file type to jsonl
* Update fixture path
* Fix stale docstring
* Add controller state json fixture
* Add multisensor 6 state json fixture
* Update fixtures
* Remove basic dump fixture
* Fix fixtures after library bump
* Update codeowner
* Minor cleanup Z-Wave JS (#45021)
* Update zwave_js device_info (#45023)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Marcel van der Veldt <m.vanderveldt@outlook.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
With 250 clients, there were about 18000 timers updated every
minute. To avoid this, we check which entities should be set
to not_home only once every second.
* feat: add stop to openzwave (mqtt) cover
* Fix isort and black linter
* Remove supported_features for cover.
As suggested by @MartinHjelmare, not needed anymore because base class
implementation is sufficient.
https://github.com/home-assistant/core/pull/44622#discussion_r549854542
* Make a simpler version depending on idempotency
qt-openzwave already implements idempotency, see:
77e414217f/qt-openzwave/source/qtozwvalueidmodel.cpp (L180)
We can use it and trigger button release anywhen.
* Clean up
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* non optimistic
* test restored state
* ups
* review
* Ensure the entity is not in optimistic mode
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Disambiguate HTTPUnauthorized on user/password validation
The HA core API usually returns 401 when the request does not
have proper authentication tokens or they have expired.
However the user/password validation endpoint may also return
401 when the given user/password is invalid.
The supervisor is currently unable to distinguish both scenarios,
and it needs to.
See https://github.com/home-assistant/supervisor/issues/2408
* Return 404 if user& password are not found/valid
* Fix test for invalid user/password
* Use parent_id to find cause of events with new contexts
When looking up the causing event for logbook display, use the `parent_id`
of the current context if the current context just points back to the
current event.
This now shows in the logbook the cause of an event in the case that a
component has created a new context from an existing context and tied
them together via the `Context.parent_id`.
* Fix exception when parent event not available
* Use async_Log_entry to avoid jump into executor
* useEndTime2hour - 2 hours
* useEndTime4hour - 4 hours
* indefinite - Until I change it
These changes have been tested with an ecobee3 lite running firmware
version 4.5.81.200
Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
* Remove sensor-scaling, handled by the back-end
* Correct assert-values
* Update test-fixtures
* Revert "Correct assert-values"
This reverts commit f1a1891f73.
* Adapt value to the updated userdata set
* Link to plugwise v0.8.5, update fixtures
* Correct test-values
* Fix typo
* Make async_get_device connections Optional, default None
* Remove unnecessary async_get_device connections arg usages
Some of these were using an incorrect collection type, which didn't
cause issues mostly just due to luck.
* Capture nest still images from events
Use python google-nest-sdm API for fetching images. Update home assistant
to use the google-nest-sdm API for fetching the image contents generated
by the server. This uses the existing websession object for server fetches,
reducing the amount of new code and facilites unit testing using the existing
mechanism.
Simplify tests using the image fetch API rather than a snapshot API
* Updates following comments in PR 44728
* Make all api calls in same thread context
* Set API as parameter to get_all_pools_data
* extract pools data retrieval function to api class
* Re-add support for dynamic groups
* Add tests
* Add support for manufacturer
* Refactor support for dynamic groups
* Bump pychromecast to 7.7.0
* Bump pychromecast to 7.7.1
* Tweak tests
* Apply review suggestion
* Adding switch code for harmony activities
* Working on-off
* Removing poll code for now
* Async updates for current activity
* Update our state based on events
* Notifications we got connected or disconnected
* Remove unncessary constructor arg
* Initial switch tests
* Additional tests for switch transitions
* Test transitions for availability
* Testing switch state changes
* Tests passing
* Final tests
* Updating manifest.
* Correctly mock the return value from a call to the library
* Adding new subscriber classes
* Update class name and location
* Got the refactor working locally.
* Tests passing
* Tracking state changes
* Remove write_to_config_file - this appears to never be read.
It was added far back in the past to account for a harmony library
change, but nothing ever reads that path.
Removing that side effect from tests is a pain - avoid the side effect
completely.
* Connection changes tested
* Clean up temporary code
* Update .coveragerc for harmony component
Specifically exclude untested files instead of the whole module
* Fix linting
* test sending activity change commands by id
* Improving coverage
* Testing channel change commands
* Splitting subscriber logic into it's own class
* Improve coverage and tighten up .coveragerc
* Test cleanups.
* re-add config file writing for harmony remote
* Create fixture for the mock harmonyclient
* Reduce duplication in subscription callbacks
* use async_run_job to call callbacks
* Adding some tests for async behaviors with subscribers.
* async_call_later for delay in marking remote unavailable
* Test disconnection handling in harmony remote
* Early exit if activity not specified
* Use connection state mixin
* Lint fix after rebase
* Fix isort
* super init for ConnectionStateMixin
* Adding @mkeesey to harmony CODEOWNERS
* Add nearest method
* Add tests
* Move urls to consts
* Simplify config flow
* Fix tests
* Update tests
* Use in instead get
* Fix AirlyError message in tests
* Fix manual update entity tests
* Clean up tests
* Fix after rebase
* Increase test coverage
* Format the code
* Fix after rebase
* Add logbook and device trigger platforms to Shelly
Add `logbook` platform for describing “shelly.click” event
Add `device_trigger` platform for adding automation based on click events:
Example of logbook event:
Shelly 'single' click event for Test I3 channel 3 was fired.
(Test I3 is the name of the device)
Example of automation triggers:
First button triple clicked
First button long clicked and then single clicked
First button double clicked
First button long clicked
First button single clicked and then long clicked
First button single clicked
Second button triple clicked
..
Second button single clicked
* Fix codespell
* Remove pylint added for debug
* Add tests
* Rebase
* Fix Rebase & Apply PR review suggestions
Fix tests after rebasing
Use `INPUTS_EVENTS_DICT` for input triggers
Apply PR suggestions
* First implementationof Ondilo component support
* Update manifest toadd pypi pkg dependency
* Update entities name and corrected refresh issue
* Changed percentage unit name
* Corrected merge issues
* Updated coveragerc
* cleaned up code and corrected config flow tests
* Code cleanup and added test for exisitng entry
* Changes following PR comments:
- Inherit CoordinatorEntity instead of Entity
- Merged pools blocking calls into one
- Renamed devices vars to sensors
- Check supported sensor types
- Stop relying on array index position for pools
- Stop relying on attribute position in dict for sensors
* Corrected unit test
* Reformat sensor type check
* Bump PyTado to v0.10.0
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* Tado: switch to getDeviceInfo
This function has been introduced in version 0.10.0 of PyTado.
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* Tado: update tests
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* Add tilt control for RFXtrx Rfy venetian blinds
* Update Rfy cover test
* Update the required version of pyRFXtrx
* Update required pyRFXtrx version to 0.26.1
* Revert "Update required pyRFXtrx version to 0.26.1"
This reverts commit d54f1645d5.
* Revert "Update the required version of pyRFXtrx"
This reverts commit ac36d65326.
* Update required version of pyRFXtrx to 0.26.1
* @dzukero
Update required version of pyRFXtrx to 0.26.1
* Make requested changes from review
* Fix isort
* Remove set tilt position support
* Remove set tilt position support per review
* Add service to enable / disable music mode
* Black reformat
* Update test
* Fix tests
* Revert consts cleanup
* Use entity method as service call
* Use ATTR for service call
* Sort
* Add tests
* Fix isort
* Fix print
* Black
* Add Config Flow to bmw_connected_drive
* Fix checks for bmw_connected_drive
* Adjust code as requested
* Clean .coveragerc after merge
* Use references for config flow
* Fix execute_service check against allowed accounts
* Adjust translation as username can be email or phone no
* Add BMWConnectedDriveBaseEntity mixin, remove unnecessary type casts
* Use BaseEntity correctly, fix pylint error
* Bump bimmer_connected to 0.7.13
* Adjustments for review
* Fix pylint
* Fix loading notify, move vin to entity attrs
* Remove vin from device registry
* Remove commented-out code
* Show tracker warning only if vehicle (currently) doesn't support location
* Remove unnecessary return values & other small adjustments
* Move original hass_config to own domain in hass.data
* Move entries to separate dict in hass.data
* Remove invalid_auth exception handling & test as it cannot happen
Co-authored-by: rikroe <rikroe@users.noreply.github.com>
* Improve error handling user experience
This is meant to make the nest integration quieter. Exceptions are handled with a single log error message.
Co-authored-by: j-stienstra <65826735+j-stienstra@users.noreply.github.com>
* Simplify nest event handling
Use device specific update callbacks rather than a global callback.
The motivation is to prepare for a follow up change that will store
camera specific event tokens on the camera itself, so that a service
can later fetch event specific image snapshots, which would be difficult
to send across the event bus.
* Increase nest camera test coverage
* Remove unnecessary device updates for nest cameras
* Remove unused imports
* Fix device id check to look at returned entry
* Remove unused imports after rebase
* Partial revert of nest event simplification
* Push more update logic into the nest library
* Revert nest device_info changes
* Revert test changes to restore global update behavior
* Bump nest library version to support new callback interfaces
* Periodically attempt to discover new wemo devices
* Set self._stop=None after stopping the periodic discovery task
* Use the async_fire_time_changed test helper to simplify test_discovery
* Stop the pywemo registry outside of the async loop
* Add a comment describing why async_fire_time_changed is used
Siri always requests auto mode even when the device does not
support auto which results in the thermostat failing to turn
on as success is assumed. We now determine the heat cool
target mode based on the current temp, target temp, and
supported modes to ensure the thermostat will reach the
requested target temp.
* Move Legacy Works With Nest integration to subdirectory
Motivation is to streamline the actively developed integration e.g. make code coverage easier to reason about and simplify __init__.py
* Connect concurrently to discovered Zerproc lights
* Add return type to connect_light
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add options flow for Recollect Waste
* Add test
* Typing
* Typing
* Typing AGAIN
* Add missing type hints
* Code review
* Code review
* Don't need to block until done
* Use a singleton for the Wemo registry and fan services
* Undo changes to the wemo subscription registry
* Use an entity service helper to register the Wemo fan services
* Fix Wemo fan test (missing ATTR_ENTITY_ID)
* Use the function name directly rather than a string
* Improve test coverage of the set_humidity service
* Add tests for the wemo component.
* Prefer mock tools from tests.async_mock over importing asynctest directly
* Avoid using `entity/entities` except when referring to an `Entity` instance in wemo tests
* Remove the overridden event_loop fixture from the wemo tests
* Patch the library code, not the integration code, in the wemo tests
* Add support for temperature range in thermostat.
* Add tests for setting temperature range.
* Update Lennox E30/Ecobee 3 tests to reflect new supported feature
* Add support for thermostate mode specific min/max temp values.