Commit Graph

60 Commits

Author SHA1 Message Date
Maarten Staa
9fe306f056 Add support for air purifiers in HomeKit (#142467)
* Add support for air purifier type in HomeKit.

Any fan and PM2.5 in the same device will be treated as an air purifier.

type_air_purifiers.py heavily based on type_fans.py -
I tried extending type_fans.py but this looked better to me.

* Refactor to make AirPurifier class extend Fan.

* Ensure all chars are added before creating service

* Add support for switching automatic mode.

* Add test for auto/manual switch

* Add support for air purifier type in HomeKit.

Any fan and PM2.5 in the same device will be treated as an air purifier.

type_air_purifiers.py heavily based on type_fans.py -
I tried extending type_fans.py but this looked better to me.

* Add support for air purifier type in HomeKit.

Any fan and PM2.5 in the same device will be treated as an air purifier.

type_air_purifiers.py heavily based on type_fans.py -
I tried extending type_fans.py but this looked better to me.

* Refactor to make AirPurifier class extend Fan.

* Ensure all chars are added before creating service

* Add support for switching automatic mode.

* Add test for auto/manual switch

* Add support for air purifier type in HomeKit.

Any fan and PM2.5 in the same device will be treated as an air purifier.

type_air_purifiers.py heavily based on type_fans.py -
I tried extending type_fans.py but this looked better to me.

* Improve fan config: allow setting fan type (fan or air purifier)

Be more explicit than assuming a fan is an air purifier if it has a PM2.5 sensor. Set defaults based on the presence of sensors.

* Fix return type annotation for fan/air purifier create_services

* Allow linking air purifier filter level/change indicator

* Remove no longer needed if statement in fan init

* Fix up types and clean up code

* Update homekit tests to account for air purifiers

* Fix pylint errors

* Fix mypy errors

* Improve type annotations

* Improve readability of auto preset mode discovery

* Test air purifier with 'Auto' preset mode

* Handle case with a single preset mode

* Test air purifier edge cases: state updates to same value, and removed linked entities

* Don't create 'auto mode' switch for air purifiers

This is already exposed as a target mode on the air purifier service itself

* Handle unavailable states in air purifier

Also don't remove device class when updating state in test

* Reduce branching in air purifier test

* Split up air purifier tests for with and without auto presets, to reduce branching

* Handle unavailable states in air purifier more explicitly

* Use constant for ignored state values

* Use a set for ignored_states

* Update tests/components/homekit/test_type_air_purifiers.py

---------

Co-authored-by: Andrew Kurowski <62596884+ak6i@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick+github@koston.org>
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-04-09 10:20:21 -10:00
Assaf Inbal
9c4940e915 Fix Homekit camera profiles schema (#137110) 2025-02-01 12:49:09 -06:00
J. Nick Koston
a0d5fda4b6 Reduce precision loss when converting HomeKit temperature (#131973) 2024-11-30 16:09:37 -06:00
J. Nick Koston
2b907ee56e Strip trailing spaces from HomeKit names (#131971) 2024-11-30 14:47:40 -06:00
Andy
bcdac7ed37 Add support for linked_doorbell_sensor to HomeKit locks (#131660)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-11-30 13:30:21 -06:00
J. Nick Koston
c8b0c939e4 Ensure event entities are allowed for linked homekit config via YAML (#123994) 2024-08-16 16:48:59 +02:00
J. Nick Koston
7348a1fd0c Convert homekit to use entry.runtime_data (#122533) 2024-07-25 11:06:55 +02:00
Sarabveer Singh
b3a62a97b4 Update HomeKit PM2.5 mappings based on new 2024 US EPA AQI (#109900) 2024-07-04 22:10:35 -05:00
epenet
c6e0e93680 Cleanup mock_get_source_ip from tests (#118459) 2024-05-30 09:37:01 +02:00
Fabrice
d4acd86819 Make co/co2 threshold configurable via entity_config (#112978)
* make co/co2 threshold configurable via entity_config

* Split threshold into co/co2_threshold configuration
2024-05-24 13:28:19 +02:00
Sid
d5f883fbf0 Unignore Ruff PLR in tests (#114470)
* Unignore Ruff PLR in tests

* Address review comments

* review comments

* fix import

* Update test_api.py

* Update test_api.py

* Update test_api.py
2024-04-01 11:11:59 +02:00
Joost Lekkerkerker
6bb4e7d62c Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
Marc Mueller
c88b337600 Add empty line after module docstring [tests f-k] (#112709) 2024-03-08 14:50:04 +01:00
J. Nick Koston
265f6653c3 Refactor homekit to use a dataclass for entry data (#101738) 2023-10-10 21:14:37 +02:00
epenet
03710e58b5 Add type hints to integration tests (part 9) (#87983) 2023-02-13 12:06:51 +01:00
epenet
37a2040d7b Add type hints to integration tests (h-i) (#87703) 2023-02-08 18:12:56 +01:00
epenet
4142f0d15d Add return type to tests without arguments (#87613)
* Add return type to tests without arguments

* Black

* Cancel fixture amends
2023-02-07 14:20:06 +01:00
epenet
aa00114c2f Add return type to async tests without arguments (#87612) 2023-02-07 10:26:56 +01:00
Michael
e35ab75c0b Replace the usage of unit constants by enumerations in Tests [h-l] (#85934) 2023-01-15 14:52:55 +01:00
Sarabveer Singh
01de1c6304 Update HomeKit PM2.5 mappings to US AQI (#76358) 2022-08-08 11:49:07 -10:00
J. Nick Koston
6d2302b703 Add guards for HomeKit version/names that break apple watches (#67585) 2022-03-03 15:03:46 -08:00
J. Nick Koston
5c8271552a Add hardware revision support to homekit (#63336) 2022-01-04 16:19:12 +01:00
J. Nick Koston
400aaeaa91 Ensure homekit setup messages run in event loop (#60226) 2021-11-23 11:40:20 -06:00
Paulus Schoutsen
a4d9019ffc Refactor persistent notification to no longer route all data via a service (#57157)
* 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>
2021-10-07 12:58:00 +02:00
J. Nick Koston
88e42a540e Remove leftover debug prints in tests (#56409) 2021-09-19 12:43:02 +02:00
Erik Montnemery
be0819b456 Mock out network.util.async_get_source_ip in tests (#56339) 2021-09-17 21:40:58 -10:00
J. Nick Koston
195ee2a188 Avoid creating sockets in homekit port available tests (#55668)
* Avoid creating sockets in homekit port available tests

* prevent new bridge from being setup -- its too fast now that the executor job is gone and it revealed an unpatched setup
2021-09-03 17:15:28 -10:00
J. Nick Koston
9790f3f609 Create homekit locks according to spec (#48453)
Any accessories, regardless of transport, that enable physical access to the home, such as door locks, must not be bridged.
2021-03-31 09:22:30 -07:00
J. Nick Koston
f4b775b125 Cleanup homekit and remove aid storage from hass.data (#47488) 2021-03-11 22:05:03 -08:00
J. Nick Koston
87cbbcb014 Automatically create HomeKit accessory mode entries (#46473)
When we set up HomeKit, we asked users if they wanted
to create an entry in bridge or accessory mode.

This approach required the user to understand how HomeKit works and
choose which type to create.

When the user includes the media player or camera domains,
we exclude them from the bridge and create the additional entries
for each entity in accessory mode.
2021-02-23 16:22:23 -08:00
J. Nick Koston
463a32819c Ensure homekit never picks a port that another config entry uses (#45433) 2021-02-02 14:30:38 +01:00
J. Nick Koston
3ff75eee53 Update homekit to use new fan entity model (#45549) 2021-01-28 12:38:18 +01:00
Paulus Schoutsen
f49ce5d1b4 Protect loop set default executor (#37438)
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-07-06 15:58:53 -07:00
J. Nick Koston
8eb7777561 Ensure homekit version strings conform to spec (#35741)
HomeKit requires all version strings to be in the
format MAJOR.MINOR.REVISION
2020-05-17 15:51:51 -05:00
J. Nick Koston
4de30ca2ce Improve stability of homekit media players (#35080) 2020-05-02 14:15:44 -07:00
J. Nick Koston
793592b2b8 Config flow for homekit (#34560)
* Config flow for homekit

Allows multiple homekit bridges to run

HAP-python state is now stored at .storage/homekit.{entry_id}.state
aids is now stored at .storage/homekit.{entry_id}.aids

Overcomes 150 device limit by supporting
multiple bridges.

Name and port are now automatically allocated
to avoid conflicts which was one of the main
reasons pairing failed.

YAML configuration remains available in order to offer entity
specific configuration.

Entries created by config flow can add and remove
included domains and entities without having to restart

* Fix services as there are multiple now

* migrate in executor

* drop title from strings

* Update homeassistant/components/homekit/strings.json

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Make auto_start advanced mode only, add coverage

* put back title

* more references

* delete port since manual config is no longer needed

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-04-30 23:05:06 -05:00
J. Nick Koston
d06fce6997 Display Homekit QR code when pairing (#34449)
* Display a QR code for homekit pairing

This will reduce the failure rate with HomeKit
pairing because there is less chance of entry
error.

* Add coverage

* Test that the qr code is created

* I cannot spell

* Update homeassistant/components/homekit/__init__.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Update homeassistant/components/homekit/__init__.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-04-21 17:38:43 -05:00
J. Nick Koston
e4ee4cf302 Remove legacy async_add_job from homekit tests (#33727)
* Remove legacy async_add_job from homekit tests

* Empty commit to rerun CI
2020-04-05 21:33:36 -05:00
Javier González Calleja
c6b08b28b2 Fix homekit temperaturesensor round (#27047)
* Fix homekit temperature sensor for round with one decimal

* Removing unnecesary operations

* Adapting tests for new temperature_to_homekit() result precision
2019-10-03 17:44:07 -07:00
Paulus Schoutsen
4de97abc3a Black 2019-07-31 12:25:30 -07:00
Austin Drummond
b4e2a0ef84 Add HomeKit low battery threshold config (#23363) 2019-04-30 02:02:53 +02:00
cdce8p
6d2412022b Fix HomeKit fan speed conversion (#22951)
* Check that speed value from state is not 'None'
* Added tests
2019-04-10 08:35:17 +02:00
Austin Drummond
c4e31bc4df Add linked battery sensor to HomeKit (#22788) 2019-04-09 23:13:48 +02:00
Andreas Hartl
a94a24f6f8 Added HomeKit fan speed based on speed_list (#19767)
Speed_list needs to be in ascending order.
2019-02-05 16:11:19 +01:00
cdce8p
959fa81ea6 Fix temperature interval Thermostat HomeKit (#18192)
* Will round to nearest .0 or .5
2018-11-04 22:04:51 +01:00
cdce8p
37a47b5a59 Add faucet, shower, sprinkler, valve to HomeKit (#17145) 2018-10-05 12:43:50 +02:00
cdce8p
52ff232797 Bugfix invalid entity_config parameter HomeKit (#17143) 2018-10-04 20:37:04 +02:00
Matt Schmitt
722c27f1e2 HomeKit style clean up (#14793) 2018-06-17 13:37:44 +02:00
Matt Schmitt
f5d74e07d5 Add support for outlets in HomeKit (#14628) 2018-06-01 18:04:54 +02:00
cdce8p
6f4dd7b057 Improve Homekit media_player options (#14637)
* Optimize imports

* Optimize name

* Optimize config schema

* Rename mode to feature

* Replace mode with feature_list
2018-05-28 10:26:33 -04:00