Skip to content
Merged
Show file tree
Hide file tree
Changes from 190 commits
Commits
Show all changes
192 commits
Select commit Hold shift + click to select a range
ce7a3e1
initial contribution
andrewfg Sep 10, 2025
72bb54a
work in progress
andrewfg Sep 10, 2025
f20fc81
work in progress
andrewfg Sep 10, 2025
62aaa90
work in progress
andrewfg Sep 10, 2025
1cc5a0b
Merge branch 'openhab:main' into homekit-client
andrewfg Sep 10, 2025
1a1824a
work in progress
andrewfg Sep 10, 2025
4cac1c8
Merge branch 'homekit-client' of https://github.com/andrewfg/openhab-…
andrewfg Sep 10, 2025
f11ec7f
work in progress
andrewfg Sep 11, 2025
4417971
work in progress
andrewfg Sep 12, 2025
6217919
work in progress
andrewfg Sep 12, 2025
46a7904
fix wrong exception type
andrewfg Sep 12, 2025
9de2d04
work in progress
andrewfg Sep 13, 2025
84ff44a
work in progress
andrewfg Sep 14, 2025
6151a88
work in progress
andrewfg Sep 14, 2025
81706c8
work in progress
andrewfg Sep 14, 2025
0477c23
work in progress
andrewfg Sep 15, 2025
3ea7db7
Merge remote-tracking branch 'upstream/main' into homekit-client
andrewfg Sep 15, 2025
1358bc2
work in progress
andrewfg Sep 16, 2025
22878c2
line endings
andrewfg Sep 16, 2025
f03016a
Update bundles/org.openhab.binding.homekit/src/main/java/org/openhab/…
andrewfg Sep 16, 2025
a457726
Update bundles/org.openhab.binding.homekit/src/main/java/org/openhab/…
andrewfg Sep 16, 2025
1115774
adopt first round copilot suggestions
andrewfg Sep 16, 2025
adc4f25
Update README.md
andrewfg Sep 16, 2025
16864eb
adopt copilot second suggestions
andrewfg Sep 16, 2025
a42501a
work in progress
andrewfg Sep 18, 2025
b75d1f3
fix unit testing; add support for property channels
andrewfg Sep 21, 2025
9a63e20
Update bundles/org.openhab.binding.homekit/src/main/java/org/openhab/…
andrewfg Sep 21, 2025
a6f06f8
Merge remote-tracking branch 'upstream/main' into homekit-client
andrewfg Sep 21, 2025
02fb31e
adopt reviewer suggestions
andrewfg Sep 21, 2025
8e6fbe8
implement IP transport plus various fixes
andrewfg Sep 22, 2025
44775fd
work in progress
andrewfg Sep 22, 2025
de1d5a7
improve channel ids
andrewfg Sep 22, 2025
99c5339
refactoring
andrewfg Sep 22, 2025
89b85ec
small fixes
andrewfg Sep 22, 2025
a08cc71
adopt reviewer suggestions
andrewfg Sep 23, 2025
5b69543
fix jmdns issue; refactoring
andrewfg Sep 24, 2025
f837ce7
work in progress
andrewfg Sep 26, 2025
7adc7f4
pairing setup now working
andrewfg Sep 26, 2025
4049ca9
Merge branch 'openhab:main' into homekit-client
andrewfg Sep 28, 2025
84a2439
refactoring
andrewfg Sep 28, 2025
f9684c6
work in progress
andrewfg Sep 28, 2025
1523e38
Merge remote-tracking branch 'upstream/main' into homekit-client
andrewfg Sep 28, 2025
403e955
work in progress
andrewfg Sep 29, 2025
ffdce47
first working build
andrewfg Sep 30, 2025
b78f740
readme fixes
andrewfg Sep 30, 2025
bbe4b4c
work in progress
andrewfg Sep 30, 2025
e6477ee
unique xxx-type uids
andrewfg Oct 1, 2025
13d2991
refactor type provider code
andrewfg Oct 1, 2025
453c27b
Merge branch 'openhab:main' into homekit-client
andrewfg Oct 1, 2025
b4eeea4
refactoring and fix write characteristic
andrewfg Oct 2, 2025
bd268e5
fix issues with characteristic write
andrewfg Oct 3, 2025
e6fbd44
throw different exception if port is missing
andrewfg Oct 3, 2025
46feb32
exact length client id; add validators
andrewfg Oct 4, 2025
05eae28
cleaner log cosmetics
andrewfg Oct 4, 2025
4ec0df0
send TLVs in specified order; refactor TLV enums
andrewfg Oct 4, 2025
a4e7e96
improve getProperties fix
andrewfg Oct 5, 2025
75f41c3
improved testing and logging
andrewfg Oct 5, 2025
608bcb9
work in progress
andrewfg Oct 6, 2025
9bb63fc
refactor http parsing; support chunked
andrewfg Oct 6, 2025
97704ca
work in progress
andrewfg Oct 7, 2025
4931ba1
remove useless prefixes
andrewfg Oct 7, 2025
d8fe07c
work in progress
andrewfg Oct 8, 2025
d2e5f2f
implement json key store
andrewfg Oct 9, 2025
43d7530
controller id is mac address
andrewfg Oct 10, 2025
ffa62cd
widen airing code matcher; use UUID for device id
andrewfg Oct 10, 2025
0d4fd4d
fixes
andrewfg Oct 10, 2025
05236fc
add discovery flag properties
andrewfg Oct 11, 2025
dc23790
fix channel fields; tweak ff param enum
andrewfg Oct 11, 2025
04dc7a3
use uuid strings; improve logging
andrewfg Oct 12, 2025
d7a7ed6
fix build error
andrewfg Oct 12, 2025
dc647a7
remove id size checks
andrewfg Oct 12, 2025
18d972d
add length to tlv trace logs
andrewfg Oct 12, 2025
422ddd4
uom tweaks
andrewfg Oct 12, 2025
59a005b
Simplify accessory discovery
jlaur Oct 12, 2025
9c527b8
various
andrewfg Oct 19, 2025
1f840fa
create unique thing labels
andrewfg Oct 19, 2025
09fa62b
Merge pull request #3 from jlaur/homekit-discovery
andrewfg Oct 19, 2025
59dd447
add velux junit test stub
andrewfg Oct 19, 2025
7e23479
spotless
andrewfg Oct 19, 2025
b429040
fix rollershutter button commands
andrewfg Oct 20, 2025
2fdf314
add junit intricate use cases, and fixes arising thereforom
andrewfg Oct 20, 2025
242054e
work towards using light state machine
andrewfg Oct 20, 2025
a42d692
completed light state model
andrewfg Oct 21, 2025
b91026e
various
andrewfg Oct 21, 2025
78fea42
implement event/trigger channel update
andrewfg Oct 21, 2025
06b9586
implement immediate stop
andrewfg Oct 21, 2025
fa8d0f0
various
andrewfg Oct 21, 2025
7d936eb
prepare i18n and event handling
andrewfg Oct 22, 2025
2ce57a1
typo
andrewfg Oct 22, 2025
091507d
eventing code completed
andrewfg Oct 22, 2025
3257f59
eliminate recursion loop; eliminate duplicate code
andrewfg Oct 22, 2025
f7f2acb
spotless
andrewfg Oct 22, 2025
a5c48ad
fix evented channels not discovered
andrewfg Oct 23, 2025
a33a1fb
various
andrewfg Oct 24, 2025
1e6dd29
suppress log message on closing
andrewfg Oct 24, 2025
2f80690
fix disposition of HS parts of HSB commands
andrewfg Oct 24, 2025
f3a72a5
fix hsb brightness and on/off
andrewfg Oct 24, 2025
ea6a844
quick update hsb dependent channels
andrewfg Oct 24, 2025
3bc8ef1
flip online state
andrewfg Oct 24, 2025
f0822c3
add i18n for enum values and channel labels
andrewfg Oct 25, 2025
cd7646d
restart polling after bridge disconnect and reconnect
andrewfg Oct 25, 2025
4b602ab
revert 3bc8ef1
andrewfg Oct 25, 2025
6b8aa0a
various
andrewfg Oct 25, 2025
b638163
various
andrewfg Oct 25, 2025
f52fa73
restart also after command error
andrewfg Oct 25, 2025
aa17e4a
various
andrewfg Oct 26, 2025
fb1c59b
documentation
andrewfg Oct 26, 2025
698f468
Update bundles/org.openhab.binding.homekit/src/main/resources/OH-INF/…
andrewfg Oct 27, 2025
cfe9bcf
revert prior
andrewfg Oct 27, 2025
2bfab6f
fix http split frame issue
andrewfg Oct 28, 2025
61aba1f
various
andrewfg Oct 28, 2025
cb67603
code optimisations
andrewfg Oct 29, 2025
e3ad3dc
i18n
andrewfg Oct 29, 2025
70a47c7
handle previously uncaught exceptions
andrewfg Oct 29, 2025
031e2f1
Merge remote-tracking branch 'upstream/main' into homekit-client
andrewfg Oct 30, 2025
805155f
use thing action for pairing
andrewfg Oct 31, 2025
2994e8f
fixes for pairing action
andrewfg Nov 1, 2025
9be0f38
i18n
andrewfg Nov 1, 2025
4827ae7
add thing action unpair
andrewfg Nov 1, 2025
4cf1a20
various
andrewfg Nov 3, 2025
fd286e4
various
andrewfg Nov 4, 2025
256580e
Add support for manual configuration
jlaur Nov 3, 2025
ffcb31c
documentation of pairing thing action
andrewfg Nov 4, 2025
46abcdc
update read me for manual configuration
andrewfg Nov 4, 2025
1d17956
add example
andrewfg Nov 4, 2025
392115e
Merge pull request #4 from jlaur/homekit-config
andrewfg Nov 5, 2025
19c8246
various
andrewfg Nov 5, 2025
917ac5b
various
andrewfg Nov 7, 2025
0f8c236
escape host name spaces
andrewfg Nov 7, 2025
579f0e8
second try for host name with spaces
andrewfg Nov 7, 2025
7d48c9f
various
andrewfg Nov 9, 2025
f62fe43
various
andrewfg Nov 9, 2025
17a23a8
various refactoring
andrewfg Nov 11, 2025
3a16aa9
fix shutdown bug
andrewfg Nov 11, 2025
0682b4a
ensure unique channel ids
andrewfg Nov 12, 2025
4bbb18f
add result messages for thing actions
andrewfg Nov 12, 2025
c1658de
small fixes
andrewfg Nov 12, 2025
a94c296
fix compile error
andrewfg Nov 12, 2025
6b66f2c
add HSB parts to evented, polled cxx lists
andrewfg Nov 13, 2025
cc30ce8
[breaking] various
andrewfg Nov 21, 2025
ce8d964
typos
andrewfg Nov 21, 2025
50b38fd
improve volatile resource clean-up and usage
andrewfg Nov 22, 2025
036553b
differentiate root vs. child accessory thing type ids
andrewfg Nov 23, 2025
605e41c
adjust readme
andrewfg Nov 23, 2025
181328f
oops
andrewfg Nov 23, 2025
509ab06
simplify child check
andrewfg Nov 23, 2025
bc2ebdc
rename thing type ids
andrewfg Nov 24, 2025
03ad488
minor tweaks to readme and thing xml
andrewfg Nov 24, 2025
d3f4384
discovery creates unique thing labels
andrewfg Nov 24, 2025
59bc7a3
adopt reviewer suggestions
andrewfg Nov 25, 2025
fac3df6
fix some (but not all) checkstyle warnings
andrewfg Nov 25, 2025
e581ce9
hardening and refactoring
andrewfg Nov 25, 2025
b50667b
Update bundles/org.openhab.binding.homekit/README.md
andrewfg Nov 26, 2025
e0c3fa3
Update bundles/org.openhab.binding.homekit/README.md
andrewfg Nov 26, 2025
f7df9ed
Update bundles/org.openhab.binding.homekit/README.md
andrewfg Nov 26, 2025
b859910
refactor names to match new thing-type id schema
andrewfg Nov 26, 2025
920aa86
Merge branch 'openhab:main' into homekit-client
andrewfg Nov 26, 2025
aadf181
adopt reviewer suggestions - part 1
andrewfg Nov 26, 2025
4e20891
typo
andrewfg Nov 26, 2025
3c0031c
adopt reviewer suggestions - part 2
andrewfg Nov 27, 2025
8f9c9d2
adopt reviewer suggestions
andrewfg Nov 30, 2025
e55701a
fix @text argument passing
andrewfg Nov 30, 2025
ae994a8
fix writing to immutable map
andrewfg Nov 30, 2025
2c5a98b
Invert delay check for throttling logic
andrewfg Nov 30, 2025
32d1b91
Merge branch 'openhab:main' into homekit-client
andrewfg Dec 1, 2025
f502424
Update bundles/org.openhab.binding.homekit/README.md
andrewfg Dec 1, 2025
564263a
various
andrewfg Dec 2, 2025
c602ca4
sleeker start up process
andrewfg Dec 4, 2025
6eafb2e
handle case of thing (re)enable after start-up
andrewfg Dec 5, 2025
c5b7209
various
andrewfg Dec 5, 2025
1120986
fix silly error
andrewfg Dec 5, 2025
f0b750d
Merge branch 'openhab:main' into homekit-client
andrewfg Dec 5, 2025
5c12539
various
andrewfg Dec 7, 2025
096b261
third attempt; awaiting dependent things
andrewfg Dec 9, 2025
2dc0120
adopt some reviewer suggestions
andrewfg Dec 9, 2025
bae66af
adapt based on prior review comments
andrewfg Dec 10, 2025
22d983f
adopt some reviewer suggestions
andrewfg Dec 10, 2025
f9ebe16
sacrifice javadoc clarity for fewer code style warnings
andrewfg Dec 10, 2025
dac81d5
use fully qualified class names
andrewfg Dec 10, 2025
dfeb6b4
split signal paths for channel definitions and properties
andrewfg Dec 11, 2025
113b4ad
Update bundles/org.openhab.binding.homekit/src/main/java/org/openhab/…
andrewfg Dec 11, 2025
bc09b2d
provisional: adopt reviewer suggestions
andrewfg Dec 11, 2025
8336efe
add equipment tag
andrewfg Dec 12, 2025
45d0fd1
improve equipment tagging
andrewfg Dec 12, 2025
b4700e6
Merge branch 'openhab:main' into homekit-client
andrewfg Dec 12, 2025
b333f54
fix misclassification of battery powered accessories
andrewfg Dec 12, 2025
b1a951f
tweak equipment tag code
andrewfg Dec 12, 2025
a9d0cc2
Update bundles/org.openhab.binding.homekit/README.md
andrewfg Dec 12, 2025
8232057
Update bundles/org.openhab.binding.homekit/src/main/java/org/openhab/…
andrewfg Dec 12, 2025
178ee86
Update bundles/org.openhab.binding.homekit/src/main/java/org/openhab/…
andrewfg Dec 12, 2025
7450b0b
Merge branch 'main' into homekit-client
andrewfg Dec 13, 2025
7b6b1d2
fix bad github merge suggestion
andrewfg Dec 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
/bundles/org.openhab.binding.herzborg/ @Sonic-Amiga
/bundles/org.openhab.binding.homeassistant/ @antroids @ccutrer
/bundles/org.openhab.binding.homeconnect/ @bruestel
/bundles/org.openhab.binding.homekit/ @andrewfg
/bundles/org.openhab.binding.homematic/ @FStolte @gerrieg @mdicke2s
/bundles/org.openhab.binding.homewizard/ @Daniel-42
/bundles/org.openhab.binding.hpprinter/ @cossey
Expand Down
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,11 @@
<artifactId>org.openhab.binding.homeconnect</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.homekit</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.homematic</artifactId>
Expand Down
13 changes: 13 additions & 0 deletions bundles/org.openhab.binding.homekit/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This content is produced and maintained by the openHAB project.

