Commit Graph

82 Commits (58551ec66da1344bcbd8fd25712dd9074ea4e1e7)

Author SHA1 Message Date
J. Nick Koston 5c8271552a
Add hardware revision support to homekit (#63336) 2022-01-04 16:19:12 +01:00
J. Nick Koston 7a46e04fd1
Remove unused homekit.start service (#62827) 2021-12-27 10:12:02 +01:00
epenet 931d51949d
Use new DeviceClass enums in homekit (#61665)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-12-18 19:07:04 -06:00
J. Nick Koston 2f00f8d3de
Prevent executor overload when starting many homekit instances (#59950) 2021-11-18 22:39:49 -08: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 bd0af57ef2
Support device triggers in HomeKit (#53869) 2021-08-25 16:47:39 +02: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 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
Ville Skyttä 7d03b02192
Spelling fixes (#51642) 2021-06-11 13:35:03 +02:00
J. Nick Koston baa8de2f89
Fix homekit memory leak on entry reload (#49452) 2021-04-20 09:11:58 -07: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
J. Nick Koston 0d07dae3bc
Change default homekit ports to 21063 and 21064 (#47491)
We previously used a value in the linux default ephemerial port range
which meant that if something else happened to use that port HomeKit
would not start up.  We now use a value below 32768 to ensure that
the port is not randomly unavailable
2021-03-06 21:41:56 -10: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 5f9a1d105c
Improve HomeKit Accessory Mode UX (#45402) 2021-01-29 09:57:13 -06: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
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
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
J. Nick Koston 3206f4dc83
Support multiple camera streams in HomeKit (#37968)
* Support multiple camera stream in HomeKit

* Update homeassistant/components/homekit/type_cameras.py

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

* Revert "Update homeassistant/components/homekit/type_cameras.py"

This reverts commit d7624c5bff.

* Update homeassistant/components/homekit/type_cameras.py

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

* Update homeassistant/components/homekit/type_cameras.py

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

* black

* bump pyhap

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-07-25 07:12:14 -10: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 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 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
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 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
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
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 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 d6a47cb3e0
Set homekit alarm/sensor/switch/cover state as soon as possible (#34245)
* Set homekit alarm/sensor/switch state as soon as possible

This change is part of a multi-part effort to fix the
HomeKit event storms on startup.

Previously we would set the states after HomeKit
had started up which meant that when the controller
client connected it would request the states and get
a list of default states so all the initial states
would always be wrong. The defaults states generally went
unnoticed because we set the state of each HomeKit device
soon after which would result in an event storm in the log
that looked like the following for every client and every
device:

Sending event to client: ('192.168.x.x', 58410)
Sending event to client: ('192.168.x.x', 53399)
Sending event to client: ('192.168.x.x', 53399)

To solve this, we now set the state right away when we
create the entity in HomeKit, so it is correct on
initial sync, which avoids the event storm.  Additionally,
we now check all states values before sending an update
to HomeKit to ensure we do not send events when nothing
has changed.

* pylint

* Fix event storm in covers as well

* fix refactoring error in security system

* cover positions, now with constants
2020-04-15 21:38:31 -05:00
J. Nick Koston c75d3ce8c7
Add tilt support to basic homekit window covers (#33937)
* Add tilt support to basic homekit window covers

* Add stop support to all window covers

* protect supports_stop
2020-04-12 15:27:17 -07:00
J. Nick Koston ad5a396c10
Fix reversed door closing/opening states in HomeKit (#34095)
* Fix reversed door closing/opening states in HomeKit

When we closed the door we would set state 2 which
is "Opening" it should have been 3 which is
"Closing"

When we opened the door we would set state 3 which
is "Closing" it should have been 2 which is
"Opening"

Add constants to make this easier to catch
in the future.

* Remove debug

* Add note about target door state
2020-04-12 15:15:55 -07: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 6cafc9aaef
Add humidity support to homekit thermostats (#33367) 2020-03-31 11:45:33 -07:00
Marcel Steinbach 6208d8c911
Add HomeKit support for slat tilting (#33388)
* Add HomeKit support for slat tilting

* Reset tilt-specific attribute, not position attribute

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Add explanation why we fix HomeKit's targets

We have to assume that the device has worse precision than HomeKit. If it
reports back a state that is only _close_ to HK's requested state, we'll
"fix" what HomeKit requested so that it won't appear out of sync.

Co-authored-by: J. Nick Koston <nick@koston.org>
2020-03-30 19:47:03 -05: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
Austin Drummond e24d56aa5b Add HomeKit Television functionality (#22968) 2019-05-05 17:51:47 +02:00
Austin Drummond b4e2a0ef84 Add HomeKit low battery threshold config (#23363) 2019-04-30 02:02:53 +02:00
Austin Drummond 3d441dffad Update HAP-python to 2.5.0 (#23031) 2019-04-12 13:26:52 +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 ed7aea006a
Add safe_mode HomeKit (#18356)
* Use: 'safe_mode: True' in case of pairing issues
2018-11-16 11:08:39 +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