Exceeding features of homebridge-openhab2 and openHAB's Homekit Plugin since
v.0.3.0
This homebridge plugin for openHAB fully supports all services offered by Apple's HomeKit Accessory Protocol (HAP), as far as it is feasible based on the item types offered by OpenHAB (see below for the currently supported 29 accessories). In opposite to the existing openHAB homebridge plugin or the native openHAB Homekit Plugin, this plugin requires explicit declaration of accessories in the homebridge configuration and does not use openHAB's tagging system, which leads to a little more effort during configuration, but proves more reliable and functional in more complex installations. See Comparisson below.
Note: Please install homebridge first.
npm install -g homebridge-openhab2-complete
Some people are experiencing dependency issues between homebridge's node version and the required node version for this project. My local setup is based on oznu's homebridge docker container, where I never ran into any problems. In order to install the plugin in the docker, just add npm install homebridge-openhab2-complete
to the startup.sh
script inside the mapped docker volume.
This is a platform plugin, that will register all accessories within the Bridge provided by homebridge. The following shows the general homebridge configuration (config.json
), see the Supported HAP Services below, in order to get the detailed configuration for each service.
{
"bridge": {
...
},
"accessories": [
...
],
"platforms": [
{
"platform": "openHAB2-Complete",
"host": "http://192.168.0.100",
"port": "8080",
"accessories": [
{
"name": "An items name, as shown in Homekit later",
"type": "switch",
"item": "Itemname-within-OpenHAB"
},
...
]
},
...
]
}
platform
has to be"openHAB2-Complete"
host
: The IP or hostname of your openHAB instance. The Protocol specifier (http://
) is optional, defaults tohttp://
(independent of the specified port)port
: (optional) If not specified the default port of the specifiedhost
protocol is used.accessory
: An array of accessories exposed to HomeKit, see the next chapter for available services and their configurations.
Alternatively you can group accessories of the same type
in a sub-array:
...
"platforms": [
{
...
"accessories": [
{
"type": "switch",
"items": [
{
"name": "An items name, as shown in Homekit later",
"item": "Itemname-within-OpenHAB"
},
{
"name": "An items name, as shown in Homekit later",
"item": "Itemname-within-OpenHAB"
},
...
]
},
...
]
},
...
The following is a list of all services that are currently supported and which values are required within the accessory configuration. Every accessory needs a name
(as shown in HomeKit later) and a type
.
- Complex Accessories:
- Lightbulb
- Homebridge configuration type:
light
- Homebridge configuration type:
- Fan
- Homebridge configuration type:
fan
- Homebridge configuration type:
- Security System
- Homebridge configuration type:
security
- Homebridge configuration type:
- Lightbulb
- Climate Control Accessories:
- Thermostat
- Homebridge configuration type:
thermostat
- Homebridge configuration type:
- Humidifier/Dehumidifier
- Homebridge configuration type:
humidifier
- Homebridge configuration type:
- Heater/Cooler
- Homebridge configuration type:
heatercooler
- Homebridge configuration type:
- Air Purifier
- Homebridge configuration type:
airpurifier
- Homebridge configuration type:
- Thermostat
- Watering Accessories:
- Faucet
- Homebridge configuration type:
faucet
- Homebridge configuration type:
- Valve
- Homebridge configuration type:
valve
- Homebridge configuration type:
- Irrigation System
- Homebridge configuration type:
irrigation
- Homebridge configuration type:
- Faucet
- Position Based Actors:
- Window Covering
- Homebridge configuration type:
windowcovering
- Homebridge configuration type:
- Door
- Homebridge configuration type:
door
- Homebridge configuration type:
- Window
- Homebridge configuration type:
window
- Homebridge configuration type:
- Lock Mechanism
- Homebridge configuration type:
lock
- Homebridge configuration type:
- Garage Door Opener
- Homebridge configuration type:
garage
- Homebridge configuration type:
- Window Covering
- Numeric Sensors:
- Temperature Sensor
- Homebridge configuration type:
temp
- Homebridge configuration type:
- Humidity Sensor
- Homebridge configuration type:
humidity
- Homebridge configuration type:
- Light Sensor
- Homebridge configuration type:
lux
- Homebridge configuration type:
- Air Quality Sensor
- Homebridge configuration type:
air
- Homebridge configuration type:
- Temperature Sensor
- Binary Actors:
- Binary Sensors:
- Motion Sensor
- Homebridge configuration type:
motion
- Homebridge configuration type:
- Occupancy Sensor
- Homebridge configuration type:
occupancy
- Homebridge configuration type:
- Leak Sensor
- Homebridge configuration type:
leak
- Homebridge configuration type:
- Carbon Monoxide Sensor
- Homebridge configuration type:
co
- Homebridge configuration type:
- Carbon Dioxide Sensor
- Homebridge configuration type:
co2
- Homebridge configuration type:
- Contact Sensor
- Homebridge configuration type:
contact
- Homebridge configuration type:
- Smoke Sensor
- Homebridge configuration type:
smoke
- Homebridge configuration type:
- Filter Maintenance Sensor
- Homebridge configuration type:
filter
- Homebridge configuration type:
- Motion Sensor
The following services are also defined by the HomeKit protocol, but since I don't know a good way to map them to openHAB items, I currently don't plan to implement them. Let me know if you have any ideas, by opening an issue!
- Slat
- Microphone
- Speaker
- Camera RTP Stream Management
- Doorbell
- Stateless Programmable Switch
This service describes a lightbulb.
{
"name": "An items name, as shown in Homekit later",
"type": "light",
"item": "Itemname-within-OpenHAB"
}
item
: The openHAB item controlled by this accessory- Needs to be of type
Switch
,Dimmer
orColor
within openHAB (HomeKit will correctly display brightness -in case ofDimmer
orColor
- and color settings -in case ofColor
-)
- Needs to be of type
This service describes a fan.
{
"name": "An items name, as shown in Homekit later",
"type": "fan",
"item": "Itemname-within-OpenHAB",
}
item
: The openHAB item controlled by this accessory- Needs to be of type
Switch
,Number
orDimmer
within openHAB (HomeKit will correctly display fan speed control -in case ofNumber
orDimmer
-)
- Needs to be of type
This service describes a security system.
{
"name": "An items name, as shown in Homekit later",
"type": "security"
"homeItem": "Itemname-within-OpenHAB",
"homeItemInverted": "false",
"awayItem": "Itemname-within-OpenHAB",
"awayItemInverted": "false",
"sleepItem": "Itemname-within-OpenHAB",
"sleepItemInverted": "false",
"alarmItem": "Itemname-within-OpenHAB",
"alarmItemInverted": "false"
}
homeItem
(optional): The openHAB item representing if the system is in home mode- Needs to be of type
Switch
within openHAB
- Needs to be of type
homeItemInverted
(optional): IfhomeItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
awayItem
(optional): The openHAB item representing if the system is in away mode- Needs to be of type
Switch
within openHAB
- Needs to be of type
awayItemInverted
(optional): IfawayItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
sleepItem
(optional): The openHAB item representing if the system is in sleep mode- Needs to be of type
Switch
within openHAB
- Needs to be of type
sleepItemInverted
(optional): IfsleepItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
alarmItem
(optional): The openHAB item representing if the system is currently sounding an alarm- Needs to be of type
Switch
within openHAB
- Needs to be of type
alarmItemInverted
(optional): IfalarmItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
Each item (homeItem
, awayItem
, sleepItem
, alarmItem
) is optional, only one of them needs to be defined. When switching between the states (Home Armed
, Away Armed
, Sleep Armed
& Off
) the respective item gets turned on and all other will be turned off. The state of the system is determined which item in the order alarmItem
-> homeItem
-> awayItem
-> sleepItem
is turned on first, if all items are off the state is OFF
.
This service describes a thermostat.
{
"name": "An items name, as shown in Homekit later",
"type": "thermostat",
"currentTempItem": "Itemname-within-OpenHAB",
"targetTempItem": "Itemname-within-OpenHAB",
"currentHumidityItem": "Itemname-within-OpenHAB",
"targetHumidityItem": "Itemname-within-OpenHAB",
"heatingItem": "Itemname-within-OpenHAB",
"coolingItem": "Itemname-within-OpenHAB",
"tempUnit": "Celsius",
"heatingThresholdTempItem": "Itemname-within-OpenHAB",
"coolingThresholdTempItem": "Itemname-within-OpenHAB",
"modeItem": "Itemname-within-OpenHAB",
}
currentTempItem
: The openHAB item representing the current temperature as measured by the thermostat- Needs to be of type
Number
within openHAB
- Needs to be of type
targetTempItem
: The openHAB item representing the target temperature inside the room- Needs to be of type
Number
within openHAB
- Needs to be of type
currentHumidityItem
(optional): The openHAB item representing the current humidity as measured by the thermostat- Needs to be of type
Number
within openHAB
- Needs to be of type
targetHumidityItem
(optional): The openHAB item representing the target humidity inside the room- Needs to be of type
Number
within openHAB
- Needs to be of type
heatingItem
(optional, ifcoolingItem
is present, otherwise required): The openHAB item showing, if the room is currently being heated- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
coolingItem
(optional, ifheatingItem
is present, otherwise required): The openHAB item showing, if the room is currently being cooled- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
tempUnit
(optional): Gives the measurement unit of the thermostat, currently does not change anything inside HomeKit- Default:
Celsius
- Allowed values:
Celsius
&Fahrenheit
- Default:
heatingThresholdTempItem
: (optional) The openHAB item describing the heating threshold in Celsius for devices that support simultaneous heating and cooling. The value of this characteristic represents the 'minimum temperature' that mus be reached before heating is turned on.- Needs to be of type
Number
within openHAB
- Needs to be of type
coolingThresholdTempItem
: (optional) The openHAB item describing the cooling threshold in Celsius for devices that support simultaneous heating and cooling. The value of this characteristic represents the 'maximum temperature' that mus be reached before cooling is turned on.- Needs to be of type
Number
within openHAB
- Needs to be of type
modeItem
: (optional) If your thermostat can be set to heating, cooling or auto mode through an item, and/or reports back its current configuration use this item, otherwise the heating/cooling capabilities are deferred fromheatingItem
andcoolingItem
and will not be changeable.- Needs to be of type
Number
within openHAB - Only discrete values are recognized:
- 0 ≙
Off
- 1 ≙
Heating
- 2 ≙
Cooling
- 3 ≙
Auto
- 0 ≙
- Needs to be of type
This service describes a humidifier and/or dehumidifier accessory.
{
"name": "An items name, as shown in Homekit later",
"type": "humidifier",
"currentHumidityItem": "Itemname-within-OpenHAB",
"activeItem": "Itemname-within-OpenHAB",
"activeItemInverted": "false",
"humidifierItem": "Itemname-within-OpenHAB",
"dehumidifierItem": "Itemname-within-OpenHAB",
"modeItem": "Itemname-within-OpenHAB",
"humidifierThresholdItem": "Itemname-within-OpenHAB",
"dehumidifierThresholdItem": "Itemname-within-OpenHAB",
"waterLevelItem": "Itemname-within-OpenHAB",
"swingItem": "Itemname-within-OpenHAB",
"swingItemInverted": "false",
"rotationSpeedItem": "Itemname-within-OpenHAB"
}
currentHumidityItem
: The openHAB item representing the current humidity- Needs to be of type
Number
within openHAB
- Needs to be of type
activeItem
: The openHAB item showing, if the (de-)humidfier is currently active- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
activeItemInverted
(optional): IfactiveItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
humidifierItem
(optional, ifdehumidifierItem
is present, otherwise required): The openHAB item showing, if the room is currently humidified- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
dehumidifierItem
(optional, ifhumidifierItem
is present, otherwise required): The openHAB item showing, if the room is currently dehumidified- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
modeItem
: (optional) If your (de-)humidifier can be set to humidifying, dehumidifying or auto mode through an item, and/or reports back its current configuration use this item, otherwise the humidifying/dehumidifying capabilities are deferred fromhumidifierItem
anddehumidifierItem
and will not be changeable.- Needs to be of type
Number
within openHAB - Only discrete values are recognized:
- 0 ≙
Humidifier or Dehumidifier
- 1 ≙
Humidifier
- 2 ≙
Dehumidifier
- 0 ≙
- Needs to be of type
humidifierThresholdItem
: (optional) The openHAB item describing the humidifying threshold. The value of this characteristic represents the 'minimum relative humidity' that mus be reached before humidifying is turned on.- Needs to be of type
Number
within openHAB
- Needs to be of type
dehumidifierThresholdItem
: (optional) The openHAB item describing the dehumidifying threshold. The value of this characteristic represents the 'maximum relative humidity' that mus be reached before dehumidifying is turned on.- Needs to be of type
Number
within openHAB
- Needs to be of type
waterLevelItem
: (optional) The openHAB item representing the current water level- Needs to be of type
Number
within openHAB
- Needs to be of type
swingItem
: (optional) The openHAB item showing, if swing is active- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
swingItemInverted
(optional): IfswingItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
rotationSpeedItem
: (optional) The openHAB item representing the rotation speed- Needs to be of type
Number
within openHAB
- Needs to be of type
This service describes a heater and/or cooler accessory.
{
"name": "An items name, as shown in Homekit later",
"type": "heatercooler",
"currentTempItem": "Itemname-within-OpenHAB",
"activeItem": "Itemname-within-OpenHAB",
"activeItemInverted": "false",
"heatingItem": "Itemname-within-OpenHAB",
"coolingItem": "Itemname-within-OpenHAB",
"modeItem": "Itemname-within-OpenHAB",
"heatingThresholdItem": "Itemname-within-OpenHAB",
"coolingThresholdItem": "Itemname-within-OpenHAB",
"swingItem": "Itemname-within-OpenHAB",
"swingItemInverted": "false",
"rotationSpeedItem": "Itemname-within-OpenHAB"
"tempUnit": "Celsius",
}
currentTempItem
: The openHAB item representing the current temperature- Needs to be of type
Number
within openHAB
- Needs to be of type
activeItem
: The openHAB item showing, if the heater/cooler is currently active- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
activeItemInverted
(optional): IfactiveItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
heatingItem
(optional, ifcoolingItem
is present, otherwise required): The openHAB item showing, if the room is currently being heated- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
coolingItem
(optional, ifheatingItem
is present, otherwise required): The openHAB item showing, if the room is currently being cooled- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
modeItem
: (optional) If your heater/cooler can be set to heating, cooling or auto mode through an item, and/or reports back its current configuration use this item, otherwise the heating/cooling capabilities are deferred fromheatingItem
andcoolingItem
and will not be changeable.- Needs to be of type
Number
within openHAB - Only discrete values are recognized:
- 0 ≙
Auto
- 1 ≙
Heat
- 2 ≙
Cool
- 0 ≙
- Needs to be of type
heatingThresholdTempItem
: (optional) The openHAB item describing the heating threshold in Celsius for devices that support simultaneous heating and cooling. The value of this characteristic represents the 'minimum temperature' that mus be reached before heating is turned on.- Needs to be of type
Number
within openHAB
- Needs to be of type
coolingThresholdTempItem
: (optional) The openHAB item describing the cooling threshold in Celsius for devices that support simultaneous heating and cooling. The value of this characteristic represents the 'maximum temperature' that mus be reached before cooling is turned on.- Needs to be of type
Number
within openHAB
- Needs to be of type
swingItem
: (optional) The openHAB item showing, if swing is active- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
swingItemInverted
(optional): IfswingItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
rotationSpeedItem
: (optional) The openHAB item representing the rotation speed- Needs to be of type
Number
within openHAB
- Needs to be of type
tempUnit
(optional): Gives the measurement unit of the thermostat, currently does not change anything inside HomeKit- Default:
Celsius
- Allowed values:
Celsius
&Fahrenheit
- Default:
This service describes an air purifier accessory.
{
"name": "An items name, as shown in Homekit later",
"type": "airpurifier",
"purifyingItem": "Itemname-within-OpenHAB",
"modeItem": "Itemname-within-OpenHAB",
"activeItem": "Itemname-within-OpenHAB",
"activeItemInverted": "false",
"swingItem": "Itemname-within-OpenHAB",
"swingItemInverted": "false",
"rotationSpeedItem": "Itemname-within-OpenHAB"
}
purifyingItem
: The openHAB item showing, if the air purifier is currently purifying the air- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
modeItem
: The openHAB item showing, if the air purifier is currently in Manual (OFF
orCLOSED
) or Automatic Mode (ON
orOPEN
)- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
activeItem
: The openHAB item showing, if the air purifier is currently active- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
activeItemInverted
(optional): IfactiveItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
swingItem
: (optional) The openHAB item showing, if swing is active- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
swingItemInverted
(optional): IfswingItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
rotationSpeedItem
: (optional) The openHAB item representing the rotation speed- Needs to be of type
Number
within openHAB
- Needs to be of type
This service describes a faucet.
{
"name": "An items name, as shown in Homekit later",
"type": "faucet",
"item": "Itemname-within-OpenHAB",
"inverted": "true"
}
item
: The openHAB item showing, if the faucet is currently active- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
inverted
(optional): Ifitem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes a valve.
{
"name": "An items name, as shown in Homekit later",
"type": "valve",
"activeItem": "Itemname-within-OpenHAB",
"acitveItemInverted": "true",
"inUseItem": "Itemname-within-OpenHAB",
"inUseItemInverted": "true",
"durationItem": "Itemname-within-OpenHAB",
"valveType": "generic"
}
activeItem
: The openHAB item showing, if the valve is currently active- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
activeItemInverted
(optional): IfactiveItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
inUseItem
Representing, if the valve is currently in use (ifSwitch
isON
,Contact
isOPEN
orNumber
is greater than 0)- Needs to be of type
Switch
,Contact
orNumber
within openHAB
- Needs to be of type
inUseItemInverted
(optional): IfinUseItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
durationItem
(optional): This item will be set by HomeKit to show the duration for the watering. This item should also be decreased, to show the remaining watering time- Needs to be of type
Number
within openHAB
- Needs to be of type
valveType
(optional): The type of valve described by this service.- Default:
generic
- Allowed values:
generic
,irrigation
,showerhead
,faucet
- Default:
This service describes an irrigation system.
{
"name": "An items name, as shown in Homekit later",
"type": "irrigation",
"activeItem": "Itemname-within-OpenHAB",
"acitveItemInverted": "true",
"inUseItem": "Itemname-within-OpenHAB",
"inUseItemInverted": "true",
"durationItem": "Itemname-within-OpenHAB",
"programMode": "manual",
"programModeItem": "Itemname-within-OpenHAB"
}
activeItem
: The openHAB item showing, if the valve is currently active- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
activeItemInverted
(optional): IfactiveItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
inUseItem
Representing, if the valve is currently in use (ifSwitch
isON
,Contact
isOPEN
orNumber
is greater than 0)- Needs to be of type
Switch
,Contact
orNumber
within openHAB
- Needs to be of type
inUseItemInverted
(optional): IfinUseItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
durationItem
(optional): This item will be set by HomeKit to show the duration for the watering. This item should also be decreased, to show the remaining watering time- Needs to be of type
Number
within openHAB
- Needs to be of type
programMode
(optional): The current program mode of this accessory.- Default:
noprogram
- Allowed values:
noprogram
,scheduled
,manual
- Default:
programModeItem
(optional): If your accessory can dynamically report its program mode, use this item as an alternative toprogramMode
.- Needs to be of type
Number
within openHAB - Only discrete values are recognized:
- 0 ≙
No Program scheduled
- 1 ≙
Program scheduled
- 2 ≙
Manual Mode
- 0 ≙
- Needs to be of type
This service describes motorized window coverings or shades - examples include shutters, blinds, awnings etc.
{
"name": "An items name, as shown in Homekit later",
"type": "windowcovering",
"item": "Itemname-within-OpenHAB",
"inverted": "false",
"multiplier": "1",
"stateItem": "Itemname-within-OpenHAB",
"stateItemInverted": "false"
"stateItemMultiplier": "1",
"manuMode": "false"
}
item
: The openHAB item representing the window covering, receiving commands about the target position and determining the current position (ifstateItem
is not set)- Needs to be of type
Rollershutter
,Number
orSwitch
within openHAB
- Needs to be of type
inverted
(optional): Ifitem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
multiplier
(optional): Ifitem
's state need to be multiplied by a fixed amount to make sense to HomeKit, set this to a number (e.g. if your device stores its state in a float range from 0 to 1, where HomeKit expects integer numbers from 0 to 100 use a multiplier of 100)- Default:
"1"
- Needs to be a number don't forget the quotes
- Default:
stateItem
(optional): The openHAB item, used to determine the state of the window covering instead ofitem
's state- Needs to be of type
Rollershutter
,Number
,Switch
orContact
within openHAB
- Needs to be of type
stateItemInverted
(optional): IfstateItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
stateItemMultiplier
(optional): IfstateItem
's state need to be multiplied by a fixed amount to make sense to HomeKit, set this to a number (e.g. if your device stores its state in a float range from 0 to 1, where HomeKit expects integer numbers from 0 to 100 use a multiplier of 100)- Default:
"1"
- Needs to be a number don't forget the quotes
- Default:
manuMode
(optional): If your item can be operated manually, you should enable this mode to not seeOpening...
orClosing...
on the item when manipulating the state manually (This is due to the fact that HomeKit stores aTargetState
value and compares it to theActualState
to show this metadata. ThemanuMode
automatically changes theTargetState
of the item, when theActualState
is changed)- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes a motorized door
{
"name": "An items name, as shown in Homekit later",
"type": "door",
"item": "Itemname-within-OpenHAB",
"inverted": "false",
"multiplier": "1",
"stateItem": "Itemname-within-OpenHAB",
"stateItemInverted": "false",
"stateItemMultiplier": "1",
"manuMode": "false"
}
item
: The openHAB item representing the door, receiving commands about the target position and determining the current position (ifstateItem
is not set)- Needs to be of type
Rollershutter
,Number
orSwitch
within openHAB
- Needs to be of type
inverted
(optional): Ifitem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
multiplier
(optional): Ifitem
's state need to be multiplied by a fixed amount to make sense to HomeKit, set this to a number (e.g. if your device stores its state in a float range from 0 to 1, where HomeKit expects integer numbers from 0 to 100 use a multiplier of 100)- Default:
"1"
- Needs to be a number don't forget the quotes
- Default:
stateItem
(optional): The openHAB item, used to determine the state of the door instead ofitem
's state- Needs to be of type
Rollershutter
,Number
,Switch
orContact
within openHAB
- Needs to be of type
stateItemInverted
(optional): IfstateItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
stateItemMultiplier
(optional): IfstateItem
's state need to be multiplied by a fixed amount to make sense to HomeKit, set this to a number (e.g. if your device stores its state in a float range from 0 to 1, where HomeKit expects integer numbers from 0 to 100 use a multiplier of 100)- Default:
"1"
- Needs to be a number don't forget the quotes
- Default:
manuMode
(optional): If your item can be operated manually, you should enable this mode to not seeOpening...
orClosing...
on the item when manipulating the state manually (This is due to the fact that HomeKit stores aTargetState
value and compares it to theActualState
to show this metadata. ThemanuMode
automatically changes theTargetState
of the item, when theActualState
is changed)- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes a motorized window
{
"name": "An items name, as shown in Homekit later",
"type": "window",
"item": "Itemname-within-OpenHAB",
"inverted": "false",
"multiplier": "1",
"stateItem": "Itemname-within-OpenHAB",
"stateItemInverted": "false",
"stateItemMultiplier": "1",
"manuMode": "false"
}
item
: The openHAB item representing the window, receiving commands about the target position and determining the current position (ifstateItem
is not set)- Needs to be of type
Rollershutter
,Number
orSwitch
within openHAB
- Needs to be of type
inverted
(optional): Ifitem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
multiplier
(optional): Ifitem
's state need to be multiplied by a fixed amount to make sense to HomeKit, set this to a number (e.g. if your device stores its state in a float range from 0 to 1, where HomeKit expects integer numbers from 0 to 100 use a multiplier of 100)- Default:
"1"
- Needs to be a number don't forget the quotes
- Default:
stateItem
(optional): The openHAB item, used to determine the state of the window instead ofitem
's state- Needs to be of type
Rollershutter
,Number
,Switch
orContact
within openHAB
- Needs to be of type
stateItemInverted
(optional): IfstateItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
stateItemMultiplier
(optional): IfstateItem
's state need to be multiplied by a fixed amount to make sense to HomeKit, set this to a number (e.g. if your device stores its state in a float range from 0 to 1, where HomeKit expects integer numbers from 0 to 100 use a multiplier of 100)- Default:
"1"
- Needs to be a number don't forget the quotes
- Default:
manuMode
(optional): If your item can be operated manually, you should enable this mode to not seeOpening...
orClosing...
on the item when manipulating the state manually (This is due to the fact that HomeKit stores aTargetState
value and compares it to theActualState
to show this metadata. ThemanuMode
automatically changes theTargetState
of the item, when theActualState
is changed)- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
The HomeKit Lock Mechanism service is designed to expose and control the physical lock mechanism on a device.
{
"name": "An items name, as shown in Homekit later",
"type": "lock",
"item": "Itemname-within-OpenHAB",
"inverted": "false",
"stateItem": "Itemname-within-OpenHAB",
"stateItemInverted": "false"
}
item
: The openHAB item representing the lock, receiving commands about the target position and determining the current position (ifstateItem
is not set)- Needs to be of type
Switch
within openHAB
- Needs to be of type
inverted
(optional): Ifitem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
stateItem
(optional): The openHAB item, used to determine the state of the lock instead ofitem
's state- Needs to be of type
Rollershutter
,Number
,Switch
orContact
within openHAB
- Needs to be of type
stateItemInverted
(optional): IfstateItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes a garage door opener tat controls a single door. If a garage has more than one door, then each door should have its own Garage Door Opener Service.
{
"name": "An items name, as shown in Homekit later",
"type": "garage",
"item": "Itemname-within-OpenHAB",
"inverted": "false",
"multiplier": "1",
"stateItem": "Itemname-within-OpenHAB",
"stateItemInverted": "false",
"stateItemMultiplier": "1",
"obstructionItem": "Itemname-within-OpenHAB",
"obstructionItemInverted": "false"
}
item
: The openHAB item representing the garage door, receiving commands about the target position and determining the current position (ifstateItem
is not set)- Needs to be of type
Rollershutter
,Number
orSwitch
within openHAB - In case of a
Number
item:- 100 ≙ OPEN
- 0 ≙ CLOSED
- In case of a
Rollershutter
item:- For the current state, the accessory behaves like a
Number
item - For the target state, the item will receive
UP
andDOWN
commands - If you have an inverted
Rollershutter
item, use the same item asstateItem
withstateItemInverted
set to"true"
andinverted
set to false
- For the current state, the accessory behaves like a
- Needs to be of type
inverted
(optional): Ifitem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
multiplier
(optional): Ifitem
's state need to be multiplied by a fixed amount to make sense to HomeKit, set this to a number (e.g. if your device stores its state in a float range from 0 to 1, where HomeKit expects integer numbers from 0 to 100 use a multiplier of 100)- Default:
"1"
- Needs to be a number don't forget the quotes
- Default:
stateItem
(optional): The openHAB item, used to determine the state of the garage door instead ofitem
's state- Needs to be of type
Rollershutter
,Number
,Switch
orContact
within openHAB
- Needs to be of type
stateItemInverted
(optional): IfstateItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
stateItemMultiplier
(optional): IfstateItem
's state need to be multiplied by a fixed amount to make sense to HomeKit, set this to a number (e.g. if your device stores its state in a float range from 0 to 1, where HomeKit expects integer numbers from 0 to 100 use a multiplier of 100)- Default:
"1"
- Needs to be a number don't forget the quotes
- Default:
obstructionItem
: The openHAB item showing, if an obstruction is detected- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
obstructionItemInverted
(optional): IfobstructionItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes a temperature sensor.
{
"name": "An items name, as shown in Homekit later",
"type": "temp",
"item": "Itemname-within-OpenHAB",
"batteryItem": "Itemname-within-OpenHAB",
"batteryItemInverted": "false"
}
item
: The openHAB item representing the current temperature- Needs to be of type
Number
within openHAB
- Needs to be of type
batteryItem
(optional): The openHAB item representing a battery warning for this accessory. If the item has the stateON
orOPEN
the battery warning will be triggered- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
batteryItemInverted
(optional): IfbatteryItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes a humidity sensor.
{
"name": "An items name, as shown in Homekit later",
"type": "humidity",
"item": "Itemname-within-OpenHAB",
"batteryItem": "Itemname-within-OpenHAB",
"batteryItemInverted": "false"
}
item
: The openHAB item representing the current humidity- Needs to be of type
Number
within openHAB
- Needs to be of type
batteryItem
(optional): The openHAB item representing a battery warning for this accessory. If the item has the stateON
orOPEN
the battery warning will be triggered- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
batteryItemInverted
(optional): IfbatteryItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes a light sensor.
{
"name": "An items name, as shown in Homekit later",
"type": "lux",
"item": "Itemname-within-OpenHAB",
"batteryItem": "Itemname-within-OpenHAB",
"batteryItemInverted": "false"
}
item
: The openHAB item representing the current light in lux- Needs to be of type
Number
within openHAB
- Needs to be of type
batteryItem
(optional): The openHAB item representing a battery warning for this accessory. If the item has the stateON
orOPEN
the battery warning will be triggered- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
batteryItemInverted
(optional): IfbatteryItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes an air quality sensor.
{
"name": "An items name, as shown in Homekit later",
"type": "air",
"item": "Itemname-within-OpenHAB",
"batteryItem": "Itemname-within-OpenHAB",
"batteryItemInverted": "false"
}
item
: The openHAB item representing the current air quality, referring to the cumulative air quality recorded by the accessory, which may be based on multiple sensors present.- Needs to be of type
Number
within openHAB - Only discrete values are recognized:
- 0 ≙
UNKNOWN
- 1 ≙
EXCELLENT
- 2 ≙
GOOD
- 3 ≙
FAIR
- 4 ≙
INFERIOR
- 5 ≙
POOR
- 0 ≙
- Needs to be of type
batteryItem
(optional): The openHAB item representing a battery warning for this accessory. If the item has the stateON
orOPEN
the battery warning will be triggered- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
batteryItemInverted
(optional): IfbatteryItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes a binary switch.
{
"name": "An items name, as shown in Homekit later",
"type": "switch",
"item": "Itemname-within-OpenHAB",
"inverted": "false"
}
item
: The openHAB item controlled by this accessory- Needs to be of type
Switch
within openHAB
- Needs to be of type
inverted
(optional): Ifitem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes an outlet.
{
"name": "An items name, as shown in Homekit later",
"type": "outlet",
"item": "Itemname-within-OpenHAB",
"inUseItem": "Itemname-within-OpenHAB",
"inUseItemInverted": "false"
}
item
: The openHAB item controlled by this accessory- Needs to be of type
Switch
within openHAB
- Needs to be of type
inverted
(optional): Ifitem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
inUseItem
(optional): Representing, if the outlet is currently in use (ifSwitch
isON
,Contact
isOPEN
orNumber
is greater than 0)- Default: The state of
item
is used to show if the outlet is in use - Needs to be of type
Switch
,Contact
orNumber
within openHAB
- Default: The state of
inUseItemInverted
(optional): IfinUseItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes a motion sensor.
{
"name": "An items name, as shown in Homekit later",
"type": "motion",
"item": "Itemname-within-OpenHAB",
"inverted": "true",
"batteryItem": "Itemname-within-OpenHAB",
"batteryItemInverted": "false"
}
item
: The openHAB item showing, if motion is detected- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
inverted
(optional): Ifitem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
batteryItem
(optional): The openHAB item representing a battery warning for this accessory. If the item has the stateON
orOPEN
the battery warning will be triggered- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
batteryItemInverted
(optional): IfbatteryItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes an occupancy sensor.
{
"name": "An items name, as shown in Homekit later",
"type": "occupancy",
"item": "Itemname-within-OpenHAB",
"inverted": "true",
"batteryItem": "Itemname-within-OpenHAB",
"batteryItemInverted": "false"
}
item
: The openHAB item showing, if occupancy is detected- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
inverted
(optional): Ifitem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
batteryItem
(optional): The openHAB item representing a battery warning for this accessory. If the item has the stateON
orOPEN
the battery warning will be triggered- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
batteryItemInverted
(optional): IfbatteryItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes a leak sensor.
{
"name": "An items name, as shown in Homekit later",
"type": "leak",
"item": "Itemname-within-OpenHAB",
"inverted": "true",
"batteryItem": "Itemname-within-OpenHAB",
"batteryItemInverted": "false"
}
item
: The openHAB item showing, if a leak is detected- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
inverted
(optional): Ifitem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
batteryItem
(optional): The openHAB item representing a battery warning for this accessory. If the item has the stateON
orOPEN
the battery warning will be triggered- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
batteryItemInverted
(optional): IfbatteryItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes a carbon monoxide sensor.
{
"name": "An items name, as shown in Homekit later",
"type": "co",
"item": "Itemname-within-OpenHAB",
"inverted": "true",
"levelItem": "Itemname-within-OpenHAB",
"batteryItem": "Itemname-within-OpenHAB",
"batteryItemInverted": "false"
}
item
: The openHAB item showing, if carbon monoxide is detected- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
inverted
(optional): Ifitem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
levelItem
(optional): The openHAB item representing the current carbon monoxide level, measured by the sensor- Needs to be of type
Number
within openHAB
- Needs to be of type
batteryItem
(optional): The openHAB item representing a battery warning for this accessory. If the item has the stateON
orOPEN
the battery warning will be triggered- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
batteryItemInverted
(optional): IfbatteryItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes a carbon dioxide sensor.
{
"name": "An items name, as shown in Homekit later",
"type": "co2",
"item": "Itemname-within-OpenHAB",
"inverted": "true",
"levelItem": "Itemname-within-OpenHAB",
"batteryItem": "Itemname-within-OpenHAB",
"batteryItemInverted": "false"
}
item
: The openHAB item showing, if carbon dioxide is detected- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
inverted
(optional): Ifitem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
levelItem
(optional): The openHAB item representing the current carbon dioxide level, measured by the sensor- Needs to be of type
Number
within openHAB
- Needs to be of type
batteryItem
(optional): The openHAB item representing a battery warning for this accessory. If the item has the stateON
orOPEN
the battery warning will be triggered- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
batteryItemInverted
(optional): IfbatteryItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes a contact sensor.
{
"name": "An items name, as shown in Homekit later",
"type": "contact",
"item": "Itemname-within-OpenHAB",
"inverted": "true",
"batteryItem": "Itemname-within-OpenHAB",
"batteryItemInverted": "false",
}
item
: The openHAB item showing, if contact is detected- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
inverted
(optional): Ifitem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
batteryItem
(optional): The openHAB item representing a battery warning for this accessory. If the item has the stateON
orOPEN
the battery warning will be triggered- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
batteryItemInverted
(optional): IfbatteryItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes a smoke sensor.
{
"name": "An items name, as shown in Homekit later",
"type": "smoke",
"item": "Itemname-within-OpenHAB",
"inverted": "true",
"batteryItem": "Itemname-within-OpenHAB",
"batteryItemInverted": "false",
}
item
: The openHAB item showing, if smoke is detected- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
inverted
(optional): Ifitem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
batteryItem
(optional): The openHAB item representing a battery warning for this accessory. If the item has the stateON
orOPEN
the battery warning will be triggered- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
batteryItemInverted
(optional): IfbatteryItem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
This service describes a filter maintenance sensor.
{
"name": "An items name, as shown in Homekit later",
"type": "filter",
"item": "Itemname-within-OpenHAB",
"inverted": "true",
"levelItem": "Itemname-within-OpenHAB"
}
item
: The openHAB item showing, if filter maintenance is required- Needs to be of type
Switch
orContact
within openHAB
- Needs to be of type
inverted
(optional): Ifitem
's state needs to be interpreted inverted, set this value to"true"
- Default:
"false"
- Allowed values:
"true"
&"false"
don't forget the quotes
- Default:
levelItem
(optional): The openHAB item representing the current filter level- Needs to be of type
Number
within openHAB
- Needs to be of type
Obviously the aim of this project is a full coverage of the HAP specification. Due to the limitations of smart devices in my home I can only test a subset and would love to have your feedback and input for this project.
Due to the very limited documentation on homebridge plugin development I have not implemented a dynamic platform (there is only this partly complete wiki entry). If anyone of you knows how to do it, please contact me directly!
If you have feedback or suggestions how to better represent the services as openHAB Items, feel free to open an issue.
If you would like to contribute just send me a pull request. In order to add a new service you have to modify/add the following parts:
- Create your own accessory class within
./accessory
- The only required functions are
getServices()
(returning an array ofHAP.Service
with attachedHAP.Characteristic
) andidentify()
(which does not need to do anything). Those are implemented in theAccessory
super class and don't need to be overridden. Make sure thatthis._services
is populated and reflects your service - Define
const type = "YourTypeName"
(this will be used insideconfig.json
to identify an accessory of your type) andfunction createAccessory(platform, config)
returning an instance of your Accessory. - Finally expose
type
andcreateAccessory
throughmodule.exports = {type, createAccessory}
My accessories are using centrally defined characteristics inside ./accessory/characteristic
. See NumericSensor.js
for a simple characteristic implementation and TemperatureSensor.js
for a simple accessory using this characteristic. This is not a requirement, but highly recommended.
homebridge-openhab2 plugin | openHAB2 - Complete Edition |
---|---|
Verly little configuration within homebridge/openHAB, only tags within *.items files and inclusion within sitemap, obviously requiring both to be created manually |
Explicit declaration within config.json not requiring instable openHAB Metadata Provider (removes items if state is NULL ) and de-couples homebridge configuration from openHAB |
Support only 1:1 mappings between Items and HomeKit services | Supports composite items (e.g. Thermostat, Security System, Battery States, etc.) |
Uses SSE to receive push notifications from openHAB about state change and requires sitemap definitions |
Pulling of states through REST interface & push notifications from openHAB through SSE without the requirement of a sitemap |
Thermostats never really worked | Thermostats working as expected |
4 accessory types supported | 29 different accessory types supported |
Light item in openHAB gets triggered multiple times from single user interaction | Light item in openHAB receives only one command per user interaction |
No support for items with notification capabilities | Many HomeKit services can notify the user about a state change. Those accessories are only supported in this plugin |
Concluding, I personally might only consider using the OpenHAB homebridge plugin in smaller, less diverse installations. However my own installation has a a lot of different device types, that I want to fully include in HomeKit, therefore this plugin is the only feasible way for me and everyone alike.