* Project home: https://www.openhab.org

== Declared Project Licenses

This program and the accompanying materials are made available under the terms
of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/.

== Source Code

https://github.com/openhab/openhab-addons
144 changes: 144 additions & 0 deletions bundles/org.openhab.binding.homekit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# HomeKit Binding

This binding allows pairing with HomeKit accessories and **imports** their services as channel groups and their respective service- characteristics as channels.
Do not confuse this with the [HomeKit system integration](https://www.openhab.org/addons/integrations/homekit/) which **exports** openHAB Items to a HomeKit controller.

## Supported Things

There are three types of Things supported:

- `accessory`: This integrates a single HomeKit accessory, which has its own LAN connection.
Its services appear as Channel Groups, and their respective characteristics appear as Channels.
- `bridged-accessory`: This integrates a single HomeKit accessory, which does NOT have its own LAN connection.
It has the same functionality as an `accessory`, except that its communication is done via a `bridge` (see below).
- `bridge`: This integrates a HomeKit bridge accessory, which has its own LAN connection.
It does not have any own Channels.
Instead it contains multiple `bridged-accessory` Things (see above).

Things of type `bridge` and `accessory` both communicate directly with their HomeKit accessory device via the LAN.
Whereas `bridged-accessory` Things communicate via their respective `bridge` Thing.

## Discovery

Both `accessory` and `bridge` Things will be auto-discovered via mDNS.
And once a `bridge` Thing has been instantiated and paired, its `bridged-accessory` Things will also be auto-discovered.

## Configuration for `bridge` and `accessory` Things

The following table shows the Thing configuration parameters for `bridge` and `accessory` Things.

| Name | Type | Description | Default | Required | Advanced |
|-------------------|---------|------------------------------------------------------|-----------|----------|----------|
| `ipAddress` | text | IP v4 address of the HomeKit accessory. | see below | yes | no |
| `httpHostHeader` | text | The fully qualified host name as discovered by mDNS. | see below | yes | yes |
| `uniqueId` | text | Unique accessory identifier as discovered by mDNS. | see below | yes | yes |
| `refreshInterval` | integer | Interval at which the accessory is polled in sec. | 60 | no | yes |

NOTE: as a general rule, if you create the Things via the Inbox from the mDNS discovery result, then all of the above configuration parameters will have their proper values already preset.

`ipAddress` must match the format `123.123.123.123:4567` representing its IP v4 address and port.

`httpHostHeader` is required for the 'Host:' header of HTTP requests sent to the `accessory` or `bridge`.
It must be the fully qualified host name (e.g. `foobar._hap._tcp.local.` or, if the port is not 0 or 80, `foobar._hap._tcp.local.:1234`) as found manually via (say) an mDNS discovery app.

`uniqueId` must be the unique accessory identifier as found manually via (say) an mDNS discovery app.
Typically it takes the form `00:1A:2B:3C:4D:5E` which is similar to (or the same as) a MAC address.

### Configuration for `bridged-accessory` Things

The following table shows the Thing configuration parameters for `bridged-accessory` Things.

| Name | Type | Description | Default | Required | Advanced |
|-------------------|---------|------------------------------------------------------|-----------|----------|----------|
| `accessoryID` | integer | ID of the accessory. | see below | yes | yes |

As a general rule `accessoryID` is set by the auto-discovery process.
However you can configure it manually if you wish.
It must be the ID of the `bridged-accessory` within the `bridge`.

## Thing Pairing

The `bridge` and `accessory` Things need to be paired with their respective HomeKit accessories.
This requires entering the HomeKit pairing code by means of a Thing Action.

Note that HomeKit accessories can only be paired with one controller, so if it is already paired with something else, you will need to remove that pairing first.
There are two forms of pairing:

1. Simple pairing.
This works directly between two devices – a HomeKit client (this binding) and a HomeKit accessory.
In this case you need only to enter the pairing code into the Thing Action.
1. Pairing with external authorization.
In addition to the HomeKit client (this binding) and the HomeKit accessory, it requires an additional third party to put the accessory into pairing mode.
Typically the additional third party can be either a) using the accessory's app to put it into pairing mode, or b) pressing a pairing button on the device.

