Commit Graph

61 Commits (8be357ff4fa9c27b49b7c3b93b69fae07f77eef1)

Author SHA1 Message Date
J. Nick Koston af21893652
Remove safe mode from HomeKit (#45028)
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.
2021-01-11 14:26:09 +01:00
J. Nick Koston f5b389faa8
Warn users when their HomeKit configuration may be unstable (#44999) 2021-01-10 09:38:41 -10:00
Ville Skyttä 2fb3be50ab
Make DeviceRegistry.async_get_device connections arg optional (#44897)
* 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.
2021-01-07 13:49:45 +01:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Lindsay Ward 181811b7b8
Fix typo exceeded, change to exceed, in HomeKit (#42705) 2020-11-01 03:51:56 -10:00
J. Nick Koston 3ffa050905
Support HomeKit accessory mode (#41679)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-10-15 11:59:50 -05:00
J. Nick Koston 7b016063ca
Refactor zeroconf setup to be async (#39955)
* Refactor zeroconf setup to be async

Most of the setup was calling back to async because
we were setting up listeners.  Since we only need
to jump into the executor to create the zeroconf
instance, its much faster to setup in async.

In testing this cut the setup time in half
or better.

* partial revert to after_deps
2020-09-13 18:06:19 -05:00
J. Nick Koston bf1ad0a757
Prevent missing integration from failing HomeKit startup (#39918) 2020-09-10 23:19:11 +02:00
springstan d2b1918e9c
Drop UNIT_ prefix for percentage constant (#39383) 2020-09-05 21:09:14 +02:00
J. Nick Koston 414a59ae9f
Add the ability to reload homekit from yaml (#39326) 2020-08-28 16:46:45 +02:00
Franck Nijhof 1c2ebdf307
Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
J. Nick Koston 3871688dfb
Fix homekit test mocking missed in loop changeover (#37628) 2020-07-07 15:14:58 -07: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 debb928b30
Use the main event loop for homekit (#37441)
* use hass.loop for homekit

* update calls for upstream pr

* Bump HAP-python to 2.9.2
2020-07-05 12:27:07 -05:00
Paulus Schoutsen 0c771f1c42
Replace asynctest with tests.async_mock (#37428) 2020-07-03 11:29:35 -07:00
Shulyaka 4ec71c58bd
Add humidifier support to homekit (#37207)
* Add humidifier support to homekit

* spell

* dependencies

* lint

* add linked humidity sensor for humidifiers

* Apply suggestions from code review

Co-authored-by: J. Nick Koston <nick@koston.org>

* apply suggestions from code review

* pylint

* Fix tests

* Update homeassistant/components/homekit/type_humidifiers.py

Co-authored-by: J. Nick Koston <nick@koston.org>

* Update tests/components/homekit/test_homekit.py

Co-authored-by: J. Nick Koston <nick@koston.org>

* Apply suggestions from code review

Co-authored-by: J. Nick Koston <nick@koston.org>

* apply suggestions from code review

* lint

* pylint

* push

* test for unavailable linker sensor

* black

* valid values key case

* black

* Update homeassistant/components/homekit/type_humidifiers.py

Co-authored-by: J. Nick Koston <nick@koston.org>

* black

* coverage

* Set current humidity to 0 if linked sensor removed or unavailable

* use last known humidity instead

Co-authored-by: J. Nick Koston <nick@koston.org>
2020-07-02 12:53:11 -05:00
J. Nick Koston 0f72008090
Ensure homekit state changed listeners are unsubscribed on reload (#37200)
* Ensure homekit state changed listeners are unsubscribed on reload

* fix mocking
2020-06-29 11:25:26 -05:00
mdegat01 6c7355785a
Add support for glob matching to entity filters (#36913)
* Added GLOB capability to entityfilter and every place that uses it. All existing tests are passing

* added tests for components affected by glob change

* fixed flake8 error

* mocking the correct listener

* mocking correct bus method in azure test

* tests passing in 3.7 and 3.8

* fixed formatting issue from rebase/conflict

* Checking against glob patterns in more performant way

* perf improvments and reverted unnecessarily adjusted tests

* added new benchmark test around filters

* no longer using get with default in entityfilter

* changed filter name and removed logbook from filter benchmark

* simplified benchmark tests from feedback

* fixed apache tests and returned include exclude schemas to normal

* fixed azure event hub tests to properly go through component logic

* fixed azure test and clean up for other tests

* renaming test files to match standard

* merged mqtt statestream test changes with base

* removed dependency on recorder filter schema from history

* fixed recorder tests after merge and a bunch of lint errors
2020-06-23 20:02:29 -05:00
J. Nick Koston 5f4fdaa171
Remove zeroconf options from homekit (#35687)
* Remove zeroconf options from homekit

homekit uses the system shared zeroconf instance which
made the interface choice option controlled by the
zeroconf integration setting.

* change to cv.deprecated

* adj

* fix remaining tests from original merge conflict

* remove invalidation_version
2020-06-02 17:47:39 -05:00
J. Nick Koston 879e2d1afd
Improve stability of homekit accessory ids (#35691) 2020-05-26 22:15:00 -07:00
J. Nick Koston 8cbee76929
Add support for homekit camera motion notification (#35994)
* Add support for homekit camera motion notification

A motion sensor can now be linked to the cameras.

* Increase coverage
2020-05-25 18:05:38 -05:00
J. Nick Koston 4313d4b26b
Ensure homekit bridge state is restored before creating devices (#36098)
* Ensure homekit bridge state is restored before creating devices

* Tests to ensure homekit device registry entry is stable

* remove stray continue
2020-05-25 11:17:30 -05:00
J. Nick Koston b57cabfce7
Homekit should skip devices that are missing in device registry (#35857)
* Homekit should skip devices that are missing in device registry

* Add test for this failure state
2020-05-21 10:30:18 +02:00
J. Nick Koston 751529feca
Use system zeroconf singleton for homekit (#35502)
Zeroconf instances are expensive so we share a single instance
instead of running multiple.
2020-05-11 13:21:16 -05:00
J. Nick Koston 0a9b373edb
Show device details in homekit accessory service info (#35100)
* Show device info in homekit accessory service info

* fix conflict
2020-05-11 09:09:48 -05:00
Paulus Schoutsen 2af984917e
Use asynctest-mock in most places (#35109)
* Use asynctest-mock in most places

* Fix broken patch in pilight
2020-05-03 11:27:19 -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
Paulus Schoutsen ec47216388
Use built-in test helpers on 3.8 (#34901) 2020-04-30 13:29:50 -07:00
J. Nick Koston 2f3bd80de4
Add missing blocks (#34832) 2020-04-28 15:10:23 -07:00
J. Nick Koston 6c3ea2a904
Fix zeroconf interface being ineffective in HomeKit (#34516) 2020-04-21 20:46:19 -07:00
J. Nick Koston 96649a7e27
Use registry to find linked batteries for homekit (#33519) 2020-04-21 17:43:49 -07: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
Jc2k a80ce60e75
Store HomeKit generated accessory id against unique_id where possible (#33109)
* HomeKit: Store generated aid against unique_id where possible

* Fix conflict

* Fix max accessories check

* homekit counts the bridge as an accessory

* Add coverage for aidmanager

* prepare for merge

Co-authored-by: J. Nick Koston <nick@koston.org>
2020-04-19 13:51:09 -05:00
J. Nick Koston 5e3e4bda28
Prevent a single accessory setup failure from breaking all HomeKit accessories (#34263)
* Prevent a single accessory setup failure from breaking all HomeKit accessories

Raise the max devices to 150 as the spec allows for this
many.  Previously 100 made sense because of the event
storms when homekit started would sometimes break pairing,
as these have largely been fixed in 0.109 (still a few
to cleanup) using the HAP spec limit of 150 is now possible.

* Handle both failure states
2020-04-15 21:40:38 -05:00
J. Nick Koston 5aca16ef01
Add homekit configuration option to bind to default interface (#33999)
* Add homekit configuration option to bind to default interface

Homekit can fail to be discoverable because the
zeroconf default is to bind to all interfaces
(InterfaceChoice.All).  This does not work
on some systems and (InterfaceChoice.Default) which
binds to 0.0.0.0 is needed for homekit to zeroconf
to function.

A new option is available for homekit

zeroconf_default_interface: true

* Update tests

* Update homeassistant/components/homekit/__init__.py

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

* Update homeassistant/components/homekit/__init__.py

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

* Review items

* has a default

* Revert "has a default"

This reverts commit 24ecf0920f.

Breaks the tests

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
2020-04-12 09:59:50 -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
springstan 67c3a4c970
Improve string formatting v7 (#33705) 2020-04-05 17:34:24 -05:00
Paulus Schoutsen 63a843c19c Fix test 2019-12-22 10:31:23 +01:00
springstan 72f336a2dd Move imports to top for homekit (#29560)
* Move imports to top for homekit

* Moved back a couple imports, added annotation to disable import-outside-toplevel

* Fix all tests in test_homekit.py
2019-12-09 16:10:02 +01:00
Bas Nijholt b731ddabde Sort imports according to PEP8 for homekit (#29645) 2019-12-08 18:16:49 +01:00
Marc Hörsken e3f0c904b0 Add option to specify mDNS advertised IP address for HomeKit Bridge (#26791)
* Add options to specify advertised IP and MAC for HomeKit Bridge

This makes use of HAP-python's new feature in version 2.6.0
that allows to specify the mDNS advertised IP and MAC address.

This is a requirement for the following use cases:
- Running Home Assistant behind a NAT, e.g. inside Docker.
- Running it on a system with multiple interfaces there
  the default IP address, DNS entry and hostname diverge.

The forwarding of the required mDNS packets can be done with
an avahi-daemon based gateway, e.g. by using enable-reflector=yes.

Specifying the MAC address makes it possible to identify an
accessory in case HA is run inside a ephemeral docker container.

Whitespace changes were performed due to black and flake8.

* Update tests for HomeKit Bridge due to IP and MAC advertising

Whitespace changes were performed due to black and flake8.

* Remove the possibility to set the MAC address of the HomeKit Bridge

Since the MAC address is a random device ID, there is no need
for the user to be able to set a custom MAC address value for it.

Whitespace changes were performed due to black and flake8.
2019-10-22 22:06:21 -07:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Austin Drummond c2f4f06005 Add HomeKit Reset Accessory (#25158)
* added the ability to reset homekit accessories

* added tests for homekit reset accessory

* minor fixes
2019-07-16 03:43:37 +02:00
cdce8p ed7aea006a
Add safe_mode HomeKit (#18356)
* Use: 'safe_mode: True' in case of pairing issues
2018-11-16 11:08:39 +01:00
Julius Mittenzwei 2e62afabdc Added warning to HomeKit component (#16807)
* added warning if more then 100 devices are added to HomeKit
2018-10-05 12:32:26 +02:00
cdce8p 4de847f84e Bugfix HomeKit name and serial_number (#15600)
* Bugfix HomeKit name and serial_number

* Revert serial_number changes
2018-07-22 09:51:42 +02:00
Matt Schmitt 722c27f1e2 HomeKit style clean up (#14793) 2018-06-17 13:37:44 +02:00
cdce8p 7d2563eb1f
Update HAP-python to 2.2.2 (#14674)
* Pass driver to accessory
* Added 'hk_driver' fixture for tests
2018-05-29 22:43:26 +02:00
cdce8p 0589379de5 Homekit style cleanup (#14556)
* Style cleanup

* Sorted imports
* Harmonized service calls

* Test improvements

* Small update
2018-05-20 22:25:53 -04:00
cdce8p 12e76ef7c1
Update HAP-python to 2.1.0 (#14528) 2018-05-18 16:32:57 +02:00