1
0
mirror of https://github.com/home-assistant/core.git synced 2025-08-12 23:10:05 +00:00
Commit Graph

89 Commits

Author SHA1 Message Date
J. Nick Koston
265f6653c3 Refactor homekit to use a dataclass for entry data () 2023-10-10 21:14:37 +02:00
J. Nick Koston
4c255677c3 Add support for receivers to HomeKit () 2023-09-25 09:36:01 -05:00
Assaf Inbal
7446ff478f Add h264_v4l2m2m codec and profiles to HomeKit cameras () 2023-04-12 10:46:21 -10:00
Doney den Ouden
755c44d152 Add HomeKit Door accessory type ()
Co-authored-by: Jason Redd <jredd46@gmail.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-03-06 18:07:43 -10:00
Stackie Jia
a1eec7b55d Expose NO2 and VOCs sensors to homekit ()
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-10-30 11:33:06 -05:00
Lester Lo
56abd5f2cf Add homekit pm type sensor ()
Co-authored-by: J. Nick Koston <nick@koston.org>
2022-03-08 08:37:20 +01:00
J. Nick Koston
f2f2a08966 Add support for auto target fan state in HomeKit fans () 2022-02-21 19:08:09 +01:00
J. Nick Koston
5c8271552a Add hardware revision support to homekit () 2022-01-04 16:19:12 +01:00
J. Nick Koston
7a46e04fd1 Remove unused homekit.start service () 2021-12-27 10:12:02 +01:00
epenet
931d51949d Use new DeviceClass enums in homekit ()
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 () 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 () 2021-10-24 11:46:35 +02:00
J. Nick Koston
bd0af57ef2 Support device triggers in HomeKit () 2021-08-25 16:47:39 +02:00
J. Nick Koston
df03cce471 Enforce maximum length for HomeKit characteristics () 2021-08-03 10:09:10 -07:00
Milan Meulemans
8ab3d9cc12 Use homeassistant.const instead of integration const for device_info ATTR_ () 2021-08-02 15:11:41 +02:00
J. Nick Koston
009f34bfed Add a homekit.unpair service to forcefully remove pairings ()
- 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 () 2021-06-11 13:35:03 +02:00
J. Nick Koston
baa8de2f89 Fix homekit memory leak on entry reload () 2021-04-20 09:11:58 -07:00
Mick Vleeshouwer
9a98dcf432 Add HomeKit support for new CO / CO2 device class () 2021-03-12 09:03:47 -10:00
J. Nick Koston
f4b775b125 Cleanup homekit and remove aid storage from hass.data () 2021-03-11 22:05:03 -08:00
J. Nick Koston
0d07dae3bc Change default homekit ports to 21063 and 21064 ()
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 ()
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 () 2021-01-29 09:57:13 -06:00
J. Nick Koston
4bf9ce6fca Add support for homekit garage obstruction sensors () 2020-10-23 12:18:02 -05:00
J. Nick Koston
3ffa050905 Support HomeKit accessory mode ()
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 ()
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 () 2020-08-06 17:47:39 -05:00
Austin Drummond
9d0f58009e Add support for HomeKit doorbell ()
* 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 ()
* 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 ()
* 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 ()
* 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 ()
* 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 ()
* 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 ()
* 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 ()
* 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 ()
* 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 ()
* 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 ()
* 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 () 2020-04-21 17:43:49 -07:00
J. Nick Koston
d06fce6997 Display Homekit QR code when pairing ()
* 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 ()
* 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 ()
* 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 ()
* 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 ()
* 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 ()
* 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 () 2020-03-31 11:45:33 -07:00
Marcel Steinbach
6208d8c911 Add HomeKit support for slat tilting ()
* 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 ()
* 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 ()
* added the ability to reset homekit accessories

* added tests for homekit reset accessory

* minor fixes
2019-07-16 03:43:37 +02:00