In either case above, the Pairing Code must be entered manually into the Thing Action dialog.
The Pairing Code must match the format `XXX-XX-XXX` or `XXXX-XXXX` or `XXXXXXXX` where `X` is a single digit.

For case 1. above, the `With External Authentication` switch must be `OFF`.
Whereas for case 2. above, must be `ON`.

## Channels

For `accessory` and `bridged-accessory` Things, the Channels are auto-created depending on the services and characteristics published by the HomeKit accessory.
Things of type `bridge` do not have own Channels.

As a general rule openHAB has one Channel for each HomeKit characteristic.
Some HomeKit accessories have separate characteristics for 'target' and 'current' states.
The two characteristics may have different values (e.g. for a thermostat).
In all such cases the Thing has a Channel for each characteristic so that both values can be accessed.

Some HomeKit characteristics represent fixed information e.g. model number, firmware version, etc.
Such values appear in openHAB as properties of the respective Thing.

### Special Extra HSBType Channel

In openHAB the norm is that lighting objects shall be represented by a single `HSBType` Channel which manages hue, saturation, brightness, and on-off states.
By contrast a HomeKit accessory has four separate characteristics for hue, saturation, brightness, and on-off.
So the Thing creates one additional `HSBType` Channel that amalgamates hue, saturation, brightness, and on-off characteristics, according to the openHAB norm.

