* speed_step must be an integer and a divider of 100
* use percentage_step in tests to test patch
* test with not supported percentage_step
* undo change in test_capabilities
* Use a default precision of one not percentage_step
* typo 2
* Update tests/components/alexa/test_smart_home.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/alexa/capabilities.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* First working draft of number platform
* Replace duration with delay for Hue motion sensors
Improve tests
* Bump dependency to v85
* Use constant for entity category
* Use type rather than using __class__
* Fix unique ID
* Store automation and script traces
* Pylint
* Deduplicate code
* Fix issues when no stored traces are available
* Store serialized data for restored traces
* Update WS API
* Update test
* Restore context
* Improve tests
* Add new test files
* Rename restore_traces to async_restore_traces
* Refactor trace.websocket_api
* Defer loading stored traces
* Lint
* Revert refactoring which is no longer needed
* Correct order when restoring traces
* Apply suggestion from code review
* Improve test coverage
* Apply suggestions from code review
* Add support for daily and monthly statistics
* Remove debug code
* Format code
* Don't use dateutil package
* Remove 2 TODOs
* Remove TODO
* Add comments
Camera devices may support multiple stream sources so we want to clarify that
this is meant to decide which stream source is used in the frontend only.
Will set stream_type temporarily to allow rollout without breaking nightly,
and this will be removed after frontend is updated.
* Add battery and location last_activity sensors
* Drop state attributes
* Drop ATTR_LAST_UPDATE
* Adjust tests
* Mark new sensors as disabled_default
* Add default_disabled attribute
* Add context managers
* Adjust tests for disabled entities
* Add support for entity categories to MQTT entities
* Improve test
* Apply suggestions from code review
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Update homeassistant/components/mqtt/mixins.py
Co-authored-by: Paul Monigatti <paulmonigatti@users.noreply.github.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Paul Monigatti <paulmonigatti@users.noreply.github.com>
* Add WebSocket API for intiting a WebRTC stream
See https://github.com/home-assistant/architecture/discussions/640
* Add nest support for initiating webrtc streams
Add an implementation of async_handle_web_rtc_offer in nest, with test coverage.
Issue #55302
* Rename offer variable to match overriden variable name
* Remove unnecessary checks covered by websocket function
* Update homeassistant/components/camera/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* replace base in availability topic
* add tests for availability shortcuts - fix import
* group constants
* simplified loop
* Moving constants to .const
* rename value to topic
* move CONF_TOPIC to .const
* move CONF_AVAILABILITY to .const
* remove check for string
* Silently ignore if no config topic is found.
* CONF_TOPIC should be required
* Add config_flow to Environment Canada
* Add unique_id
* Remove erroneous directory.
* Tests working!!
* Add back setup.
* First cut of import.
* Temp
* Tweak names.
* Import config.yaml.
* Clean up imports.
* Import working! Some refactor to clean it up.
* Add import test.
* Small optimization.
* Fix comments from code review.
* Remove CONF_NAME and config_flow for it.
* Fixup strings to match new config_flow.
* Fixes for comments from last review.
* Update tests to match new import code.
* Clean up use of CONF_TITLE; fix lint error on push.
* Phew. More cleanup on import. Really streamlined now!
* Update tests.
* Fix lint error.
* Fix lint error, try 2.
* Revert unique_id to use location as part of ID.
* Fix code review comments.
* Fix review comments.
* Improve Whirlpool component code
This implements a few suggestions given in
https://github.com/home-assistant/core/pull/48346#pullrequestreview-773552670
* Add return typing
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add reason assertion to config_flow test
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add WebSocket API for intiting a WebRTC stream
See https://github.com/home-assistant/architecture/discussions/640
* Increase test coverage for webrtc camera stream
* Apply suggestions from code review
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Fix transition handling for tplink light
* Apply suggestions from code review
* Test that all transitions are passed correctly
* Fix linting
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Listen for config updates from DlnaDmrEntity.async_added_to_hass
Use `Entity.async_on_remove` for dealing with callback cancellation,
instead of re-inventing the wheel with `_remove_ssdp_callbacks`.
* Use async_write_ha_state within async methods
* Import YAML config from async_setup_platform
* Import flow prompts user when device is uncontactable during migration
When config flow is able to contact a device, or when it has information
from SSDP, it will create config entries without error. If the device is
uncontactable at this point then it will appear as unavailable in HA
until it is turned on again.
When import flow cannot migrate an entry because it needs to contact the
device and can't, it will notify the user with a config flow form.
* Don't del unused parameters, HA pylint doesn't care
* Remove unused imports from tests
* Abort config flow at earliest opportunity
* Return async_abort instead of raising AbortFlow
* Consolidate config entry test cleanup into a single function
* fixup! Consolidate config entry test cleanup into a single function
Revert "Consolidate config entry test cleanup into a single function"
This reverts commit 8220da7263.
* Check resource acquisition/release in specific tests
* fixup! Check resource acquisition/release in specific tests
* Remove unused network dependency from manifest
* _on_event runs in async context
* Call async_write_ha_state directly (not via shedule_update)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Refactor Xiaomi vacuum with sensors.
This is the first step into refactoring xiaomi vacuum attributes into sensors.
What is missing are some switches and binary sensors etc.
https://github.com/home-assistant/core/issues/51361
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Use generic sensor for Xiaomi vacuum sensors.
By using HA coordinator, the generic Xiaomi sensor class can be used with these
coordinators to get the status sensors from vacuum. This also means now that
sensors are available as soon as HA starts, which is a nice plus.
Now the only reason to create a subclass of the generic sensors is when custom
value parsing needs to be done.
https://github.com/home-assistant/core/issues/51361
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Working vacuum sensors via 1 coordinator.
Vacuum needs a custom coordinator to ensure that it fetches all the needed data
and puts it in a dict. From this dict the sensors will then get their data
accordingly.
https://github.com/home-assistant/core/issues/51361
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Remove vacuum setup method in sensor
Sensor is generic enough that vacuum does not require its own setup method.
https://github.com/home-assistant/core/issues/51361
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Don't auto register generic sensors.
Let the user decide which sensor is useful for them and enable them.
https://github.com/home-assistant/core/issues/51361
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Remove converted attributes from xiaomi vacuum.
The attributes that have been converted so far should be removed from the vacuum
attributes list.
https://github.com/home-assistant/core/issues/51361
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Fetch data from vacuum sequentially.
It seems some vacuums do not like parallel requests. The requests that came
before are ignored.
https://github.com/home-assistant/core/issues/51361
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Refactor vacuum sensors to its own container.
By moving vacuum sensors to its own container, there is no more key collisions.
This in turns means that there is need for the split hack to ensure key names
are correct.
https://github.com/home-assistant/core/issues/51361
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* fixup! fix bad rebase.
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Fix sensor naming and default registration.
Use proper names for sensors, no need to include from which device status it
came.
Registration of the sensor by default has been parameterised. If the param is
not set, the sensor is not registered.
https://github.com/home-assistant/core/issues/51361
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Make vacuum platform also use coordinator for its data.
By using the coordinator for data in vacuum platfrom, removes the cases where
request gets ignored during the case where the requests are done concurrently by
separate platforms.
https://github.com/home-assistant/core/issues/51361
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Add binary sensor for vacuum
Add binary sensor for waterbox, mop, and water shortage.
https://github.com/home-assistant/core/issues/51361
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Added proper icons to sensors.
https://github.com/home-assistant/core/issues/51361
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Refactor sensors to use dataclass.
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Make vacuum use coordinator for its data.
This commit also insures that the binary sensors are only registered for devices
that include a mop.
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Minor refactoring
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Update data from coordinator after running command.
This is is to have a faster status change when executing a command like changing
fan speeds. If a manual refresh is not triggered. Worst case scenario it will
take 10s for the new fan speed to be reported in HA.
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Refresh within coroutine is ok.
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Move logging to _handle_coordinator_update
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Use internal state attribute.
Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
* Fix vacuum typing
* Fix tests constants
* Fix vacuum inconsistent return values
* Fix vacuum state update
* Fix vacuum tests
* Remove impossible cases
* Parametrize custom services test
* Move goto test
* Move clean segment test
* Move clean single segment test
* Test service pause
* Include vacuum in coverage
* Delint
* Fix vacuum sensor dict collision.
This also prevents collision for unique id. As the key is used to construct
unique ids.
* Use f strings as dict keys
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
- These devices sometimes do not respond on the first try
or may be subject to transient broadcast failures, or
overloads. We now try discovery periodically once the
integration has been loaded.
- We used to try this 4x at startup, but that solution
seemed to aggressive as we want to be sure we pickup
the devices after startup as well since the network
will likely be more calm after startup.
* Convert persistent notification tests to async
* Create/dismiss persistent notifications in exposed functions, not service calls
* Fix notify persistent_notification
* Remove setting up persistent_notification
* Drop more setups
* Empty methods
* Undeprecate sync methods because too big task
* Fix setup clearing notifications
* Fix a bunch of tests
* Fix more tests
* Uno mas
* Test persistent notification events
* Clean up stale comment
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* fix login issue
* fix:login error
* update COUNTRY_CODE_CHINA line location
* added one blank line
* feat:added line #L88 was not covered by tests
* ci build errors
Co-authored-by: erchuan <jie.zheng@tuya.com>
- These sensors wobble quite a bit and the precision did
not have sensible limits which generated a massive amount
of data in the database which was not very useful
* Add electrical measurement type state attribute.
* Add active_power_max attribute
* Skip unsupported attributes on entity update
* Fix tests
* Create sensor only if the main attribute is supported
* Refactor ElectricalMeasurement sensor to use attr specific divisor and multiplier
* Multiple entities for electrical measurement cluster
* Update discovery tests
* Sensor clean up
* update tests
* Pylint
Co-authored-by: Milan Meulemans <milan.meulemans@live.be>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
* setup and unload services does not need to be async
* Only use DECONZ_DOMAIN to decide if service should be setup
* Consolidation of functionality
* Make a service to schema dictionary
* Fix left over comments from #56717 - no need to keep UNIFI_SERVICES if we control it is only called while UNIFI_DOMAIN is empty
* Fix late comments as well
* Improve service tests
* mock.called_with was not reliable
* Apply code cleanup suggestions from previous PRs
* Update homeassistant/components/speedtestdotnet/const.py
Co-authored-by: Franck Nijhof <git@frenck.dev>
* fix native_value, and ping value in test
* use self._state instead of _attr_native_value
* update identifiers and add more tests
Co-authored-by: Franck Nijhof <git@frenck.dev>
* Don't enable any variants of the daylight sensor entities by default
* Use isinstance rather than doing ZHATYPE compare
* Accidentally removed an import
* Optimize _get_states_with_session
* Move custom filters to derived table
* Remove useless derived table
* Filter old states after grouping
* Split query
* Add comments
* Simplify state update period criteria
* Only apply custom filters if we didn't get an include list of entities
Co-authored-by: J. Nick Koston <nick@koston.org>