Commit Graph

383 Commits (d8e541a28439e7e91ced97de3a639da55c23abc1)

Author SHA1 Message Date
J. Nick Koston 52e0027fad
Limit homekit sources to prevent exceeding 100 limit (#59743) 2021-11-23 22:15:08 +01:00
J. Nick Koston 6524cd4eb2
Fix user input malformed with deleted entities in HomeKit exclude flow (#60061) 2021-11-23 11:46:54 -06:00
J. Nick Koston 400aaeaa91
Ensure homekit setup messages run in event loop (#60226) 2021-11-23 11:40:20 -06:00
J. Nick Koston 7359083e98
Remove legacy executor usage from HomeKit tests (#60180) 2021-11-22 22:37:28 -06:00
Franck Nijhof 766c889e70
Add button support to HomeKit (#60165)
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-11-23 00:46:51 +01:00
Erik Montnemery 49a27e12ad
Add support to entity registry for overriding device_class (#59985) 2021-11-22 08:38:06 -08:00
J. Nick Koston 347c4ea137
Bump zeroconf to 0.37.0 (#59932) 2021-11-18 20:23:20 -08:00
J. Nick Koston 0fb21af07f
Strip out deleted entities when configuring homekit (#59844) 2021-11-18 15:21:51 -08:00
Paulus Schoutsen 31153ac155
Move fixtures part 1 (#58902) 2021-11-01 20:47:05 -07:00
Paulus Schoutsen f51e1fcb67
Check for uncaught service not found exceptions (#58010) 2021-11-01 14:33:09 +01:00
J. Nick Koston 438ca73aba
Complete removal of auto_start, zeroconf_default_interface, and safe_mode from HomeKit (#58320) 2021-10-24 11:46:35 +02:00
J. Nick Koston ddab7f3024
Bump HAP-python to 4.30 (#57284) 2021-10-07 20:06:27 -07: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 7524daad86
Fix HomeKit requests with hvac mode and temperature in the same call (#56239) 2021-09-17 22:47:06 -07:00
Erik Montnemery 45046941c6
Avoid creating sockets in homekit port available tests (#56342) 2021-09-17 04:16:57 -10:00
J. Nick Koston 0fc89780e9
Fix listener leak in HomeKit on reload (#56143)
* Fix listener leak in HomeKit on reload

* Fix mocking
2021-09-12 15:06:03 -07:00
Greg Thornton f1556ead6d
Don't cache HomeKit camera stream source from entity (#56136) 2021-09-12 08:09:09 -07:00
Greg Thornton 371aa03bca
Add audio support option to HomeKit camera UI config flow (#56107) 2021-09-11 16:41:30 -10:00
J. Nick Koston eff59e8b00
Use the same server name for all HomeKit bridges (#55860) 2021-09-11 19:00:26 -07: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
Erik Montnemery 7dbe8070f7
Mock out network.util.async_get_source_ip in tests (#55592) 2021-09-02 20:44:50 +02:00
ha0y 433775cf4b
Add input_select and select domain support for HomeKit (#54760)
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-08-30 15:28:26 -05:00
J. Nick Koston bd0af57ef2
Support device triggers in HomeKit (#53869) 2021-08-25 16:47:39 +02:00
J. Nick Koston 99465f53c7
Bump HAP-python to 4.1.0 (#55005) 2021-08-23 21:00:26 +02:00
J. Nick Koston 87496ae75c
Fix HomeKit cover creation with tilt position, open/close, no set position (#54727) 2021-08-17 22:41:22 -05:00
J. Nick Koston d0b11568cc
Ensure HomeKit passes min/max mireds as ints (#54372) 2021-08-10 20:28:01 -05:00
J. Nick Koston e99576c094
Pass width and height when requesting camera snapshot (#53835) 2021-08-10 19:33:06 -05:00
J. Nick Koston 4da451fcf7
Improve HomeKit Color with Color Temp implementation (#54371) 2021-08-10 15:16:51 -07:00
Niccolo Zapponi 483a4535c8
Handle software version being None when setting up HomeKit accessories (#54130)
* Convert all HomeKit service info to string prior to checking for max length

* Added check for None software version

* Added test case for numeric version number

* Update tests/components/homekit/test_accessories.py

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

* Fix style & none version test

* Fix test

* revert other change since it should be covered by the format_sw_version fix

Co-authored-by: J. Nick Koston <nick@koston.org>
2021-08-06 09:34:42 -07:00
J. Nick Koston adc9f75493
Increase time before scene and script HomeKit entities are reset (#54105) 2021-08-05 19:24:24 -07:00
J. Nick Koston 26cb588ee2
Handle empty software version when setting up HomeKit (#54068)
Fixes #54059 Fixes #54024
2021-08-05 10:47:14 -07:00
J. Nick Koston df03cce471
Enforce maximum length for HomeKit characteristics (#53913) 2021-08-03 10:09:10 -07:00
Milan Meulemans 8ab3d9cc12
Use homeassistant.const instead of integration const for device_info ATTR_ (#53703) 2021-08-02 15:11:41 +02:00
J. Nick Koston 65c6943784
Bump HAP-python to 4.0.0 (#53780) 2021-08-02 15:08:32 +02:00
J. Nick Koston 72bd3f7128
Bump HAP-python to 3.6.0 (#53754) 2021-07-30 12:44:28 -07:00
J. Nick Koston 6eb3307734
Fix invalid homekit state when arming (#53646)
- Maybe fixes #48538
2021-07-28 16:09:49 -07:00
J. Nick Koston 84a7a5fd32
Split color temp and color into separate HomeKit services when a light supports both (#53471) 2021-07-27 10:10:05 -07:00
J. Nick Koston 0f15d2bf19
Ensure HomeKit accessories are started again after reset (#53372) 2021-07-24 16:31:30 +02:00
J. Nick Koston 009f34bfed
Add a homekit.unpair service to forcefully remove pairings (#53303)
- Sometimes homekit will go unresponsive because a pairing for a specific
  device is missing. To avoid deleting the config entry and recreating
  it, which can be a painful process if there are many bridged entities,
  the homekit.unpair service allows forceful removal of the pairings so
  the accessory can be paired again.
2021-07-22 12:44:36 +02:00
J. Nick Koston e78a62c802
Fix homekit locks not being created from when setup from the UI (#53301) 2021-07-21 22:22:06 -07:00
J. Nick Koston fe89603ee7
Update homekit lock to support locking, unlocking, jammed (#52819) 2021-07-20 21:55:19 -07:00
J. Nick Koston f20602e11d
Auto recreate HomeKit TVs when the sources are out of sync (#53208) 2021-07-20 21:46:39 -07:00
J. Nick Koston 2a65c5f93c
Recreate HomeKit accessories when calling the reset_accessory service (#53199) 2021-07-20 21:45:21 -07:00
J. Nick Koston 671e838085
Execute scripts from HomeKit (#53106) 2021-07-19 12:07:12 +02:00
J. Nick Koston 236738c455
Add support for tilt only covers to HomeKit (#53130) 2021-07-18 10:17:58 -10:00
J. Nick Koston 6c05e2746d
Improve error message when HomeKit does not support an entity (#53129) 2021-07-18 09:27:25 -10:00
J. Nick Koston 30d465e9dd
Update homekit to use network integration (#52946) 2021-07-14 11:44:58 +02:00
J. Nick Koston 75d6ffebc8
Improve error when HomeKit accessory underlying entity is missing (#51713)
* Improve error when HomeKit accessory underlying entity is missing

* docstring in test
2021-06-13 17:27:04 -05:00
Ville Skyttä 7d03b02192
Spelling fixes (#51642) 2021-06-11 13:35:03 +02:00
J. Nick Koston 0e7c2cddf7
Upgrade HAP-python to 3.5.0 (#51261)
* Upgrade HAP-python to 3.4.2

- Fixes for malformed event sending

- Performance improvements

* Bump

* update tests to point to async
2021-05-31 20:47:12 +02:00
Erik Montnemery e0ac12bd56
Use supported_color_modes in homekit (#49177) 2021-04-14 09:18:34 +02:00
J. Nick Koston 5365fb6c72
Fix setting up remotes that lack a supported features list in homekit (#49152) 2021-04-13 12:44:07 +02: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 6b93c4073d
Ensure homekit yaml config works when there is an ignored config entry (#48175) 2021-03-21 21:17:04 -10:00
J. Nick Koston fd310e1f41
Update homekit to improve representation of activity based remotes (#47261) 2021-03-21 21:55:20 -07:00
Marc Mueller 54d1e9985f
Update typing 15 (#48079) 2021-03-18 15:13:22 +01:00
J. Nick Koston 15aa00d6cc
Fix homekit checking for port cleanup too many times (#47836)
* Fix homekit checking for port cleanup too many times

The loop should have terminated as soon as the port was available

* coverage

* tweak homekit shutdown wait
2021-03-15 05:14:46 +01:00
Mick Vleeshouwer 9a98dcf432
Add HomeKit support for new CO / CO2 device class (#47737) 2021-03-12 09:03:47 -10:00
J. Nick Koston f4b775b125
Cleanup homekit and remove aid storage from hass.data (#47488) 2021-03-11 22:05:03 -08:00
Erik Montnemery 87e7cebd36
Update tests c-h to use registry async_get (#47652) 2021-03-09 14:31:17 +01:00
J. Nick Koston 2e89f152ba
Bump HAP-python to 3.4.0 (#47476)
* Bump HAP-python to 3.3.3

* bump

* fix mocking
2021-03-07 01:30:57 +01:00
J. Nick Koston 853da40e70
Increment the homekit config version when restarting (#47209)
If an entity changes between restart the iOS/controller
device may have cached the old chars for the accessory.
To force the iOS/controller to reload the chars, we
increment the config version when Home Assistant restarts
2021-02-28 20:42:09 -08:00
Paulus Schoutsen 7c2545af6e
Use async_capture_events to avoid running in executor (#47111) 2021-02-26 13:28:52 -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 d9ab1482bc
Add support for preset modes in homekit fans (#45962) 2021-02-20 19:24:14 -08:00
J. Nick Koston b775a0d796
Run homekit service calls in async since the server is now async (#45859)
* Simplify homekit runs and service calls

Now that the homekit server is async, call_service
and run are running in the Home Assistant event loop

* remove comment

* remove another comment
2021-02-19 21:34:52 -10:00
J. Nick Koston 773a202777
Implement percentage step sizes in HomeKit (#46722) 2021-02-19 22:37:12 -08:00
J. Nick Koston 20d93b4b29
Remove support for migrating pre-config entry homekit (#46616)
HomeKit pairings and accessory ids from versions 0.109 and earlier are no longer
migrated on upgrade. Users upgrading directly to 2021.3 from 0.109
and older should upgrade to 2021.2 first if they wish to preserve
HomeKit configuration and avoid re-pairing the bridge.

This change does not affect upgrades from 0.110 and later.
2021-02-16 08:37:43 +01:00
J. Nick Koston c5b9ad83c2
Log ffmpeg errors for homekit cameras (#46545) 2021-02-15 12:39:51 +01:00
J. Nick Koston bc8a52038b
Fix homekit migration not being awaited (#46460) 2021-02-12 08:45:19 -10:00
J. Nick Koston 6467eff09c
Fix incorrect current temperature for homekit water heaters (#46076) 2021-02-08 23:23:02 +01:00
J. Nick Koston 374aa3aee1
Fix homekit options not being prefilled (#45926)
* Fix homekit options not being prefilled

When changing homekit options, the existing ones
were not being prefilled on the form.

* hide camera screen if no cameras
2021-02-05 02:39:07 +01: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 385b7e17ef
Move homekit accessory creation to async (#45788) 2021-01-31 11:36:19 -10:00
J. Nick Koston 852af7e372
Update homekit for new async library changes (#45731) 2021-01-31 21:40:24 +01:00
J. Nick Koston dac9626112
Resolve homekit cover adjustment slowness (#45730) 2021-01-31 21:39:35 +01:00
J. Nick Koston 5f9a1d105c
Improve HomeKit Accessory Mode UX (#45402) 2021-01-29 09:57:13 -06:00
J. Nick Koston 3ff75eee53
Update homekit to use new fan entity model (#45549) 2021-01-28 12:38:18 +01:00
J. Nick Koston 38a5f25b59
Fix vacuums that do not support start with homekit (#45030)
* Fix vacuums that do not support start with homekit

* fix tests
2021-01-11 14:38:42 +01:00
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
J. Nick Koston 4905be0c40
Move HomeKit autostart to advanced options flow (#44599) 2020-12-29 13:54:24 +01:00
J. Nick Koston 677fc6e2bb
Translate siri requests to turn on thermostats to valid targets (#44236)
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.
2020-12-23 17:23:26 -10:00
Lindsay Ward 181811b7b8
Fix typo exceeded, change to exceed, in HomeKit (#42705) 2020-11-01 03:51:56 -10:00
Paulus Schoutsen 1c36bf5e19
Fix block till done in create entry config flow tests (#42290) 2020-10-24 16:20:56 +02:00
J. Nick Koston 4bf9ce6fca
Add support for homekit garage obstruction sensors (#42243) 2020-10-23 12:18:02 -05: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 c5ae801bcb
Allow HomeKit to be configured in include mode from the UI (#41662) 2020-10-15 15:33:01 +02:00
Julius Mittenzwei a19b43a304
Add support for homekit windows (#40635)
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-09-27 00:07:59 -05:00
springstan 6c8e0e20fb
Add and use light lux constant in entire code base (#40171) 2020-09-23 20:48:01 +02:00
Niccolo Zapponi 2b7e735e3d
Remove unsupported states from security systems in HomeKit (#40060) 2020-09-16 10:00:32 -05:00
J. Nick Koston 2ea604cc2a
Convert color temperature to hue and saturation for HomeKit (#40089)
The HomeKit spec does not permit the color temp characteristic
being exposed when color (hue, sat) is present.  Since
Home Assistant will still send color temp values, we need to
convert them to hue, sat values for HomeKit
2020-09-15 09:27:30 +02: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 6b7a7939d2
Include the first seen context data in the logbook api (#39194)
* Include the context_entity_id in the logbook api

context_entity_id is the first entity seen during
a time period that includes the context

* update test

* more of them

* include friendly name

* pylint wants a ternary

* Refactor

* performance

* fix homekit context

* Fix self describing events

* Fix external_events
2020-08-24 12:44:40 -05:00
Austin Drummond 937d993a67
Expose video doorbell button state to HomeKit (#38617) 2020-08-06 17:47:39 -05:00
Austin Drummond 9d0f58009e
Add support for HomeKit doorbell (#38419)
* Add support for HomeKit doorbell

* Update homeassistant/components/homekit/type_cameras.py

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

* Update homeassistant/components/homekit/type_cameras.py

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

* add speaker service for doorbells

* fixed test as doorbell char requires null value

* removed null value for doorbell presses. and removed broken override of default values

Co-authored-by: J. Nick Koston <nick@koston.org>
2020-07-31 09:41:36 -10:00
Nick Whyte 7599997a46
Enable Homekit remote support for devices without play/pause (#37180)
* Enable Homekit remote support for devices without play/pause

* linting

* Update tests

* code review

* code review
2020-07-24 18:20:29 -10:00
J. Nick Koston d4111617ca
Ensure HomeKit does not throw when a linked motion sensor is removed (#37773) 2020-07-14 22:38:55 +02:00
J. Nick Koston f5cbae0cd5
Avoid homekit crash when temperature is clamped above max value (#37746) 2020-07-14 22:21:10 +02:00
Bram Kragten 7d77fa92c2
Add mode info attributes to script and automation (#37815)
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-07-14 10:47:59 -07: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 711b8e10a3
Switch homekit to use async_track_state_change_event (#37253)
* Switch homekit to use async_track_state_change_event

Calling async_track_state_change_event directly
is faster than async_track_state_change and has
slightly lower latency triggering state updates
in homekit

* check for deleted entities

* Update additional tests for linked sensor removals

* Ensure removing entities does not result in an exception
2020-07-05 19:05:13 -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 89a9634d35
Use eventloop for scheduling (#37184)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-06-29 09:39:24 -07: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
Paulus Schoutsen 5bc6ed4cef
Add logbook platforms (#37078)
* Add logbook platforms

* Fix logbook describe test
2020-06-24 18:14:50 -07: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 59e43ab6e4
Prefilter more logbook events in sql (#36958)
* Prefilter more logbook events in sql

Prefilter sensor events in _keep_event before humanify

Cache static attribute lookup

Reduces logbook execution time by ~35%

* fix mocking in benchmark

* Update tests for logbook users
2020-06-21 10:50:58 -07:00
J. Nick Koston 0a219081ea
Only process logbook timestamps for events we will keep (#36792)
* Only process logbook timestamps for events we will keep

Since we group by minute we were previously processing
every timestamp. We can avoid this by making all the
minute checks use the unprocessed datetime since
the groupings will be the same regardless of timezone.

This reduces the number of datetime object recreations
by at least an order of magnitude.
2020-06-15 14:54:20 -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 1c663dc179
Mark homekit accessories unavailable if the underlying entity is unavailable (#35685)
* Mark homekit accessories unavailable if the underlying entity is unavailable.

* bump pyhap to 2.9.0

* bump hap

* Update homeassistant/components/homekit/accessories.py

Co-authored-by: Franck Nijhof <git@frenck.dev>

Co-authored-by: Franck Nijhof <git@frenck.dev>
2020-06-01 10:11:48 -05:00
Paulus Schoutsen 276f3afb00
Do async_setup_platform in background (#36244)
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-31 22:18:30 -07: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 80de233276
Ensure homekit functions if numpy is unavailable (#35931) 2020-05-23 02:52:33 +02: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
Nick Whyte a51372f7b3
Fire events on homekit TV remote key press (#29588)
* Fire events on homekit TV remote key press

* Changes from code review

* black

* isort

* flake8

* Update tests/components/homekit/test_type_media_players.py

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

Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-19 08:11:04 -05: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 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
J. Nick Koston 31ee54c133
Ensure homekit camera stream can be restarted after failure (#35384)
* Ensure camera stream can be restarted after failure

* If ffmpeg failed to start, was killed, or the iOS device
closed the stream right away, the stream could never
be started until the HomeKit bridge was restarted.

* watch ffmpeg instead of checking only once

* handle forceful shutdowns gracefully

* Increase coverage
2020-05-11 08:17:10 -05:00
J. Nick Koston 742e36ba26
Reduce context switching in homekit state updates (#35147) 2020-05-10 22:10:08 -07:00
J. Nick Koston 2e018ad841
Make homekit camera snapshots HAP spec compliant (#35299) 2020-05-10 22:09:05 -07:00
J. Nick Koston 497c01c651
Make homekit TV media players aware of STATE_STANDBY (#35282)
This was previously added to non-TV media players.
2020-05-10 17:35:54 -05:00
stickpin a38bb5b33b
Add Homekit cameras codecs (#35238)
* Homekit cameras - Add codecs support

* Add valid_codecs + move audio application parameter

* Increase video bufsize

* Increase audio bufsize

* Update config flow to be aware of the copy option

* Add tests for copy video and audio codec

* remove unused from test

* remove unused from test

Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-07 09:55:09 -05:00
Greg Thornton dd715fcc3a
Add homekit camera support (#32527)
* Add homekit camera support

* Cleanup pyhapcamera inheritance

* Add camera to homekit manifest

* Use upstream pyhap server handler in homekit

* Remove unused homekit constants

* Fix lint errors in homekit camera

* Update homekit camera log messages

* Black after conflict fixes

* More conflict fixes

* missing srtp

* Allow streaming retry when ffmpeg fails to connect

* Fix inherit of camera config, force kill ffmpeg on failure

* Fix audio (Home Assistant only comes with OPUS)

* Fix audio (Home Assistant only comes with OPUS)

* Add camera to the list of supported domains.

* add a test for camera creation

* Add a basic test (still needs more as its only at 44% cover)

* let super handle reconfigure_stream

* Remove scaling as it does not appear to be needed and causes artifacts

* Some more basic tests

* make sure no exceptions when finding the source from the entity

* make sure the bridge forwards get_snapshot

* restore full coverage to accessories.py

* revert usage of super for start/stop stream

* one more test

* more mocking

* Remove -tune zerolatency, disable reconfigure_stream

* Restore -tune zerolatency

Co-authored-by: John Carr <john.carr@unrouted.co.uk>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-04 19:03:46 -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 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
Paulus Schoutsen ec47216388
Use built-in test helpers on 3.8 (#34901) 2020-04-30 13:29:50 -07:00
J. Nick Koston bf5cc22bef
Fix preservation of homekit fan speed on toggle (#34971) 2020-04-30 11:34:25 -07:00
J. Nick Koston e01ceb1a57
Fix handling homekit thermostat states (#34905) 2020-04-30 00:09:33 -07:00
J. Nick Koston fcd58b7c9b
Avoid error when battery appears after homekit has started (#34906) 2020-04-30 00:08:56 -07:00
J. Nick Koston 6ce0819287
Prevent homekit fans from going to 100% than speed when turning on (#34875) 2020-04-29 14:00:31 -07:00
J. Nick Koston 2f3bd80de4
Add missing blocks (#34832) 2020-04-28 15:10:23 -07:00
J. Nick Koston a7e8446454
Remember homekit aids for entities without a unique id (#34587)
* Remember homekit aids for entities without a unique id

* add backwards compat

* increase cover
2020-04-23 12:07:55 -05: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