## Integration with Apple Home App / Ecosystem

Many HomeKit accessories are able only to be paired with one client.
This means that if you want to pair such an accessory with this binding, you must first unpair it from the Apple Home app.

If you want to integrate such an accessory with both this binding and with the Apple Home ecosystem, then you can use this binding to import the Channels as openHAB Items, and then use the openHAB system integration addon to re-export those Items to the Apple HomeKit eco system.

## File Based Configuration

### Thing Configuration

Things are automatically configured when they are discovered.
So for this reason it is difficult to create Things via a '.things' file, and therefore not recommended.

```java
Bridge homekit:bridge:velux "VELUX Gateway" [ ipAddress="192.168.0.235:5001", uniqueId="XX:XX:XX:XX:XX:XX", httpHostHeader="foobar._hap._tcp.local.", refreshInterval=60 ] {
Thing bridged-accessory sensor "VELUX Sensor" @ "Hallway" [ accessoryID=2 ]
Thing bridged-accessory skylight_hallway "VELUX Window" @ "Hallway" [ accessoryID=3 ]
Thing bridged-accessory skylight_bathroom "VELUX Window" @ "Bathroom" [ accessoryID=4 ]
}
```

### Item Configuration

```java
Group VeluxSensorSwitch "Velux indoor climate sensor" (Hallway) ["Sensor"]

Number:Dimensionless Velux_Hallway_CO2 "CO2 [%d ppm]" <carbondioxide> (VeluxSensorSwitch) ["Measurement", "CO2"] { channel="homekit:bridged-accessory:velux:sensor:sensor-carbon-dioxide#carbon-dioxide-level-17", unit="ppm" }
Number:Dimensionless Velux_Hallway_Humidity "Humidity [%.0f %%]" <humidity> (VeluxSensorSwitch) ["Measurement", "Humidity"] { channel="homekit:bridged-accessory:velux:sensor:sensor-humidity#relative-humidity-current-13", unit="%" }
Number:Temperature Velux_Hallway_Temperature "Temperature" <temperature> (VeluxSensorSwitch) ["Measurement", "Temperature"] { channel="homekit:bridged-accessory:velux:sensor:sensor-temperature#temperature-current-10", unit="°C" }

Group SkylightHallway "Skylight window" (Hallway) ["Window"]

Rollershutter SkylightHallway_Position "Position" (SkylightHallway) ["OpenState"] { channel="homekit:bridged-accessory:velux:skylight_hallway:window#position-target-11" }

Group SkylightBathroom "Skylight window" (SmallBathroom) ["Window"]

Rollershutter SkylightBathroom_Position "Position" (SkylightBathroom) ["OpenState"] { channel="homekit:bridged-accessory:velux:skylight_bathroom:window#position-target-11" }
```

