core/homeassistant/helpers
Miguel Camba 5175737b60
Add Valve integration (#102184)
* Add Valve integration.

This adds the valve integration discussed in https://github.com/home-assistant/architecture/discussions/975
Most of the code is taken from the cover integration but simplified since valves
can't tilt.

There are a couple outstanding errors I'm not sure how to solve and prevents
me from even making this commit without `--no-verify`.

* Apply PR feedback

* Apply more feedback: Intruduce the bare minimum

* Remove file commited by mistake

* Hopefully this fixes tests

* Match cover's typing and mypy settings

* Change some configuration files

* Fix test

* Increase code coverage a little

* Code coverate inproved to 91%

* 95% code coverage

* Coverate up to 97%

* Coverage 98%

* Apply PR feedback

* Even more feedback

* Add line I shouldn't have removed

* Derive closed/open state from current position

* Hopefully last feedback

* Update homeassistant/components/valve/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/valve/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Remove unnecesary translation

* Remove unused method arguments

* Complete code coverage

* Update homeassistant/components/valve/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Simplify tests

* Update homeassistant/components/valve/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Apply last feedback

* Update tests/components/valve/test_init.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/valve/test_init.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/testing_config/custom_components/test/valve.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* More feedback

* Apply suggestion

* And more feedback

* Apply feedback

* Remove commented code

* Reverse logic to unindent

* Update homeassistant/components/valve/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/valve/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Implement stop valve for Mock valve

* Fix tests now that I've implemented stop_valve

* Assert it's neither opening nor closing

* Use current position instead

* Avoid scheduling executor when opening or closing

* Fix incorrect bitwise operation

* Simplify toggle

* Remove uneeded partial functions

* Make is_last_toggle_direction_open private

* Remove valve from test custom integration

* Improve test coverage

* Address review comments

* Address review comments

* Address review comments

* Update homeassistant/components/valve/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Erik <erik@montnemery.com>
2023-12-18 19:48:00 +01:00
..
service_info Make dataclasses in HA core slotted (#91208) 2023-04-11 07:58:28 -10:00
__init__.py Move config_per_platform and extract_domain_configs to config.py (#104989) 2023-12-04 12:48:49 +01:00
aiohttp_client.py Bump aiohttp to 3.9.1 (#104176) 2023-11-29 16:13:54 +01:00
area_registry.py Remove deprecated async_get_registry (#91928) 2023-04-23 23:02:21 -04:00
check_config.py Add domain key config validation (#104242) 2023-12-05 15:07:32 +01:00
collection.py Add TypeVar defaults for DataUpdateCoordinator and EntityComponent (#95026) 2023-06-22 03:33:23 +02:00
condition.py Allow conditions to be implemented in platforms (#88509) 2023-02-23 22:30:51 -05:00
config_entry_flow.py Update Union typing (4) [Py310] (#86427) 2023-01-23 09:04:40 +01:00
config_entry_oauth2_flow.py Improve OAuth error handling in configuration flows (#103157) 2023-11-11 11:02:51 +01:00
config_validation.py Add domain key config validation (#104242) 2023-12-05 15:07:32 +01:00
data_entry_flow.py Use @require_admin decorator (#98061) 2023-08-14 15:07:20 +02:00
debounce.py Downgrade Debouncer call ignored log message (#98840) 2023-08-22 14:42:33 -05:00
deprecation.py Allow passing breaks_in_ha_version to deprecation helper decorators (#104985) 2023-12-04 11:52:10 +01:00
device_registry.py Update mypy to 1.7.0 (#103800) 2023-11-11 23:31:04 +01:00
discovery.py Add names to common helper tasks (#90803) 2023-04-05 08:41:15 +02:00
discovery_flow.py Rename `gather_with_concurrency` to `gather_with_limited_concurrency` (#102241) 2023-10-19 15:08:52 +02:00
dispatcher.py Reduce overhead to connect dispatcher (#105715) 2023-12-16 10:16:58 +01:00
entity.py Allow inheriting base component entity descriptions in frozen dataclasses (#105512) 2023-12-15 23:33:50 -10:00
entity_component.py Move config_per_platform and extract_domain_configs to config.py (#104989) 2023-12-04 12:48:49 +01:00
entity_platform.py Reverse component path (#104087) 2023-12-05 08:43:58 +01:00
entity_registry.py Update ReadOnlyEntityOptions typing (#103813) 2023-11-11 22:30:55 +01:00
entity_values.py Limit cache size of EntityValues (#94983) 2023-06-21 22:23:35 +02:00
entityfilter.py Reduce code in entity filter (#94882) 2023-06-21 08:37:19 +01:00
event.py Switch formatting from black to ruff-format (#102893) 2023-11-27 14:38:59 +01:00
frame.py Use loader.async_suggest_report_issue in frame helper (#101461) 2023-10-05 19:52:26 +02:00
httpx_client.py Import names from typing instead of typing_extensions [3.11] (#97065) 2023-07-22 17:03:44 -05:00
icon.py Cache construction of battery icon (#102194) 2023-10-18 07:35:39 +02:00
instance_id.py Regenerate instance ID on error (#94898) 2023-06-20 11:16:51 +02:00
integration_platform.py Remove async_process_integration_platform_for_component (#100680) 2023-09-21 17:06:41 +02:00
intent.py Add HassNevermind intent (bump intents package) (#102131) 2023-10-16 19:13:26 -05:00
issue_registry.py Make the check_config script open issue_registry read only (#98545) 2023-08-18 20:15:00 +02:00
json.py Fix most sphinx documentation warnings (#101228) 2023-10-02 09:01:41 +02:00
location.py Code styling tweaks to core helpers (#85441) 2023-01-08 13:44:09 -10:00
network.py Extend `auth/providers` endpoint and add `/api/person/list` endpoint for local ip requests (#103906) 2023-11-24 17:11:54 +01:00
ratelimit.py Add first TypeVarTuple annotations (#105379) 2023-12-18 00:38:07 +01:00
recorder.py Make dataclasses in HA core slotted (#91208) 2023-04-11 07:58:28 -10:00
reload.py Move config_per_platform and extract_domain_configs to config.py (#104989) 2023-12-04 12:48:49 +01:00
restore_state.py Switch formatting from black to ruff-format (#102893) 2023-11-27 14:38:59 +01:00
schema_config_entry_flow.py Improve decorator type annotations [core] (#104826) 2023-11-30 18:50:31 +01:00
script.py Remove unnecessary block use of pylint disable in components p-z (#100192) 2023-09-12 20:47:48 +02:00
script_variables.py
selector.py Add Valve integration (#102184) 2023-12-18 19:48:00 +01:00
sensor.py Move DeviceInfo from entity to device registry (#98149) 2023-08-10 22:04:26 -04:00
service.py Remove logic converting empty or falsy YAML to empty dict (#103912) 2023-12-05 18:08:11 +01:00
signal.py Make hass.async_stop an untracked task (#88738) 2023-02-24 23:11:48 -05:00
significant_change.py Update Optional typing (1) [Py310] (#86417) 2023-01-23 09:56:10 +01:00
singleton.py Update mypy to 1.4.0 (#94987) 2023-06-21 16:12:51 +02:00
start.py Add at_started helper (#79577) 2022-10-05 12:24:51 +02:00
state.py Remove deprecated state.get_changed_since (#96579) 2023-07-18 09:42:48 +02:00
storage.py Remove unnnecessary pylint configs from core (#98704) 2023-08-22 23:12:12 +02:00
sun.py Fix infinite loop in sun.sun (#89723) 2023-03-14 16:27:29 -10:00
system_info.py Ensure async_get_system_info does not fail if supervisor is unavailable (#96492) 2023-07-16 11:10:07 -04:00
temperature.py Use unit_conversion in components (#79204) 2022-09-28 16:05:31 +02:00
template.py Bump lru-dict to 1.3.0 (#105914) 2023-12-18 00:16:31 +01:00
trace.py Use slots in TraceElement (#95877) 2023-07-05 08:44:00 +02:00
translation.py Reverse component path (#104087) 2023-12-05 08:43:58 +01:00
trigger.py Update mypy to 1.7.0 (#103800) 2023-11-11 23:31:04 +01:00
trigger_template_entity.py Set TriggerBaseEntity device_class in init (#100216) 2023-09-12 19:36:56 +02:00
typing.py Add generic Event class (#97071) 2023-07-23 21:51:54 +02:00
update_coordinator.py Switch formatting from black to ruff-format (#102893) 2023-11-27 14:38:59 +01:00