Help me pliase! I can not add the items switches from OH2 HomeKit to the smarthome on my Iphone

  • Platform information:
    • Hardware: pi3
    • OS: Openhabian
    • Java Runtime Environment: OpenJDK Client VM version 25.252-b225
    • openHAB version:openHAB 2.5.5-1 (Release Build)

Hello All!
I can not add the items switches from OH2 HomeKit to the SmartHome on my Iphone.
Please help me understand what I’m doing wrong? Thanks!
These are the actions and commands I already did before writing here:

openhab> smarthome:homekit clearPairings
Cleared HomeKit pairings
openhab> smarthome:homekit allowUnauthenticated true
Enabled unauthenticated HomeKit access
sudo systemctl stop openhab2.service
cd $OPENHAB_USERDATA/jsondb/
rm homekit.json
Remove tmp files: sudo rm -rf /var/lib/openhab2/tmp/*
Remove cache files: sudo rm -rf /var/lib/openhab2/cache/*
Remove backup files: sudo rm -rf /var/lib/openhab2/jsondb/backup/*
Remove cache: sudo openhab-cli clean-cache
Restart OpenHab service: sudo reboot

As a result, SmatHome finds the device OpenHab requests a PIN code. After entering the pin code my phone gives an error in which it says that it can’t add the device.

in the log file we have the following:

2020-06-04 22:13:02.687 [WARN ] [ssories.AbstractHomekitAccessoryImpl] - State for characteristic ON_STATE at accessory 906600073 cannot be retrieved.
2020-06-04 22:13:02.716 [WARN ] [ssories.AbstractHomekitAccessoryImpl] - State for characteristic ON_STATE at accessory 906599980 cannot be retrieved.
2020-06-04 22:13:02.730 [WARN ] [ssories.AbstractHomekitAccessoryImpl] - State for characteristic ON_STATE at accessory 906599825 cannot be retrieved.
I provide the following configuration information for my OH2:

/etc/openhab2/services/homekit.cfg

org.openhab.homekit:port=9124
org.openhab.homekit:pin=022-22-222
org.openhab.homekit:useFahrenheitTemperature=true
org.openhab.homekit:thermostatTargetModeCool=CoolOn
org.openhab.homekit:thermostatTargetModeHeat=HeatOn
org.openhab.homekit:thermostatTargetModeAuto=Auto
org.openhab.homekit:thermostatTargetModeOff=Off
org.openhab.homekit:networkInterface=192.168.0.3
org.openhab.homekit:name=openHAB
org.openhab.homekit:minimumTemperature=-100
org.openhab.homekit:maximumTemperature=100

/etc/openhab2/items/default.items

// Anwesenheit
Group:Switch:OR(ON,OFF) Anwesenheitserkennung “Anwesenheitserkennung”
// Geräte
Switch Anwesenheit_AG “AG_Anwesenheit” (Anwesenheitserkennung) [“Switchable”]
Switch Anwesenheit_IG “IG_Anwesenheit” (Anwesenheitserkennung) [“Switchable”]
Switch Anwesenheit_FG “FG_Anwesenheit” [ “Switchable” ]

/etc/openhab2/sitemaps/default.sitemap

sitemap default label="My home automation" {
Switch item=Anwesenheit_AG label="Anwesenheit_AG"
Switch item=Anwesenheit_IG label="Anwesenheit_IG"
Switch item=Anwesenheit_FG label="Anwesenheit_FG"

}

/etc/openhab2/rules - no files

openhab> shell:info Karaf Karaf version 4.2.7 Karaf home /usr/share/openhab2/runtime Karaf base /var/lib/openhab2 OSGi Framework org.eclipse.osgi-3.12.100.v20180210-1608

JVM
Java Virtual Machine OpenJDK Client VM version 25.252-b225
Version 1.8.0_252
Vendor Azul Systems, Inc.
Pid 549
Uptime 20 minutes
Process CPU time 2 minutes
Process CPU load 0.03
System CPU load 0.04
Open file descriptors 235
Max file descriptors 102,642
Total compile time 21.823 seconds
Threads
Live threads 127
Daemon threads 62
Peak 225
Total started 1880
Memory
Current heap size 149,173 kbytes
Maximum heap size 316,800 kbytes
Committed heap size 190,208 kbytes
Pending objects 0
Garbage collector Name = ‘Copy’, Collections = 29, Time = 3.181 seconds
Garbage collector Name = ‘MarkSweepCompact’, Collections = 3, Time = 1.643 seconds
Classes
Current classes loaded 15,836
Total classes loaded 15,853
Total classes unloaded 17
Operating system
Name Linux version 4.19.118-v7+
Architecture arm
Processors 4

openhab> list

Pid: org.openhab.addons
BundleLocation: mvn:org.openhab.core.bundles/org.openhab.core.karaf/2.5.0
Properties:
binding = network,mqtt
misc = ,homekit
package = standard
service.pid = org.openhab.addons
ui = dashboard,basic,paper,habpanel,homebuilder

Pid: org.openhab.homekit
BundleLocation: null
Properties:
maximumTemperature = 100.0
minimumTemperature = -100.0
name = openHAB_1
networkInterface = 192.168.0.3
pin = 022-22-222
port = 9124
service.pid = org.openhab.homekit
thermostatCurrentModeCooling = Cooling
thermostatCurrentModeHeating = Heating
thermostatCurrentModeOff = Off
thermostatTargetModeAuto = Auto
thermostatTargetModeCool = CoolOn
thermostatTargetModeHeat = HeatOn
thermostatTargetModeOff = Off
useFahrenheitTemperature = true

openhab> smarthome:items list
Anwesenheit_AG (Type=SwitchItem, State=NULL, Label=AG_Anwesenheit, Category=null, Tags=[Switchable], Groups=[Anwesenheitserkennung])
Anwesenheitserkennung (Type=GroupItem, BaseType=SwitchItem, Members=2, State=NULL, Label=Anwesenheitserkennung, Category=group)
Anwesenheit_IG (Type=SwitchItem, State=NULL, Label=IG_Anwesenheit, Category=null, Tags=[Switchable], Groups=[Anwesenheitserkennung])
mqtt_topic_5bae512b_Test_DIM1 (Type=DimmerItem, State=NULL, Label=Test_DIM1, Category=null)
mqtt_topic_5bae512b_TestMQTT (Type=SwitchItem, State=NULL, Label=null, Category=null)
Anwesenheit_FG (Type=SwitchItem, State=NULL, Label=FG_Anwesenheit, Category=null, Tags=[Switchable])

openhab> smarthome:things list
mqtt:systemBroker:mqtt (Type=Bridge, Status=ONLINE, Label=MQTT Broker, Bridge=null)
mqtt:topic:5bae512b (Type=Thing, Status=ONLINE, Label=test MQTT Thing, Bridge=mqtt:systemBroker:mqtt)

openhab> smarthome:links list
mqtt_topic_5bae512b_Test_DIM1 -> mqtt:topic:5bae512b:Test_DIM1
mqtt_systemBroker_mqtt_max -> mqtt:systemBroker:mqtt:max
mqtt_topic_5bae512b_TestMQTT -> mqtt:topic:5bae512b:TestMQTT

openhab> bundle:list | grep Homekit
224 │ Active │ 80 │ 2.5.5 │ openHAB Add-ons :: Bundles :: IO :: Homekit

openhab> smarthome:homekit listAccessories
906599825 AG_Anwesenheit
906600073 IG_Anwesenheit
906599980 FG_Anwesenheit
openhab> smarthome:homekit printAccessory 906599825
906599825 AG_Anwesenheit
Services:
Service Type: 00000049-0000-1000-8000-0026BB765291
Characteristics:
: class io.github.hapjava.characteristics.impl.common.OnCharacteristic
openhab> smarthome:homekit printAccessory 906600073
906600073 IG_Anwesenheit
Services:
Service Type: 00000049-0000-1000-8000-0026BB765291
Characteristics:
: class io.github.hapjava.characteristics.impl.common.OnCharacteristic
openhab> smarthome:homekit printAccessory 906599980
906599980 FG_Anwesenheit
Services:
Service Type: 00000049-0000-1000-8000-0026BB765291
Characteristics:
: class io.github.hapjava.characteristics.impl.common.OnCharacteristic

Please use code fences to make your post more readable.
How to use code fences - Tutorials & Examples - openHAB Community

your configuration looks good.

potential issue could the “NULL” state of your items. it was actually fixed already a longer time ago, but who knows. so, if you have sitemap - please click on every switch you have (turn them on and off) or you can use karaf to send ON command to your items.

please also make a screenshot of iphone which you get after the screenshot you have posted. what happened if you click on “Добавить”?

Hi!

2020-06-05 02:08:25.788 [ome.event.ItemCommandEvent] - Item ‘Anwesenheit_AG’ received command ON
2020-06-05 02:08:25.850 [vent.ItemStateChangedEvent] - Anwesenheit_AG changed from NULL to ON
2020-06-05 02:08:25.859 [GroupItemStateChangedEvent] - Anwesenheitserkennung changed from NULL to ON through Anwesenheit_AG
2020-06-05 02:08:27.448 [ome.event.ItemCommandEvent] - Item ‘Anwesenheit_AG’ received command OFF
2020-06-05 02:08:27.460 [vent.ItemStateChangedEvent] - Anwesenheit_AG changed from ON to OFF
2020-06-05 02:08:27.469 [GroupItemStateChangedEvent] - Anwesenheitserkennung changed from ON to OFF through Anwesenheit_AG
2020-06-05 02:08:38.847 [ome.event.ItemCommandEvent] - Item ‘Anwesenheit_IG’ received command ON
2020-06-05 02:08:38.859 [vent.ItemStateChangedEvent] - Anwesenheit_IG changed from NULL to ON
2020-06-05 02:08:38.863 [GroupItemStateChangedEvent] - Anwesenheitserkennung changed from OFF to ON through Anwesenheit_IG
2020-06-05 02:08:40.556 [ome.event.ItemCommandEvent] - Item ‘Anwesenheit_IG’ received command OFF
2020-06-05 02:08:40.569 [vent.ItemStateChangedEvent] - Anwesenheit_IG changed from ON to OFF
2020-06-05 02:08:40.573 [GroupItemStateChangedEvent] - Anwesenheitserkennung changed from ON to OFF through Anwesenheit_IG
2020-06-05 02:08:41.291 [ome.event.ItemCommandEvent] - Item ‘Anwesenheit_IG’ received command ON
2020-06-05 02:08:41.304 [GroupItemStateChangedEvent] - Anwesenheitserkennung changed from OFF to ON through Anwesenheit_IG
2020-06-05 02:08:41.308 [vent.ItemStateChangedEvent] - Anwesenheit_IG changed from OFF to ON
2020-06-05 02:08:43.020 [ome.event.ItemCommandEvent] - Item ‘Anwesenheit_FG’ received command ON
2020-06-05 02:08:43.030 [vent.ItemStateChangedEvent] - Anwesenheit_FG changed from NULL to ON
2020-06-05 02:08:43.946 [ome.event.ItemCommandEvent] - Item ‘Anwesenheit_FG’ received command OFF
2020-06-05 02:08:43.956 [vent.ItemStateChangedEvent] - Anwesenheit_FG changed from ON to OFF
2020-06-05 02:10:41.946 [ome.event.ItemCommandEvent] - Item ‘Anwesenheit_AG’ received command ON
2020-06-05 02:10:41.961 [vent.ItemStateChangedEvent] - Anwesenheit_AG changed from OFF to ON
2020-06-05 02:10:42.652 [ome.event.ItemCommandEvent] - Item ‘Anwesenheit_AG’ received command OFF
2020-06-05 02:10:42.665 [vent.ItemStateChangedEvent] - Anwesenheit_AG changed from ON to OFF

After when I switched the switches to Basik UI. Warning messages in the logs have disappeared.
But the switches weren’t added to my phone. Now the logs are clean, but there is no OH2 connection with the phone.

Thanks for the advice! I fixed my message.

1 Like

@Shkiper is it working now ? can you see switches in home app? if not, try to delete home in home app, restart the iphone and add it again.

Hello! I didn’t succeed. ;-( I do not cherish when it is necessary to do incomprehensible operations like dancing with a tambourine. :frowning: Tell me where to dig further. I understand that you need to enable debugging mode and look for the reason. People, please direct me along the right path, help me not to waste time on wrong actions! Thank!

to me it looks like an issue in iphone.

  • which iOS version you have?
  • do you have apple tv at home (it acts as homekit bridge and makes sometimes issues)
  • do you have some other homekit device already connected to home app directly, without openHAB?
  • have you tried to delete “home” in the home app, restart iphone and add home again?
  • is authentication enabled, i.e. smarthome:homekit allowUnauthenticated false