### Sitemap Configuration

```perl
Slider item=SkylightHallway_Position
Slider item=SkylightBathroom_Position
```
25 changes: 25 additions & 0 deletions bundles/org.openhab.binding.homekit/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>5.1.0-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.binding.homekit</artifactId>

<name>openHAB Add-ons :: Bundles :: HomeKit Client Binding</name>

<dependencies>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.81</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.homekit-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>

<feature name="openhab-binding-homekit" description="HomeKit Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.homekit/${project.version}</bundle>
</feature>
</features>
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
* Copyright (c) 2010-2025 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.homekit.internal;

import java.util.regex.Pattern;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.ThingTypeUID;

/**
* Defines common constants which are used across the whole HomeKit binding.
*
* @author Andrew Fiddian-Green - Initial contribution
*/
@NonNullByDefault
public class HomekitBindingConstants {

public static final String BINDING_ID = "homekit";

// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_ACCESSORY = new ThingTypeUID(BINDING_ID, "accessory");
public static final ThingTypeUID THING_TYPE_BRIDGED_ACCESSORY = new ThingTypeUID(BINDING_ID, "bridged-accessory");
public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "bridge");

/**
* format string for channel-group-type UIDs which represent services
* format: 'channel-group-type'-[serviceIdentifier]-[serviceIid]-[thingId]-[accessoryId]
* example: channel-group-type-accessory-information-1-1234567890abcdef-1
*/
public static final String CHANNEL_GROUP_TYPE_ID_FMT = "channel-group-type-%s-%d-%s-%s";

/**
* format string for channel-type UIDs which represent characteristics
* format: 'channel-type'-[characteristicIdentifier]-[characteristicIid]-[thingId]-[accessoryId]
* example: channel-type-occupancy-detected-2694-1234567890abcdef-1
*/
public static final String CHANNEL_TYPE_ID_FMT = "channel-type-%s-%d-%s-%s";

/**
* format string for channel-definition IDs like '[characteristicIdentifier]-[characteristicIid]'
* used to instantiate channels and labels like '[thingName]-[accessoryAid]' used to discover
* things; examples:
* <ul>
* <li>occupancy-detected-2694</li>
* <li>11:22:33:44:55:66-1234</li>
* </ul>
*/
public static final String STRING_AID_FMT = "%s-%d";

// labels for things e.g. 'Living Room Light (11:22:33:44:55:66-1234)'
public static final String THING_LABEL_FMT = "%s (%s)";

// configuration parameters
public static final String CONFIG_HTTP_HOST_HEADER = "httpHostHeader";
public static final String CONFIG_IP_ADDRESS = "ipAddress";
public static final String CONFIG_REFRESH_INTERVAL = "refreshInterval";
public static final String CONFIG_ACCESSORY_ID = "accessoryID";
public static final String CONFIG_UNIQUE_ID = "uniqueId";

// thing properties
public static final String PROPERTY_PROTOCOL_VERSION = "protocolVersion";
public static final String PROPERTY_ACCESSORY_CATEGORY = "accessoryCategory";
public static final String PROPERTY_UNIQUE_ID = CONFIG_UNIQUE_ID;

// channel properties
public static final String PROPERTY_IID = "iid";
public static final String PROPERTY_FORMAT = "format";
public static final String PROPERTY_DATA_TYPE = "dataType";

// HomeKit HTTP URI endpoints and content types
public static final String ENDPOINT_ACCESSORIES = "/accessories";
public static final String ENDPOINT_CHARACTERISTICS = "/characteristics";
public static final String ENDPOINT_PAIR_SETUP = "/pair-setup";
public static final String ENDPOINT_PAIR_VERIFY = "/pair-verify";

public static final String CONTENT_TYPE_PAIRING = "application/pairing+tlv8";
public static final String CONTENT_TYPE_HAP = "application/hap+json";

// pattern matcher for pairing code XXX-XX-XXX or XXXX-XXXX or XXXXXXXX
public static final Pattern PAIRING_CODE_PATTERN = Pattern.compile("\\d{3}-\\d{2}-\\d{3}|\\d{4}-\\d{4}|\\d{8}");

// pattern matcher for host ipv4 address 123.123.123.123:12345
public static final Pattern IPV4_PATTERN = Pattern.compile(
"^(((25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)\\.){3}(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)):(6553[0-5]|655[0-2]\\d|65[0-4]\\d{2}|6[0-4]\\d{3}|[1-5]?\\d{1,4})$");

// pattern matcher for a fully qualified host name like foobar._hap._tcp.local. or foobar._hap._tcp.local.:12345
// NOTE: this specially allows space characters in the host name -- even if normally not allowed by the RFC
public static final Pattern HOST_PATTERN = Pattern.compile(
"^([a-zA-Z0-9\\-\\x20]+)\\._hap\\._tcp\\.local\\.(?::([1-9]\\d{0,3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5]))?$");

// result messages for ThingActions; !! DO NOT LOCALIZE !!
public static final String ACTION_RESULT_OK = "OK";
public static final String ACTION_RESULT_OK_FORMAT = ACTION_RESULT_OK + " (%s)";
public static final String ACTION_RESULT_ERROR = "ERROR";
public static final String ACTION_RESULT_ERROR_FORMAT = ACTION_RESULT_ERROR + " (%s)";
}
Loading