]> git.basschouten.com Git - openhab-addons.git/commitdiff
[homekit] Unify all enum handling (#14036)
authorCody Cutrer <cody@cutrer.us>
Wed, 22 Mar 2023 12:58:12 +0000 (06:58 -0600)
committerGitHub <noreply@github.com>
Wed, 22 Mar 2023 12:58:12 +0000 (13:58 +0100)
* [homekit] unify all enum handling

regardless of if it's a required or optional characteristic,
or even "boolean" enums

then allow number or switch items to be linked with enums

then update the docs listing the numeric value for enums

as part of this, global configuration of thermostat enum values
is no longer supported; you must use metadata.
in particular, for GarageDoorOpener, the global settings didn't
even actually work, so they should work now.

Fixes #13595

* [homekit] default-invert boolean items for garage door states

this was previously handled explicitly by the switch statement.
so need to set the inverted flag now that we're building a
mapping instead

* [homekit] document that CurrentDoorState can be linked to a Contact item
* [homekit] improve docs on invert param to createMapping

also fix a new helper method not properly passing through the inverted
param

Signed-off-by: Cody Cutrer <cody@cutrer.us>
23 files changed:
bundles/org.openhab.io.homekit/README.md
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitSettings.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/AbstractHomekitAccessoryImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/AbstractHomekitPositionAccessoryImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitAirQualitySensorImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCarbonDioxideSensorImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCarbonMonoxideSensorImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCharacteristicFactory.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitContactSensorImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitFilterMaintenanceImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitGarageDoorOpenerImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitHeaterCoolerImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitIrrigationSystemImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitLeakSensorImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitLockImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitOccupancySensorImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSecuritySystemImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSlatImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSmartSpeakerImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSmokeSensorImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitThermostatImpl.java
bundles/org.openhab.io.homekit/src/main/resources/OH-INF/config/config.xml
bundles/org.openhab.io.homekit/src/main/resources/OH-INF/i18n/homekit.properties

index 70dee7bff4f73d104276fc96d61475ac502138a6..cf399eb201b45d99a9d6e92a8e65c5b805f4517d 100644 (file)
@@ -85,16 +85,12 @@ This will be used in iOS when pairing without QR Code. The pin code is in the fo
 Requirements beyond this are not clear, and Apple enforces limitations on eligible pins within iOS.
 At the very least, you cannot use repeating (111-11-111) or sequential (123-45-678) pin codes.
 
-Other settings, such as using Fahrenheit temperatures, customizing the thermostat heat/cool/auto modes, and specifying the interface to advertise the HomeKit bridge are also illustrated in the following sample:
+Other settings, such as using Fahrenheit temperatures and specifying the interface to advertise the HomeKit bridge are also illustrated in the following sample:
 
 ```
 org.openhab.homekit:port=9123
 org.openhab.homekit:pin=031-45-154
 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.6
 org.openhab.homekit:useOHmDNS=false
 org.openhab.homekit:blockUserDeletion=false
@@ -115,10 +111,6 @@ Some settings are only visible in UI if the checkbox "Show advanced" is activate
 | blockUserDeletion        | Blocks HomeKit user deletion in openHAB and as result unpairing of devices. If you experience an issue with accessories becoming non-responsive after some time, try to enable this setting. You can also enable this setting if your HomeKit setup is done and you will not re-pair ios devices.                                                                                    | false                |
 | pin                      | Pin code used for pairing with iOS devices. Apparently, pin codes are provided by Apple and represent specific device types, so they cannot be chosen freely. The pin code 031-45-154 is used in sample applications and known to work.                                                                                                                                              | 031-45-154           |
 | useFahrenheitTemperature | Set to true to use Fahrenheit degrees, or false to use Celsius degrees. Note if an item has a QuantityType as its state, this configuration is ignored and it's always converted properly.                                                                                                                                                                                           | false                |
-| thermostatTargetModeCool | Word used for activating the cooling mode of the device (if applicable). It can be overwritten at item level.                                                                                                                                                                                                                                                                        | CoolOn               |
-| thermostatTargetModeHeat | Word used for activating the heating mode of the device (if applicable). It can be overwritten at item level.                                                                                                                                                                                                                                                                        | HeatOn               |
-| thermostatTargetModeAuto | Word used for activating the automatic mode of the device (if applicable). It can be overwritten at item level.                                                                                                                                                                                                                                                                      | Auto                 |
-| thermostatTargetModeOff  | Word used to set the thermostat mode of the device to off (if applicable).  It can be overwritten at item level.                                                                                                                                                                                                                                                                     | Off                  |
 | name                     | Name under which this HomeKit bridge is announced on the network. This is also the name displayed on the iOS device when searching for available bridges.                                                                                                                                                                                                                            | openHAB              |
 | instances                | Defines how many bridges to expose. Necessary if you have more than 149 accessories. Accessories must be assigned to additional instances via metadata. Additional bridges will use incrementing port numbers.                                                                                                                                                                       | 1                    |
 | useDummyAccessories      | When an accessory is missing, substitute a dummy in its place instead of removing it. See [Dummy Accessories](#dummy-accessories).                                                                                                                                                                                                                                                   | false                |
@@ -552,18 +544,19 @@ HomeKit thermostat supports following modes
 - CurrentHeatingCoolingMode: OFF, HEAT, COOL
 - TargetHeatingCoolingMode: OFF, HEAT, COOL, AUTO
 
-These modes are mapped to string values of openHAB items using either global configuration (see [Global Configuration](#Global Configuration)) or configuration at item level.
+These modes are mapped to string values of openHAB items using configuration at the item level.
 e.g. if your current mode item can have following values: "OFF", "HEATING", "COOLING" then you need following mapping at item level
 
 ```xtend
 String          thermostat_current_mode     "Thermostat Current Mode" (gThermostat) {homekit = "CurrentHeatingCoolingMode" [OFF="OFF", HEAT="HEATING", COOL="COOLING"]}
 ```
 
-You can provide mapping for target mode in similar way.
+You can provide mapping for target mode in similar way.
 
-The custom mapping at item level can be also used to reduce number of modes shown in Home app. The modes can be only reduced, but not added, i.e. it is not possible to add new custom mode to HomeKit thermostat.
+The custom mapping can be also used to reduce number of modes shown in Home app.
+The modes can be only reduced, but not added, i.e. it is not possible to add a new custom mode to HomeKit thermostat.
 
-Example: if your thermostat does not support cooling, then you need to limit mapping  to OFF and HEAT values only:
+Example: if your thermostat does not support cooling, then you need to limit mapping to OFF and HEAT values only:
 
 ```xtend
 String          thermostat_current_mode    "Thermostat Current Mode"            (gThermostat) {homekit = "CurrentHeatingCoolingMode" [HEAT="HEATING", OFF="OFF"]}
@@ -686,263 +679,267 @@ or using UI
 
 ![sensor_ui_config.png](doc/sensor_ui_config.png)
  
-## Supported accessory type
-
-| Accessory Tag        | Mandatory Characteristics   | Optional     Characteristics | Supported OH items            | Description                                                                                                                                                                                                                                                                                                                                         |
-|:---------------------|:----------------------------|:-----------------------------|:------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| AirQualitySensor     |                             |                              |                               | Air Quality Sensor which can measure different parameters                                                                                                                                                                                                                                                                                           |
-|                      | AirQuality                  |                              | String                        | Air quality state, possible values (UNKNOWN,EXCELLENT,GOOD,FAIR,INFERIOR,POOR). Custom mapping can be defined at item level, e.g. [EXCELLENT="BEST", POOR="BAD"].                                                                                                                                                                                   |
-|                      |                             | OzoneDensity                 | Number                        | Ozone density in micrograms/m3, max 1000                                                                                                                                                                                                                                                                                                            |
-|                      |                             | NitrogenDioxideDensity       | Number                        | NO2 density in micrograms/m3, max 1000                                                                                                                                                                                                                                                                                                              |
-|                      |                             | SulphurDioxideDensity        | Number                        | SO2 density in micrograms/m3, max 1000                                                                                                                                                                                                                                                                                                              |
-|                      |                             | PM25Density                  | Number                        | PM2.5 micrometer particulate density in micrograms/m3, max 1000                                                                                                                                                                                                                                                                                     |
-|                      |                             | PM10Density                  | Number                        | PM10 micrometer particulate density in micrograms/m3, max 1000                                                                                                                                                                                                                                                                                      |
-|                      |                             | VOCDensity                   | Number                        | VOC Density in micrograms/m3, default max 1000, supported configuration: minValue, maxValue, step.                                                                                                                                                                                                                                                  |
-|                      |                             | Name                         | String                        | Name of the sensor                                                                                                                                                                                                                                                                                                                                  |
-|                      |                             | ActiveStatus                 | Switch, Contact               | Working status                                                                                                                                                                                                                                                                                                                                      |
-|                      |                             | FaultStatus                  | Switch, Contact               | Fault status                                                                                                                                                                                                                                                                                                                                        |
-|                      |                             | TamperedStatus               | Switch, Contact               | Tampered status                                                                                                                                                                                                                                                                                                                                     |
-|                      |                             | BatteryLowStatus             | Switch, Contact, Number       | Battery status                                                                                                                                                                                                                                                                                                                                      |
-| LeakSensor           |                             |                              |                               | Leak Sensor                                                                                                                                                                                                                                                                                                                                         |
-|                      | LeakDetectedState           |                              | Switch, Contact, Dimmer       | Leak sensor state (ON=Leak Detected, OFF=no leak)                                                                                                                                                                                                                                                                                                   |
-|                      |                             | Name                         | String                        | Name of the sensor                                                                                                                                                                                                                                                                                                                                  |
-|                      |                             | ActiveStatus                 | Switch, Contact               | Working status                                                                                                                                                                                                                                                                                                                                      |
-|                      |                             | FaultStatus                  | Switch, Contact               | Fault status                                                                                                                                                                                                                                                                                                                                        |
-|                      |                             | TamperedStatus               | Switch, Contact               | Tampered status                                                                                                                                                                                                                                                                                                                                     |
-|                      |                             | BatteryLowStatus             | Switch, Contact, Number       | Battery status                                                                                                                                                                                                                                                                                                                                      |
-| MotionSensor         |                             |                              |                               | Motion Sensor                                                                                                                                                                                                                                                                                                                                       |
-|                      | MotionDetectedState         |                              | Switch, Contact, Dimmer       | Motion sensor state (ON=motion detected, OFF=no motion)                                                                                                                                                                                                                                                                                             |
-|                      |                             | Name                         | String                        | Name of the sensor                                                                                                                                                                                                                                                                                                                                  |
-|                      |                             | ActiveStatus                 | Switch, Contact               | Working status                                                                                                                                                                                                                                                                                                                                      |
-|                      |                             | FaultStatus                  | Switch, Contact               | Fault status                                                                                                                                                                                                                                                                                                                                        |
-|                      |                             | TamperedStatus               | Switch, Contact               | Tampered status                                                                                                                                                                                                                                                                                                                                     |
-|                      |                             | BatteryLowStatus             | Switch, Contact, Number       | Battery status                                                                                                                                                                                                                                                                                                                                      |
-| OccupancySensor      |                             |                              |                               | Occupancy Sensor                                                                                                                                                                                                                                                                                                                                    |
-|                      | OccupancyDetectedState      |                              | Switch, Contact, Dimmer       | Occupancy sensor state (ON=occupied, OFF=not occupied)                                                                                                                                                                                                                                                                                              |
-|                      |                             | Name                         | String                        | Name of the sensor                                                                                                                                                                                                                                                                                                                                  |
-|                      |                             | ActiveStatus                 | Switch, Contact               | Working status                                                                                                                                                                                                                                                                                                                                      |
-|                      |                             | FaultStatus                  | Switch, Contact               | Fault status                                                                                                                                                                                                                                                                                                                                        |
-|                      |                             | TamperedStatus               | Switch, Contact               | Tampered status                                                                                                                                                                                                                                                                                                                                     |
-|                      |                             | BatteryLowStatus             | Switch, Contact, Number       | Battery status                                                                                                                                                                                                                                                                                                                                      |
-| ContactSensor        |                             |                              |                               | Contact Sensor, An accessory with on/off state that can be viewed in HomeKit but not changed such as a contact sensor for a door or window                                                                                                                                                                                                          |
-|                      | ContactSensorState          |                              | Switch, Contact, Dimmer       | Contact sensor state (ON=open, OFF=closed)                                                                                                                                                                                                                                                                                                          |
-|                      |                             | Name                         | String                        | Name of the sensor                                                                                                                                                                                                                                                                                                                                  |
-|                      |                             | ActiveStatus                 | Switch, Contact               | Working status                                                                                                                                                                                                                                                                                                                                      |
-|                      |                             | FaultStatus                  | Switch, Contact               | Fault status                                                                                                                                                                                                                                                                                                                                        |
-|                      |                             | TamperedStatus               | Switch, Contact               | Tampered status                                                                                                                                                                                                                                                                                                                                     |
-|                      |                             | BatteryLowStatus             | Switch, Contact, Number       | Battery status                                                                                                                                                                                                                                                                                                                                      |
-| SmokeSensor          |                             |                              |                               | Smoke Sensor                                                                                                                                                                                                                                                                                                                                        |
-|                      | SmokeDetectedState          |                              | Switch, Contact, Dimmer       | Smoke sensor state (ON=smoke detected, OFF=no smoke)                                                                                                                                                                                                                                                                                                |
-|                      |                             | Name                         | String                        | Name of the sensor                                                                                                                                                                                                                                                                                                                                  |
-|                      |                             | ActiveStatus                 | Switch, Contact               | Working status                                                                                                                                                                                                                                                                                                                                      |
-|                      |                             | FaultStatus                  | Switch, Contact               | Fault status                                                                                                                                                                                                                                                                                                                                        |
-|                      |                             | TamperedStatus               | Switch, Contact               | Tampered status                                                                                                                                                                                                                                                                                                                                     |
-|                      |                             | BatteryLowStatus             | Switch, Contact, Number       | Battery status                                                                                                                                                                                                                                                                                                                                      |
-| LightSensor          |                             |                              |                               | Light sensor                                                                                                                                                                                                                                                                                                                                        |
-|                      | LightLevel                  |                              | Number                        | Light level in lux. supported configuration: minValue, maxValue.                                                                                                                                                                                                                                                                                    |
-|                      |                             | Name                         | String                        | Name of the sensor                                                                                                                                                                                                                                                                                                                                  |
-|                      |                             | ActiveStatus                 | Switch, Contact               | Working status                                                                                                                                                                                                                                                                                                                                      |
-|                      |                             | FaultStatus                  | Switch, Contact               | Fault status                                                                                                                                                                                                                                                                                                                                        |
-|                      |                             | TamperedStatus               | Switch, Contact               | Tampered status                                                                                                                                                                                                                                                                                                                                     |
-|                      |                             | BatteryLowStatus             | Switch, Contact, Number       | Battery status                                                                                                                                                                                                                                                                                                                                      |
-| HumiditySensor       |                             |                              |                               | Relative Humidity Sensor providing read-only values                                                                                                                                                                                                                                                                                                 |
-|                      | RelativeHumidity            |                              | Number                        | Relative humidity in % between 0 and 100. additional configuration homekitMultiplicator = <number to multiply result with>.                                                                                                                                                                                                                         |
-|                      |                             | Name                         | String                        | Name of the sensor                                                                                                                                                                                                                                                                                                                                  |
-|                      |                             | ActiveStatus                 | Switch, Contact               | Working status                                                                                                                                                                                                                                                                                                                                      |
-|                      |                             | FaultStatus                  | Switch, Contact               | Fault status                                                                                                                                                                                                                                                                                                                                        |
-|                      |                             | TamperedStatus               | Switch, Contact               | Tampered status                                                                                                                                                                                                                                                                                                                                     |
-|                      |                             | BatteryLowStatus             | Switch, Contact, Number       | Battery status                                                                                                                                                                                                                                                                                                                                      |
-| TemperatureSensor    |                             |                              |                               | Temperature sensor                                                                                                                                                                                                                                                                                                                                  |
-|                      | CurrentTemperature          |                              | Number                        | current temperature. supported configuration: minValue, maxValue, step.                                                                                                                                                                                                                                                                             |
-|                      |                             | Name                         | String                        | Name of the sensor                                                                                                                                                                                                                                                                                                                                  |
-|                      |                             | ActiveStatus                 | Switch, Contact               | Working status                                                                                                                                                                                                                                                                                                                                      |
-|                      |                             | FaultStatus                  | Switch, Contact               | Fault status                                                                                                                                                                                                                                                                                                                                        |
-|                      |                             | TamperedStatus               | Switch, Contact               | Tampered status                                                                                                                                                                                                                                                                                                                                     |
-|                      |                             | BatteryLowStatus             | Switch, Contact, Number       | Battery status                                                                                                                                                                                                                                                                                                                                      |
-| CarbonDioxideSensor  |                             |                              |                               | Carbon Dioxide Sensor                                                                                                                                                                                                                                                                                                                               |
-|                      | CarbonDioxideDetectedState  |                              | Switch, Contact, Dimmer       | carbon dioxide sensor state (ON- abnormal level of carbon dioxide detected, OFF - level is normal)                                                                                                                                                                                                                                                  |
-|                      |                             | CarbonDioxideLevel           | Number                        | Carbon dioxide level in ppm, max 100000                                                                                                                                                                                                                                                                                                             |
-|                      |                             | CarbonDioxidePeakLevel       | Number                        | highest detected level (ppm) of carbon dioxide detected by a sensor, max 100000                                                                                                                                                                                                                                                                     |
-|                      |                             | Name                         | String                        | Name of the sensor                                                                                                                                                                                                                                                                                                                                  |
-|                      |                             | ActiveStatus                 | Switch, Contact               | Working status                                                                                                                                                                                                                                                                                                                                      |
-|                      |                             | FaultStatus                  | Switch, Contact               | Fault status                                                                                                                                                                                                                                                                                                                                        |
-|                      |                             | TamperedStatus               | Switch, Contact               | Tampered status                                                                                                                                                                                                                                                                                                                                     |
-|                      |                             | BatteryLowStatus             | Switch, Contact, Number       | Battery status                                                                                                                                                                                                                                                                                                                                      |
-| CarbonMonoxideSensor |                             |                              |                               | Carbon monoxide Sensor                                                                                                                                                                                                                                                                                                                              |
-|                      | CarbonMonoxideDetectedState |                              | Switch, Contact, Dimmer       | Carbon monoxide sensor state (ON- abnormal level of carbon monoxide detected, OFF - level is normal)                                                                                                                                                                                                                                                |
-|                      |                             | CarbonMonoxideLevel          | Number                        | Carbon monoxide level in ppm, max 100                                                                                                                                                                                                                                                                                                               |
-|                      |                             | CarbonMonoxidePeakLevel      | Number                        | highest detected level (ppm) of carbon monoxide detected by a sensor, max 100                                                                                                                                                                                                                                                                       |
-|                      |                             | Name                         | String                        | Name of the sensor                                                                                                                                                                                                                                                                                                                                  |
-|                      |                             | ActiveStatus                 | Switch, Contact               | Working status                                                                                                                                                                                                                                                                                                                                      |
-|                      |                             | FaultStatus                  | Switch, Contact               | Fault status                                                                                                                                                                                                                                                                                                                                        |
-|                      |                             | TamperedStatus               | Switch, Contact               | Tampered status                                                                                                                                                                                                                                                                                                                                     |
-|                      |                             | BatteryLowStatus             | Switch, Contact, Number       | Battery status                                                                                                                                                                                                                                                                                                                                      |
-| Door                 |                             |                              |                               | Motorized door. One Rollershutter item covers all mandatory characteristics. see examples below.                                                                                                                                                                                                                                                    |
-|                      | CurrentPosition             |                              | Rollershutter, Dimmer, Number | Current position of motorized door                                                                                                                                                                                                                                                                                                                  |
-|                      | TargetPosition              |                              | Rollershutter, Dimmer, Number | Target position of motorized door                                                                                                                                                                                                                                                                                                                   |
-|                      | PositionState               |                              | Rollershutter, String         | Position state. Supported states: DECREASING, INCREASING, STOPPED. Mapping can be redefined at item level, e.g. [DECREASING="Down", INCREASING="Up"]. If no state provided, "STOPPED" is used.                                                                                                                                                      |
-|                      |                             | Name                         | String                        | Name of the motorized door                                                                                                                                                                                                                                                                                                                          |
-|                      |                             | HoldPosition                 | Switch, Rollershutter         | Motorized door should stop at its current position. ON is sent to Switch items. STOP is sent to Rollershutter items. Only supported by 3rd party Home apps (such as Elgato Eve)                                                                                                                                                                     |
-|                      |                             | ObstructionStatus            | Switch, Contact, Dimmer       | Current status of obstruction sensor. ON-obstruction detected, OFF - no obstruction                                                                                                                                                                                                                                                                 |
-| Window               |                             |                              |                               | Motorized window. One Rollershutter item covers all mandatory characteristics. see examples below.                                                                                                                                                                                                                                                  |
-|                      | CurrentPosition             |                              | Rollershutter, Dimmer, Number | Current position of motorized window                                                                                                                                                                                                                                                                                                                |
-|                      | TargetPosition              |                              | Rollershutter, Dimmer, Number | Target position of motorized window                                                                                                                                                                                                                                                                                                                 |
-|                      | PositionState               |                              | Rollershutter, String         | Position state. Supported states: DECREASING, INCREASING, STOPPED. Mapping can be redefined at item level, e.g. [DECREASING="Down", INCREASING="Up"]. If no state provided, "STOPPED" is used.                                                                                                                                                      |
-|                      |                             | Name                         | String                        | Name of the motorized window                                                                                                                                                                                                                                                                                                                        |
-|                      |                             | HoldPosition                 | Switch, Rollershutter         | Motorized door should stop at its current position. ON is sent to Switch items. STOP is sent to Rollershutter items. Only supported by 3rd party Home apps (such as Elgato Eve)                                                                                                                                                                     |
-|                      |                             | ObstructionStatus            | Switch, Contact, Dimmer       | Current status of obstruction sensor. ON-obstruction detected, OFF - no obstruction                                                                                                                                                                                                                                                                 |
-| WindowCovering       |                             |                              |                               | Window covering / blinds. One Rollershutter item covers all mandatory characteristics. see examples below.                                                                                                                                                                                                                                          |
-|                      | CurrentPosition             |                              | Rollershutter, Dimmer, Number | Current position of window covering                                                                                                                                                                                                                                                                                                                 |
-|                      | TargetPosition              |                              | Rollershutter, Dimmer, Number | Target position of window covering                                                                                                                                                                                                                                                                                                                  |
-|                      | PositionState               |                              | Rollershutter, String         | Currently only "STOPPED" is supported.                                                                                                                                                                                                                                                                                                              |
-|                      |                             | Name                         | String                        | Name of the windows covering                                                                                                                                                                                                                                                                                                                        |
-|                      |                             | HoldPosition                 | Switch, Rollershutter         | Motorized door should stop at its current position. ON is sent to Switch items. STOP is sent to Rollershutter items. Only supported by 3rd party Home apps (such as Elgato Eve)                                                                                                                                                                     |
-|                      |                             | ObstructionStatus            | Switch, Contact, Dimmer       | Current status of obstruction sensor. ON-obstruction detected, OFF - no obstruction                                                                                                                                                                                                                                                                 |
-|                      |                             | CurrentHorizontalTiltAngle   | Number, Dimmer                | Number Item = current angle of horizontal slats. values -90 to 90. A value of 0 indicates that the slats are rotated to a fully open position. A value of -90 indicates that the slats are rotated all the way in a direction where the user-facing edge is higher than the window-facing edge. Dimmer Item =  the percentage of openness (0%-100%) |
-|                      |                             | TargetHorizontalTiltAngle    | Number, Dimmer                | Number Item = target angle of horizontal slats (-90 to +90). Dimmer Item =  the percentage of openness (0%-100%)                                                                                                                                                                                                                                    |
-|                      |                             | CurrentVerticalTiltAngle     | Number, Dimmer                | Number Item = current angle of vertical slats (-90 to +90) . Dimmer Item =  the percentage of openness (0%-100%)                                                                                                                                                                                                                                    |
-|                      |                             | TargetVerticalTiltAngle      | Number, Dimmer                | Number Item = target angle of vertical slats. Dimmer Item =  the percentage of openness (0%-100%)                                                                                                                                                                                                                                                   |
-| Slat                 |                             |                              |                               | Slat which tilts on a vertical or a horizontal axis. Configuration "type:horizontal" or "type:vertical"                                                                                                                                                                                                                                             |
-|                      | CurrentSlatState            |                              | String                        | Current slat state. possible values (FIXED,SWINGING,JAMMED). Custom mapping can be defined at item level, e.g. [JAMMED="JAM", FIXED="FIX"]                                                                                                                                                                                                           |
-|                      |                             | Name                         | String                        | Name of the slat                                                                                                                                                                                                                                                                                                                                    |
-|                      |                             | SwingMode                    | Number, Switch                | Swing mode.  values: 0/OFF=SWING DISABLED, 1/ON=SWING ENABLED                                                                                                                                                                                                                                                                                       |
-|                      |                             | CurrentTiltAngle             | Number, Dimmer                | Number Item = current angle of slats. values -90 to 90. A value of 0 indicates that the slats are rotated to a fully open position. Dimmer Item =  the percentage of openness (0%-100%)                                                                                                                                                             |
-|                      |                             | TargetTiltAngle              | Number, Dimmer                | Number Item = target angle of slats (-90 to +90). Dimmer Item =  the percentage of openness (0%-100%)                                                                                                                                                                                                                                               |
-| Switchable           |                             |                              |                               | An accessory that can be turned off and on. While similar to a lightbulb, this will be presented differently in the Siri grammar and iOS apps                                                                                                                                                                                                       |
-|                      | OnState                     |                              | Switch, Dimmer                | State of the switch - ON/OFF                                                                                                                                                                                                                                                                                                                        |
-|                      |                             | Name                         | String                        | Name of the switch                                                                                                                                                                                                                                                                                                                                  |
-| Outlet               |                             |                              |                               | An accessory that can be turned off and on. While similar to a lightbulb, this will be presented differently in the Siri grammar and iOS apps                                                                                                                                                                                                       |
-|                      | OnState                     |                              | Switch, Dimmer                | State of the outlet - ON/OFF                                                                                                                                                                                                                                                                                                                        |
-|                      | InUseStatus                 |                              | Switch, Contact, Dimmer       | Indicates whether the outlet has an appliance e.g., a floor lamp, physically plugged in. This characteristic is set to True even if the plugged-in appliance is off.                                                                                                                                                                                |
-|                      |                             | Name                         | String                        | Name of the switch                                                                                                                                                                                                                                                                                                                                  |
-| Lighting             |                             |                              |                               | A lightbulb, can have further optional parameters for brightness, hue, etc                                                                                                                                                                                                                                                                          |
-|                      | OnState                     |                              | Switch                        | State of the light - ON/OFF                                                                                                                                                                                                                                                                                                                         |
-|                      |                             | Name                         | String                        | Name of the light                                                                                                                                                                                                                                                                                                                                   |
-|                      |                             | Hue                          | Dimmer, Color                 | Hue                                                                                                                                                                                                                                                                                                                                                 |
-|                      |                             | Saturation                   | Dimmer, Color                 | Saturation in % (1-100)                                                                                                                                                                                                                                                                                                                             |
-|                      |                             | Brightness                   | Dimmer, Color                 | Brightness in % (1-100). See "Usage of dimmer modes" for configuration details.                                                                                                                                                                                                                                                                     |
-|                      |                             | ColorTemperature             | Number, Dimmer                | Color temperature. If the item is a Number with no units, it is represented in mireds. The default value range is from 50 to 400 (2500 K to 20,000 K). If the item is a Dimmer, it will be transformed linearly to mireds. Color temperature should not be used in combination with hue, saturation and brightness. It supports following configuration parameters: minValue, maxValue, inverted |
-| Fan                  |                             |                              |                               | Fan                                                                                                                                                                                                                                                                                                                                                 |
-|                      | ActiveStatus                |                              | Switch, Dimmer                | Accessory current working status. A value of "ON"/"OPEN" indicates that the accessory is active and is functioning without any errors.                                                                                                                                                                                                              |
-|                      |                             | CurrentFanState              | Number                        | Current fan state.  values: 0=INACTIVE, 1=IDLE, 2=BLOWING AIR                                                                                                                                                                                                                                                                                       |
-|                      |                             | TargetFanState               | Number, Switch                | Target fan state.  values: 0/OFF=MANUAL, 1/ON=AUTO. Flag [inverted=true] swaps the default mapping                                                                                                                                                                                                                                                  |
-|                      |                             | RotationDirection            | Number, Switch                | Rotation direction.  values: 0/OFF=CLOCKWISE, 1/ON=COUNTER CLOCKWISE. Flag [inverted=true] swaps the default mapping                                                                                                                                                                                                                                |
-|                      |                             | RotationSpeed                | Number, Dimmer                | Fan rotation speed in % (1-100)                                                                                                                                                                                                                                                                                                                     |
-|                      |                             | SwingMode                    | Number, Switch                | Swing mode.  values: 0/OFF=SWING DISABLED, 1/ON=SWING ENABLED. Flag [inverted=true] swaps the default mapping                                                                                                                                                                                                                                       |
-|                      |                             | LockControl                  | Number, Switch                | Status of physical control lock.  values: 0/OFF=CONTROL LOCK DISABLED, 1/ON=CONTROL LOCK ENABLED.Flag [inverted=true] swaps the default mapping                                                                                                                                                                                                     |
-| BasicFan             |                             |                              |                               | Fan. A BasicFan is a subset of Fan, but the Home app allows you to customize the icon of the accessory to show a ceiling fan.                                                                                                                                                                                                                       |
-|                      | OnState                     |                              | Switch, Dimmer                | Accessory current working status. A value of "ON"/"OPEN" indicates that the accessory is active and is functioning without any errors.                                                                                                                                                                                                              |
-|                      |                             | RotationDirection            | Number, Switch                | Rotation direction.  values: 0/OFF=CLOCKWISE, 1/ON=COUNTER CLOCKWISE. Flag [inverted=true] swaps the default mapping                                                                                                                                                                                                                                |
-|                      |                             | RotationSpeed                | Number, Dimmer                | Fan rotation speed in % (1-100)                                                                                                                                                                                                                                                                                                                     |
-| Thermostat           |                             |                              |                               | A thermostat requires all mandatory characteristics defined below                                                                                                                                                                                                                                                                                   |
-|                      | CurrentTemperature          |                              | Number                        | Current temperature. supported configuration: minValue, maxValue, step                                                                                                                                                                                                                                                                              |
-|                      | TargetTemperature           |                              | Number                        | Target temperature. supported configuration: minValue, maxValue, step                                                                                                                                                                                                                                                                               |
-|                      | CurrentHeatingCoolingMode   |                              | String                        | Current heating cooling mode (OFF, HEAT, COOL). for mapping see homekit settings above.                                                                                                                                                                                                                                                             |
-|                      | TargetHeatingCoolingMode    |                              | String                        | Target heating cooling mode (OFF, AUTO, HEAT, COOL). for mapping see homekit settings above.                                                                                                                                                                                                                                                        |
-|                      |                             | Name                         | String                        | Name of the thermostat                                                                                                                                                                                                                                                                                                                              |
-|                      |                             | CoolingThresholdTemperature  | Number                        | Maximum temperature that must be reached before cooling is turned on. min/max/step can configured at item level, e.g. minValue=10.5, maxValue=50, step=2]                                                                                                                                                                                           |
-|                      |                             | HeatingThresholdTemperature  | Number                        | Minimum temperature that must be reached before heating is turned on. min/max/step can configured at item level, e.g. minValue=10.5, maxValue=50, step=2]                                                                                                                                                                                           |
-|                      |                             | RelativeHumidity             | Number                        | Relative humidity in % between 0 and 100.                                                                                                                                                                                                                                                                                                           |
-| HeaterCooler         |                             |                              |                               | Heater or/and cooler device                                                                                                                                                                                                                                                                                                                         |
-|                      | ActiveStatus                |                              | Switch, Dimmer                | Accessory current working status. A value of "ON"/"OPEN" indicates that the accessory is active and is functioning without any errors.                                                                                                                                                                                                              |
-|                      | CurrentTemperature          |                              | Number                        | Current temperature. supported configuration: minValue, maxValue, step                                                                                                                                                                                                                                                                              |
-|                      | CurrentHeaterCoolerState    |                              | String                        | Current heater/cooler mode (INACTIVE, IDLE, HEATING, COOLING). Mapping can be redefined at item level, e.g. [HEATING="HEAT", COOLING="COOL"].                                                                                                                                                                                                       |
-|                      | TargetHeaterCoolerState     |                              | String                        | Target heater/cooler mode (AUTO, HEAT, COOL). Mapping can be redefined at item level, e.g. [AUTO="AUTOMATIC"].                                                                                                                                                                                                                                      |
-|                      |                             | Name                         | String                        | Name of the heater/cooler                                                                                                                                                                                                                                                                                                                           |
-|                      |                             | RotationSpeed                | Number                        | Fan rotation speed in % (1-100)                                                                                                                                                                                                                                                                                                                     |
-|                      |                             | SwingMode                    | Number, Switch                | Swing mode.  values: 0/OFF=SWING DISABLED, 1/ON=SWING ENABLED                                                                                                                                                                                                                                                                                       |
-|                      |                             | LockControl                  | Number, Switch                | Status of physical control lock.  values: 0/OFF=CONTROL LOCK DISABLED, 1/ON=CONTROL LOCK ENABLED                                                                                                                                                                                                                                                    |
-|                      |                             | CoolingThresholdTemperature  | Number                        | Maximum temperature that must be reached before cooling is turned on. min/max/step can configured at item level, e.g. minValue=10.5, maxValue=50, step=2]                                                                                                                                                                                           |
-|                      |                             | HeatingThresholdTemperature  | Number                        | Minimum temperature that must be reached before heating is turned on. min/max/step can configured at item level, e.g. minValue=10.5, maxValue=50, step=2]                                                                                                                                                                                           |
-| Lock                 |                             |                              |                               | A Lock Mechanism. with flag [inverted=true] the default mapping to switch ON/OFF can be inverted.                                                                                                                                                                                                                                                   |
-|                      | LockCurrentState            |                              | Switch, Number                | Current state of lock mechanism (1/ON=SECURED, 0/OFF=UNSECURED, 2=JAMMED, 3=UNKNOWN)                                                                                                                                                                                                                                                                |
-|                      | LockTargetState             |                              | Switch                        | Target state of lock mechanism (ON=SECURED, OFF=UNSECURED)                                                                                                                                                                                                                                                                                          |
-|                      |                             | Name                         | String                        | Name of the lock                                                                                                                                                                                                                                                                                                                                    |
-| Valve                |                             |                              |                               | Valve. additional configuration: ValveType = ["Generic", "Irrigation", "Shower", "Faucet"]                                                                                                                                                                                                                                                   |
-|                      | ActiveStatus                |                              | Switch, Dimmer                | Accessory current working status. A value of "ON"/"OPEN" indicates that the accessory is active and is functioning without any errors.                                                                                                                                                                                                              |
-|                      | InUseStatus                 |                              | Switch, Dimmer                | Indicates whether fluid flowing through the valve. A value of "ON"/"OPEN" indicates that fluid is flowing.                                                                                                                                                                                                                                          |
-|                      |                             | Duration                     | Number                        | Defines how long a valve should be set to Ê¼In Useʼ in second. You can define the default duration via configuration homekitDefaultDuration = <default duration in seconds>                                                                                                                                                                          |
-|                      |                             | RemainingDuration            | Number                        | Describes the remaining duration on the accessory. the remaining duration increases/decreases from the accessoryʼs usual countdown. i.e. changes from 90 to 80 in a second.                                                                                                                                                                         |
-|                      |                             | Name                         | String                        | Name of the valve                                                                                                                                                                                                                                                                                                                                   |
-|                      |                             | FaultStatus                  | Switch, Contact               | Accessory fault status.  "ON"/"OPEN" value indicates that the accessory has experienced a fault that may be interfering with its intended functionality. A value of "OFF"/"CLOSED" indicates that there is no fault.                                                                                                                                |
-| Faucet               |                             |                              |                               | Faucet or shower. It should be used in combination with Valve or/and HeaterCooler.                                                                                                                                                                                                                                                                  |
-|                      | Active                      |                              | Switch, Contact, Dimmer       | Accessory current working status. A value of "ON"/"OPEN" indicates faucet/shower is open.                                                                                                                                                                                                                                                           |
-|                      |                             | Name                         | String                        | Name of the Faucet                                                                                                                                                                                                                                                                                                                                  |
-|                      |                             | FaultStatus                  | Switch, Contact               | Accessory fault status.  "ON"/"OPEN" value indicates that the accessory has experienced a fault that may be interfering with its intended functionality. A value of "OFF"/"CLOSED" indicates that there is no fault.                                                                                                                                |
-| SecuritySystem       |                             |                              |                               | Security system.                                                                                                                                                                                                                                                                                                                                    |
-|                      | CurrentSecuritySystemState  |                              | String                        | Current state of the security system. STAY_ARM / AWAY_ARM / NIGHT_ARM / DISARMED / TRIGGERED. Mapping can be redefined at item level, e.g. [AWAY_ARM="AWAY", NIGHT_ARM="NIGHT" ]                                                                                                                                                                    |
-|                      | TargetSecuritySystemState   |                              | String                        | Requested state of the security system. STAY_ARM / AWAY_ARM / NIGHT_ARM / DISARM. While the requested state is not DISARM, and the current state is DISARMED, HomeKit will display "Arming...", for example during an exit delay. Mapping can be redefined at item level, e.g. [AWAY_ARM="AWAY", NIGHT_ARM="NIGHT" ]                                |
-|                      |                             | Name                         | String                        | Name of the security system                                                                                                                                                                                                                                                                                                                         |
-|                      |                             | FaultStatus                  | Switch, Contact               | accessory fault status.  "ON"/"OPEN" value indicates that the accessory has experienced a fault that may be interfering with its intended functionality. A value of "OFF"/"CLOSED" indicates that there is no fault.                                                                                                                                |
-|                      |                             | TamperedStatus               | Switch, Contact               | accessory tampered status. A status of "ON"/"OPEN" indicates that the accessory has been tampered with. Value should return to "OFF"/"CLOSED" when the accessory has been reset to a non-tampered state.                                                                                                                                            |
-| GarageDoorOpener     |                             |                              |                               | A garage door opener.                                                                                                                                                                                                                                                                                                                               |
-|                      | ObstructionStatus           |                              | Switch                        | Current status of obstruction sensor. ON-obstruction detected, OFF - no obstruction                                                                                                                                                                                                                                                                 |
-|                      | CurrentDoorState            |                              | String                        | Current door state. Possible values: OPEN, OPENING, CLOSED, CLOSING, STOPPED                                                                                                                                                                                                                                                                        |
-|                      | TargetDoorState             |                              | Switch, String                | Target door state. ON/"OPEN" = open door, OFF/"CLOSED" = closed door                                                                                                                                                                                                                                                                                |
-|                      |                             | Name                         | String                        | Name of the garage door                                                                                                                                                                                                                                                                                                                             |
-|                      |                             | LockCurrentState             | Switch                        | current states of lock mechanism (OFF=SECURED, ON=UNSECURED)                                                                                                                                                                                                                                                                                        |
-|                      |                             | LockTargetState              | Switch                        | target states of lock mechanism (OFF=SECURED, ON=UNSECURED)                                                                                                                                                                                                                                                                                         |
-| Battery              |                             |                              |                               | Accessory with battery. Battery can be chargeable (configuration chargeable:true) and non-chargeable  (configuration chargeable:false)                                                                                                                                                                                                              |
-|                      | BatteryLevel                |                              | Number                        | Battery level 0% to 100%                                                                                                                                                                                                                                                                                                                            |
-|                      | BatteryLowStatus            |                              | Switch, Contact, Number       | Battery low indicator. ON/OPEN = battery level is low; for number if the value is below the lowThreshold, then it is low. Default is 20.                                                                                                                                                                                                                                                                                              |
-|                      | BatteryChargingState        |                              | Switch, Contact, Dimmer       | Mandatory only for chargeable battery. ON/OPEN =  battery is charging                                                                                                                                                                                                                                                                               |
-|                      |                             | Name                         | String                        | Name of the battery accessory                                                                                                                                                                                                                                                                                                                       |
-| Filter               |                             |                              |                               | Accessory with filter maintenance indicator                                                                                                                                                                                                                                                                                                         |
-|                      | FilterChangeIndication      |                              | Switch, Contact, Dimmer       | Filter change indicator. ON/OPEN = filter change is required.                                                                                                                                                                                                                                                                                       |
-|                      |                             |  FilterLifeLevel             | Number                        | Current filter life level. 0% to 100%                                                                                                                                                                                                                                                                                                               |
-|                      |                             |  FilterResetIndication       | Switch                        | Send "filter reset" action triggered by user in iOS Home app to openHAB ("ON" = reset requested by user).                                                                                                                                                                                                                                           |
-|                      |                             | Name                         | String                        | Name of the filter accessory                                                                                                                                                                                                                                                                                                                        |
-| Microphone           |                             |                              |                               | Microphone accessory                                                                                                                                                                                                                                                                                                                                |
-|                      | Mute                        |                              | Switch, Contact, Dimmer       | Mute indication. ON/OPEN = microphone is muted                                                                                                                                                                                                                                                                                                      |
-|                      |                             | Name                         | String                        | Name of the microphone accessory                                                                                                                                                                                                                                                                                                                    |
-|                      |                             | Volume                       | Number                        | Microphone volume from 0% to 100%                                                                                                                                                                                                                                                                                                                   |
-| Speaker              |                             |                              |                               | Speaker accessory                                                                                                                                                                                                                                                                                                                                   |
-|                      | Mute                        |                              | Switch, Contact, Dimmer       | Mute indication. ON/OPEN = speaker is muted                                                                                                                                                                                                                                                                                                         |
-|                      |                             | Name                         | String                        | Name of the speaker accessory                                                                                                                                                                                                                                                                                                                       |
-|                      |                             | Volume                       | Number                        | Speaker volume from 0% to 100%                                                                                                                                                                                                                                                                                                                      |
-|                      |                             | Active                       | Switch, Contact               | Working status                                                                                                                                                                                                                                                                                                                                      |
-| SmartSpeaker         |                             |                              |                               | Smart speaker accessory with Play/Stop/Pause control                                                                                                                                                                                                                                                                                                |
-|                      | CurrentMediaState           |                              | String                        | Current smart speaker state. possible values (STOP,PLAY,PAUSE,UNKNOWN). Custom mapping can be defined at item level, e.g. [STOP="STOPPED", PLAY="PLAYING"]                                                                                                                                                                                          |
-|                      | TargetMediaState            |                              | String                        | Target smart speaker state. possible values (STOP,PLAY,PAUSE). Custom mapping can be defined at item level, e.g. [STOP="STOPPED", PLAY="PLAYING"]                                                                                                                                                                                                   |
-|                      |                             | Mute                         | Switch, Contact               | Mute indication. ON/OPEN = speaker is muted                                                                                                                                                                                                                                                                                                         |
-|                      |                             | Name                         | String                        | Name of the speaker accessory                                                                                                                                                                                                                                                                                                                       |
-|                      |                             | ConfiguredName               | String                        | Name of the speaker accessory configured in iOS Home app. User can rename the speaker in iOS Home app and this characteristic can be used to reflect change in openHAB and sync name changes from openHAB to Home app.                                                                                                                                  |
-|                      |                             | Volume                       | Number                        | Speaker volume from 0% to 100%                                                                                                                                                                                                                                                                                                                      |
-| Television           |                             |                              |                               | Television accessory with inputs                                                                                                                                                                                                                                                                                                                    |
-|                      | Active                      |                              | Switch, Contact, Dimmer       | State of the television - On/Off |
-|                      |                             | ActiveIdentifier             | Number                        | The input that is currently active (based on its identifier). Can also be configured via metadata, e.g. [ActiveIdentifier=1] |
-|                      |                             | Name                         | String                        | Name of the television accessory                                                                                                                                                                                                                                                                                                                       |
-|                      |                             | ConfiguredName               | String                        | Name of the television accessory configured in the iOS Home app. User can rename the television in iOS Home app and this characteristic can be used to reflect change in openHAB and sync name changes from openHAB to Home app. |
-|                      |                             | RemoteKey                    | String                        | Receives a keypress event. |
-|                      |                             | SleepDiscoveryMode           | Switch, Contact, Dimmer       | Indicates if the television is discoverable while in standby mode. ON = always discoverable, OFF = not discoverable. Default is ON. Can also be configured via metadata, e.g. [SleepDiscoveryMode=true] |
-|                      |                             | Brightness                   | Dimmer                        | Screen brightness in % (1-100). |
-|                      |                             | PowerMode                    | Switch                        | This oddly named characteristic will receive an ON command when the user requests to open the TV's menu. |
-|                      |                             | ClosedCaptions               | Switch, Contact, Dimmer       | Indicates closed captions are enabled. Can also be configured via metadata, e.g. [ClosedCaptions=true] |
-|                      |                             | CurrentMediaState            | String                        | Current television state. possible values (STOP,PLAY,PAUSE,UNKNOWN). Custom mapping can be defined at item level, e.g. [STOP="STOPPED", PLAY="PLAYING"]                                                                                                                                                                                          |
-|                      |                             | TargetMediaState             | String                        | Target television state. possible values (STOP,PLAY,PAUSE). Custom mapping can be defined at item level, e.g. [STOP="STOPPED", PLAY="PLAYING"]                                                                                                                                                                                                   |
-|                      |                             | PictureMode                  | String                        | Selected picture mode. possible values (OTHER,STANDARD,CALIBRATED,CALIBRATED_DARK,VIVID,GAME,COMPUTER,CUSTOM). Custom mapping can be defined at the item level, e.g. [OTHER="unknown"] |
-| InputSource          |                             |                              |                               | Input source linked service. Can only be used with Television.
-|                      |                             | Name                         | String                        | Default name of the input source                                                                                                                                                                                                                                                                                                                       |
-|                      |                             | ConfiguredName               | String                        | Name of the input source configured in the iOS Home app. User can rename the source in iOS Home app and this characteristic can be used to reflect change in openHAB and sync name changes from openHAB to Home app. |
-|                      |                             | Configured                   | Switch, Contact, Dimmer       | If the source is configured on the device. Non-configured inputs will not show up in the Home app. - ON/OPEN = show, OFF/CLOSED = hide. Default is ON. Can also be configured via metadata, e.g. [Configured=true] |
-|                      |                             | InputSourceType              | String                        | Type of the input source. possible values (OTHER, HOME_SCREEN, TUNER, HDMI, COMPOSITE_VIDEO, S_VIDEO, COMPONENT_VIDEO, DVI, AIRPLAY, USB, APPLICATION). Custom mapping can be defined at item level. Can also be configured via metadata, e.g. [InputSourceType="OTHER"]. |
-|                      |                             | CurrentVisibility            | Switch, Contact, Dimmer       | If the source has been hidden by the user - ON/OPEN = visible, OFF/CLOSED = hidden. Default is ON. Can also be configured via metadata, e.g. [CurrentVisibility=false] |
-|                      |                             | Identifier                   | Number                        | The identifier of the source, to be used with the ActiveIdentifier characteristic. Can also be configured via metadata, e.g. [Identifier=1] |
-|                      |                             | InputDeviceType              | String                        | Type of the input device. possible values (OTHER, TV, RECORDING, TUNER, PLAYBACK, AUDIO_SYSTEM). Custom mapping can be defined at item level. Can also be configured via metadata, e.g. [InputDeviceType="OTHER"]. |
-|                      |                             | TargetVisibilityState        | Switch                        | The desired visibility state of the input source. ON = shown, OFF = hidden. |
-| TelevisionSpeaker    |                             |                              |                               | An accessory that can be added to a Television in order to control the speaker associated with it. |
-|                      | Mute                        |                              | Switch                        | If the television is muted. ON = muted, OFF = not muted. |
-|                      |                             | Active                       | Switch                        | Unknown. This characteristic is undocumented by Apple, but is still available. |
-|                      |                             | Volume                       | Dimmer, Number                | Current volume. min/max/step can configured at item level, e.g. minValue=10.5, maxValue=50, step=2] |
-|                      |                             | VolumeSelector               | Dimmer, String                | If linked do a dimmer item, will send INCREASE/DECREASE commands. If linked to a string item, will send INCREMENT and DECREMENT. |
-|                      |                             | VolumeControlType            | String                        | The type of control available. This will default to infer based on what other items are linked. NONE = status only, no control; RELATIVE = INCREMENT/DECREMENT only, no status; RELATIVE_WITH_CURRENT = INCREMENT/DECREMENT only with status; ABSOLUTE = direct status and control. Can also be configured via metadata, e.g. [VolumeControlType="ABSOLUTE"]. |
-| IrrigationSystem     |                             |                              |                               | An accessory that represents multiple water valves and accommodates a programmed scheduled. |
-|                      | Active                      |                              | Switch                        | If the irrigation system as a whole is enabled. This must be ON if any of the valves are also enabled. |
-|                      | InUseStatus                 |                              | Switch                        | If the irrigation system as a whole is running. This must be ON if any of the valves are ON. |
-|                      | ProgramMode                 |                              | String                        | The current program mode of the irrigation system. Possible values (NO_SCHEDULED - no programs scheduled, SCHEDULED - program scheduled, SCHEDULED_MANUAL - program scheduled, currently overriden to manual mode). |
-|                      |                             | RemainingDuration            | Number                        | The remaining duration for all scheduled valves in the current program in seconds. |
-|                      |                             | FaultStatus                  | Switch, Contact               | Accessory fault status.  "ON"/"OPEN" value indicates that the accessory has experienced a fault that may be interfering with its intended functionality. A value of "OFF"/"CLOSED" indicates that there is no fault.                                                                                                                                |
-
+## Supported accessory types
+
+For configuration options, the default values are in parentheses.
+For enum values, the parentheses indicate the default values if the item is a Number or a Switch.
+All enum values can be customized via item metadata. I.e. `HEAT="heating", COOL="cooling"`, or `HEAT=5, COOL=7` for a Number.
+<a id="customizeable-enum">Some enums can have the list of valid values customized, meaning that if you customize the mapping, any value that is missing will not be presented to the user.</a>
+They are appropriately marked.
+Enums that are linked to Switches or Contacts have an `inverted` param that will reverse the sense of `ON`/`OFF` or `OPEN`/`CLOSED`.
+
+| Accessory Tag        | Mandatory Characteristics   | Optional Characteristics    | Supported openHAB item types            | Description                                                                                                                                                                                                                                                                                                                                                   | Configuration Options                                                 | Valid Enum Values                                                                                           |
+|----------------------|-----------------------------|-----------------------------|-----------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
+| AirQualitySensor     |                             |                             |                                         | Air Quality Sensor which can measure different parameters                                                                                                                                                                                                                                                                                                     |                                                                       |                                                                                                             |
+|                      | AirQuality                  |                             | Number, String, Switch                  | Air quality state                                                                                                                                                                                                                                                                                                                                             |                                                                       | UNKNOWN (0, OFF), EXCELLENT (1, ON), GOOD (2), FAIR (3), INFERIOR (4), POOR (5)                             |
+|                      |                             | ActiveStatus                | Contact, Switch                         | Working status                                                                                                                                                                                                                                                                                                                                                |                                                                       |                                                                                                             |
+|                      |                             | BatteryLowStatus            | Contact, Number, Switch                 | Battery status                                                                                                                                                                                                                                                                                                                                                | inverted (false), lowThreshold (20)                                   |                                                                                                             |
+|                      |                             | FaultStatus                 | Contact, Number, String, Switch         | Fault status                                                                                                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NO_FAULT (0, OFF, CLOSED), GENERAL_FAULT (1, ON, OPEN)                                                      |
+|                      |                             | Name                        | String                                  | Name of the sensor                                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      |                             | NitrogenDioxideDensity      | Number                                  | NO2 density in micrograms/m3, max 1000                                                                                                                                                                                                                                                                                                                        |                                                                       |                                                                                                             |
+|                      |                             | OzoneDensity                | Number                                  | Ozone density in micrograms/m3, max 1000                                                                                                                                                                                                                                                                                                                      |                                                                       |                                                                                                             |
+|                      |                             | PM10Density                 | Number                                  | PM10 micrometer particulate density in micrograms/m3, max 1000                                                                                                                                                                                                                                                                                                |                                                                       |                                                                                                             |
+|                      |                             | PM25Density                 | Number                                  | PM2.5 micrometer particulate density in micrograms/m3, max 1000                                                                                                                                                                                                                                                                                               |                                                                       |                                                                                                             |
+|                      |                             | SulphurDioxideDensity       | Number                                  | SO2 density in micrograms/m3, max 1000                                                                                                                                                                                                                                                                                                                        |                                                                       |                                                                                                             |
+|                      |                             | TamperedStatus              | Contact, Number, String, Switch         | Tampered status                                                                                                                                                                                                                                                                                                                                               | inverted (false)                                                      | NOT_TAMPERED (0, OFF, CLOSED), TAMPERED (1, ON, OPEN)                                                       |
+|                      |                             | VOCDensity                  | Number                                  | VOC Density in micrograms/m3, default max 1000                                                                                                                                                                                                                                                                                                                | minValue (0), maxValue (100), step (1)                                |                                                                                                             |
+| BasicFan             |                             |                             |                                         | Fan. A BasicFan is a subset of Fan, but the Home app allows you to customize the icon of the accessory to show a ceiling fan.                                                                                                                                                                                                                                 |                                                                       |                                                                                                             |
+|                      | OnState                     |                             | Dimmer, Switch                          | Accessory current working status. A value of "ON"/"OPEN" indicates that the accessory is active and is functioning without any errors.                                                                                                                                                                                                                        | inverted (false)                                                      |                                                                                                             |
+|                      |                             | RotationDirection           | Number, Switch                          | Rotation direction.                                                                                                                                                                                                                                                                                                                                           | inverted (false)                                                      | CLOCKWISE (0, OFF), COUNTER_CLOCKWISE (1, ON)                                                               |
+|                      |                             | RotationSpeed               | Dimmer, Number                          | Fan rotation speed in % (1-100)                                                                                                                                                                                                                                                                                                                               |                                                                       |                                                                                                             |
+| Battery              |                             |                             |                                         | Accessory with battery. Battery can be chargeable (configuration chargeable:true) and non-chargeable  (configuration chargeable:false)                                                                                                                                                                                                                        |                                                                       |                                                                                                             |
+|                      | BatteryLevel                |                             | Number                                  | Battery level 0% to 100%                                                                                                                                                                                                                                                                                                                                      |                                                                       |                                                                                                             |
+|                      | BatteryChargingState        |                             | Contact, Dimmer, Switch                 | Mandatory only for chargeable battery. ON/OPEN =  battery is charging                                                                                                                                                                                                                                                                                         |                                                                       |                                                                                                             |
+|                      | BatteryLowStatus            |                             | Contact, Number, Switch                 | Battery low indicator. ON/OPEN = battery level is low; for number if the value is below the lowThreshold, then it is low. Default is 20.                                                                                                                                                                                                                      | inverted (false), lowThreshold (20)                                   |                                                                                                             |
+|                      |                             | Name                        | String                                  | Name of the battery accessory                                                                                                                                                                                                                                                                                                                                 |                                                                       |                                                                                                             |
+| CarbonDioxideSensor  |                             |                             |                                         | Carbon Dioxide Sensor                                                                                                                                                                                                                                                                                                                                         |                                                                       |                                                                                                             |
+|                      | CarbonDioxideDetectedState  |                             | Contact, Dimmer, Switch, Number, String | carbon dioxide sensor state                                                                                                                                                                                                                                                                                                                                   | inverted (false)                                                      | NORMAL (0, OFF, CLOSED), ABNORMAL (1, ON, OPEN)                                                             |
+|                      |                             | ActiveStatus                | Contact, Switch                         | Working status                                                                                                                                                                                                                                                                                                                                                |                                                                       |                                                                                                             |
+|                      |                             | BatteryLowStatus            | Contact, Number, Switch                 | Battery status                                                                                                                                                                                                                                                                                                                                                | inverted (false), lowThreshold (20)                                   |                                                                                                             |
+|                      |                             | CarbonDioxideLevel          | Number                                  | Carbon dioxide level in ppm, max 100000                                                                                                                                                                                                                                                                                                                       |                                                                       |                                                                                                             |
+|                      |                             | CarbonDioxidePeakLevel      | Number                                  | highest detected level (ppm) of carbon dioxide detected by a sensor, max 100000                                                                                                                                                                                                                                                                               |                                                                       |                                                                                                             |
+|                      |                             | FaultStatus                 | Contact, Number, String, Switch         | Fault status                                                                                                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NO_FAULT (0, OFF, CLOSED), GENERAL_FAULT (1, ON, OPEN)                                                      |
+|                      |                             | Name                        | String                                  | Name of the sensor                                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      |                             | TamperedStatus              | Contact, Number, String, Switch         | Tampered status                                                                                                                                                                                                                                                                                                                                               | inverted (false)                                                      | NOT_TAMPERED (0, OFF, CLOSED), TAMPERED (1, ON, OPEN)                                                       |
+| CarbonMonoxideSensor |                             |                             |                                         | Carbon monoxide Sensor                                                                                                                                                                                                                                                                                                                                        |                                                                       |                                                                                                             |
+|                      | CarbonMonoxideDetectedState |                             | Contact, Dimmer, Switch, Number, String | Carbon monoxide sensor state                                                                                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NORMAL (0, OFF, CLOSED), ABNORMAL (1, ON, OPEN)                                                             |
+|                      |                             | ActiveStatus                | Contact, Switch                         | Working status                                                                                                                                                                                                                                                                                                                                                |                                                                       |                                                                                                             |
+|                      |                             | BatteryLowStatus            | Contact, Number, Switch                 | Battery status                                                                                                                                                                                                                                                                                                                                                | inverted (false), lowThreshold (20)                                   |                                                                                                             |
+|                      |                             | CarbonMonoxideLevel         | Number                                  | Carbon monoxide level in ppm, max 100                                                                                                                                                                                                                                                                                                                         |                                                                       |                                                                                                             |
+|                      |                             | CarbonMonoxidePeakLevel     | Number                                  | highest detected level (ppm) of carbon monoxide detected by a sensor, max 100                                                                                                                                                                                                                                                                                 |                                                                       |                                                                                                             |
+|                      |                             | FaultStatus                 | Contact, Number, String, Switch         | Fault status                                                                                                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NO_FAULT (0, OFF, CLOSED), GENERAL_FAULT (1, ON, OPEN)                                                      |
+|                      |                             | Name                        | String                                  | Name of the sensor                                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      |                             | TamperedStatus              | Contact, Number, String, Switch         | Tampered status                                                                                                                                                                                                                                                                                                                                               | inverted (false)                                                      | NOT_TAMPERED (0, OFF, CLOSED), TAMPERED (1, ON, OPEN)                                                       |
+| ContactSensor        |                             |                             |                                         | Contact Sensor, An accessory with on/off state that can be viewed in HomeKit but not changed such as a contact sensor for a door or window                                                                                                                                                                                                                    |                                                                       |                                                                                                             |
+|                      | ContactSensorState          |                             | Contact, Dimmer, Number, String, Switch | Contact sensor state                                                                                                                                                                                                                                                                                                                                          | inverted (false)                                                      | DETECTED (0, OFF, CLOSED), NOT_DETECTED (1, ON, OPEN)                                                       |
+|                      |                             | ActiveStatus                | Contact, Switch                         | Working status                                                                                                                                                                                                                                                                                                                                                |                                                                       |                                                                                                             |
+|                      |                             | BatteryLowStatus            | Contact, Number, Switch                 | Battery status                                                                                                                                                                                                                                                                                                                                                | inverted (false), lowThreshold (20)                                   |                                                                                                             |
+|                      |                             | FaultStatus                 | Contact, Number, String, Switch         | Fault status                                                                                                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NO_FAULT (0, OFF, CLOSED), GENERAL_FAULT (1, ON, OPEN)                                                      |
+|                      |                             | Name                        | String                                  | Name of the sensor                                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      |                             | TamperedStatus              | Contact, Number, String, Switch         | Tampered status                                                                                                                                                                                                                                                                                                                                               | inverted (false)                                                      | NOT_TAMPERED (0, OFF, CLOSED), TAMPERED (1, ON, OPEN)                                                       |
+| Door                 |                             |                             |                                         | Motorized door. One Rollershutter item covers all mandatory characteristics. see examples below.                                                                                                                                                                                                                                                              |                                                                       |                                                                                                             |
+|                      | CurrentPosition             |                             | Dimmer, Number, Rollershutter           | Current position of motorized door                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      | PositionState               |                             | Number, Rollershutter, String           | Position state. If no state is provided, "STOPPED" is used.                                                                                                                                                                                                                                                                                                   |                                                                       | DECREASING (0), INCREASING (1), STOPPED (2)                                                                 |
+|                      | TargetPosition              |                             | Dimmer, Number, Rollershutter           | Target position of motorized door                                                                                                                                                                                                                                                                                                                             |                                                                       |                                                                                                             |
+|                      |                             | HoldPosition                | Rollershutter, Switch                   | Motorized door should stop at its current position. ON is sent to Switch items. STOP is sent to Rollershutter items. Only supported by 3rd party Home apps (such as Elgato Eve)                                                                                                                                                                               |                                                                       |                                                                                                             |
+|                      |                             | Name                        | String                                  | Name of the motorized door                                                                                                                                                                                                                                                                                                                                    |                                                                       |                                                                                                             |
+|                      |                             | ObstructionStatus           | Contact, Dimmer, Switch                 | Current status of obstruction sensor. ON-obstruction detected, OFF - no obstruction                                                                                                                                                                                                                                                                           |                                                                       |                                                                                                             |
+| Fan                  |                             |                             |                                         | Fan                                                                                                                                                                                                                                                                                                                                                           |                                                                       |                                                                                                             |
+|                      | ActiveStatus                |                             | Dimmer, Switch                          | Accessory current working status. A value of "ON"/"OPEN" indicates that the accessory is active and is functioning without any errors.                                                                                                                                                                                                                        |                                                                       |                                                                                                             |
+|                      |                             | CurrentFanState             | Number, String                          | Current fan state.                                                                                                                                                                                                                                                                                                                                            |                                                                       | INACTIVE (0), IDLE (1), BLOWING_AIR (2)                                                                     |
+|                      |                             | LockControl                 | Number, Switch, String                  | Status of physical control lock                                                                                                                                                                                                                                                                                                                               | inverted (false)                                                      | CONTROL_LOCK_DISABLED (0, OFF), CONTROL_LOCK_ENABLED (1, ON)                                                |
+|                      |                             | RotationDirection           | Number, Switch, String                  | Rotation direction                                                                                                                                                                                                                                                                                                                                            | inverted (false)                                                      | CLOCKWISE (0, OFF), COUNTER_CLOCKWISE (1, ON)                                                               |
+|                      |                             | RotationSpeed               | Dimmer, Number                          | Fan rotation speed in % (1-100)                                                                                                                                                                                                                                                                                                                               |                                                                       |                                                                                                             |
+|                      |                             | SwingMode                   | Number, Switch, String                  | Swing mode                                                                                                                                                                                                                                                                                                                                                    | inverted (false)                                                      | SWING_DISABLED (0, OFF), SWING_ENABLED (1, ON)                                                              |
+|                      |                             | TargetFanState              | Number, Switch, String                  | Target fan state                                                                                                                                                                                                                                                                                                                                              | inverted (false)                                                      | MANUAL (0, OFF), AUTO (1, ON)                                                                               |
+| Faucet               |                             |                             |                                         | Faucet or shower. It should be used in combination with Valve or/and HeaterCooler.                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      | Active                      |                             | Contact, Dimmer, Switch                 | Accessory current working status                                                                                                                                                                                                                                                                                                                              | inverted (false)                                                      |                                                                                                             |
+|                      |                             | FaultStatus                 | Contact, Number, String, Switch         | Fault status                                                                                                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NO_FAULT (0, OFF, CLOSED), GENERAL_FAULT (1, ON, OPEN)                                                      |
+|                      |                             | Name                        | String                                  | Name of the Faucet                                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+| Filter               |                             |                             |                                         | Accessory with filter maintenance indicator                                                                                                                                                                                                                                                                                                                   |                                                                       |                                                                                                             |
+|                      | FilterChangeIndication      |                             | Contact, Dimmer, Number, String, Switch | Filter change indicator                                                                                                                                                                                                                                                                                                                                       | inverted (false)                                                      | NO_CHANGED_NEEDED (0, OFF, CLOSED), CHANGE_NEEDED (1, ON, OPEN)                                             |
+|                      |                             | FilterLifeLevel             | Number                                  | Current filter life level. 0% to 100%                                                                                                                                                                                                                                                                                                                         |                                                                       |                                                                                                             |
+|                      |                             | FilterResetIndication       | Switch                                  | Send "filter reset" action triggered by user in iOS Home app to openHAB ("ON" = reset requested by user).                                                                                                                                                                                                                                                     |                                                                       |                                                                                                             |
+|                      |                             | Name                        | String                                  | Name of the filter accessory                                                                                                                                                                                                                                                                                                                                  |                                                                       |                                                                                                             |
+| GarageDoorOpener     |                             |                             |                                         | A garage door opener.                                                                                                                                                                                                                                                                                                                                         |                                                                       |                                                                                                             |
+|                      | CurrentDoorState            |                             | Contact, Switch, Number, String         | Current door state.                                                                                                                                                                                                                                                                                                                                           | inverted (false)                                                      | OPEN (0, ON, OPEN), CLOSED (1, OFF, CLOSED), OPENING (2), CLOSING (3), STOPPED (4)                          |
+|                      | ObstructionStatus           |                             | Contact, Switch                         | Current status of obstruction sensor. ON-obstruction detected, OFF - no obstruction                                                                                                                                                                                                                                                                           | inverted (false)                                                      |                                                                                                             |
+|                      | TargetDoorState             |                             | Contact, Switch, Number, String         | Target door state.                                                                                                                                                                                                                                                                                                                                            | inverted (false)                                                      | OPEN (0, ON, OPEN), CLOSED (1, OFF, CLOSED)                                                                 |
+|                      |                             | Name                        | String                                  | Name of the garage door                                                                                                                                                                                                                                                                                                                                       |                                                                       |                                                                                                             |
+| HeaterCooler         |                             |                             |                                         | Heater or/and cooler device                                                                                                                                                                                                                                                                                                                                   |                                                                       |                                                                                                             |
+|                      | ActiveStatus                |                             | Dimmer, Switch                          | Accessory current working status. A value of "ON"/"OPEN" indicates that the accessory is active and is functioning without any errors.                                                                                                                                                                                                                        |                                                                       |                                                                                                             |
+|                      | CurrentHeaterCoolerState    |                             | Number, String                          | Current heater/cooler mode.                                                                                                                                                                                                                                                                                                                                   |                                                                       | INACTIVE (0), IDLE (1), HEATING (2), COOLING (3)                                                            |
+|                      | CurrentTemperature          |                             | Number                                  | Current temperature                                                                                                                                                                                                                                                                                                                                           | minValue (0), maxValue (100), step (0.1)                              |                                                                                                             |
+|                      | TargetHeaterCoolerState     |                             | Number, String                          | Target heater/cooler mode.                                                                                                                                                                                                                                                                                                                                    |                                                                       | AUTO (0, OFF), HEAT (1, ON), COOL (2)     [*](#customizable-enum)                                           |
+|                      |                             | CoolingThresholdTemperature | Number                                  | Maximum temperature that must be reached before cooling is turned on                                                                                                                                                                                                                                                                                          | minValue (10), maxValue (35), step (0.1)                              |                                                                                                             |
+|                      |                             | HeatingThresholdTemperature | Number                                  | Minimum temperature that must be reached before heating is turned on                                                                                                                                                                                                                                                                                          | minValue (0), maxValue (25), step (0.1)                               |                                                                                                             |
+|                      |                             | LockControl                 | Number, Switch, String                  | Status of physical control lock                                                                                                                                                                                                                                                                                                                               | inverted (false)                                                      | CONTROL_LOCK_DISABLED (0, OFF), CONTROL_LOCK_ENABLED (1, ON)                                                |
+|                      |                             | Name                        | String                                  | Name of the heater/cooler                                                                                                                                                                                                                                                                                                                                     |                                                                       |                                                                                                             |
+|                      |                             | RotationSpeed               | Number                                  | Fan rotation speed in % (1-100)                                                                                                                                                                                                                                                                                                                               |                                                                       |                                                                                                             |
+|                      |                             | SwingMode                   | Number, Switch, String                  | Swing mode                                                                                                                                                                                                                                                                                                                                                    | inverted (false)                                                      | SWING_DISABLED (0, OFF), SWING_ENABLED (1, ON)                                                              |
+| HumiditySensor       |                             |                             |                                         | Relative Humidity Sensor providing read-only values                                                                                                                                                                                                                                                                                                           |                                                                       |                                                                                                             |
+|                      | RelativeHumidity            |                             | Number                                  | Relative humidity in % between 0 and 100                                                                                                                                                                                                                                                                                                                      | homekitMultiplicator = {number to multiply result with}               |                                                                                                             |
+|                      |                             | ActiveStatus                | Contact, Switch                         | Working status                                                                                                                                                                                                                                                                                                                                                |                                                                       |                                                                                                             |
+|                      |                             | BatteryLowStatus            | Contact, Number, Switch                 | Battery status                                                                                                                                                                                                                                                                                                                                                | inverted (false), lowThreshold (20)                                   |                                                                                                             |
+|                      |                             | FaultStatus                 | Contact, Number, String, Switch         | Fault status                                                                                                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NO_FAULT (0, OFF, CLOSED), GENERAL_FAULT (1, ON, OPEN)                                                      |
+|                      |                             | Name                        | String                                  | Name of the sensor                                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      |                             | TamperedStatus              | Contact, Number, String, Switch         | Tampered status                                                                                                                                                                                                                                                                                                                                               | inverted (false)                                                      | NOT_TAMPERED (0, OFF, CLOSED), TAMPERED (1, ON, OPEN)                                                       |
+| InputSource          |                             |                             |                                         | Input source linked service. Can only be used with Television.                                                                                                                                                                                                                                                                                                |                                                                       |                                                                                                             |
+|                      |                             | Name                        | String                                  | Default name of the input source                                                                                                                                                                                                                                                                                                                              |                                                                       |                                                                                                             |
+|                      |                             | ConfiguredName              | String                                  | Name of the input source configured in the iOS Home app. User can rename the source in iOS Home app and this characteristic can be used to reflect change in openHAB and sync name changes from openHAB to Home app.                                                                                                                                          |                                                                       |                                                                                                             |
+|                      |                             | Configured                  | Contact, Dimmer, Switch                 | If the source is configured on the device. Non-configured inputs will not show up in the Home app. - ON/OPEN = show, OFF/CLOSED = hide. Default is ON. Can also be configured via metadata, e.g. [Configured=true]                                                                                                                                            |                                                                       |                                                                                                             |
+|                      |                             | CurrentVisibility           | Contact, Dimmer, Number, String, Switch | If the source has been hidden by the user. Can also be configured via metadata, e.g. [CurrentVisibility=false]                                                                                                                                                                                                                                                | inverted (false)                                                      | SHOWN (0, ON), HIDDEN (1, OFF)                                                                              |
+|                      |                             | Identifier                  | Number                                  | The identifier of the source, to be used with the ActiveIdentifier characteristic. Can also be configured via metadata, e.g. [Identifier=1]                                                                                                                                                                                                                   |                                                                       |                                                                                                             |
+|                      |                             | InputDeviceType             | String                                  | Type of the input device. possible values (OTHER, TV, RECORDING, TUNER, PLAYBACK, AUDIO_SYSTEM). Custom mapping can be defined at item level. Can also be configured via metadata, e.g. [InputDeviceType="OTHER"].                                                                                                                                            |                                                                       |                                                                                                             |
+|                      |                             | InputSourceType             | String                                  | Type of the input source. possible values (OTHER, HOME_SCREEN, TUNER, HDMI, COMPOSITE_VIDEO, S_VIDEO, COMPONENT_VIDEO, DVI, AIRPLAY, USB, APPLICATION). Custom mapping can be defined at item level. Can also be configured via metadata, e.g. [InputSourceType="OTHER"].                                                                                     |                                                                       |                                                                                                             |
+|                      |                             | TargetVisibilityState       | Switch, Number, String                  | The desired visibility state of the input source.                                                                                                                                                                                                                                                                                                             | inverted (false)                                                      | SHOWN (0, ON), HIDDEN (1, OFF)                                                                              |
+| IrrigationSystem     |                             |                             |                                         | An accessory that represents multiple water valves and accommodates a programmed scheduled.                                                                                                                                                                                                                                                                   |                                                                       |                                                                                                             |
+|                      | Active                      |                             | Contact, Dimmer, Number, String, Switch | If the irrigation system as a whole is enabled. This must be ON if any of the valves are also enabled.                                                                                                                                                                                                                                                        | inverted (false)                                                      | INACTIVE (0, OFF), ACTIVE (1, ON)                                                                           |
+|                      | InUseStatus                 |                             | Contact, Dimmer, Number, String, Switch | If the irrigation system as a whole is running. This must be ON if any of the valves are ON.                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NOT_IN_USE (0, OFF, CLOSED), IN_USE (1, ON, OPEN)                                                           |
+|                      | ProgramMode                 |                             | String                                  | The current program mode of the irrigation system. Possible values (NO_SCHEDULED - no programs scheduled, SCHEDULED - program scheduled, SCHEDULED_MANUAL - program scheduled, currently overriden to manual mode).                                                                                                                                           |                                                                       |                                                                                                             |
+|                      |                             | FaultStatus                 | Contact, Number, String, Switch         | Fault status                                                                                                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NO_FAULT (0, OFF, CLOSED), GENERAL_FAULT (1, ON, OPEN)                                                      |
+|                      |                             | RemainingDuration           | Number                                  | The remaining duration for all scheduled valves in the current program in seconds.                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+| LeakSensor           |                             |                             |                                         | Leak Sensor                                                                                                                                                                                                                                                                                                                                                   |                                                                       |                                                                                                             |
+|                      | LeakDetectedState           |                             | Contact, Dimmer, Number, String, Switch | Leak sensor state                                                                                                                                                                                                                                                                                                                                             | inverted (false)                                                      | LEAK_NOT_DETECTED (0, OFF, CLOSED), LEAK_DETECTED (1, ON, OPEN)                                             |
+|                      |                             | ActiveStatus                | Contact, Switch                         | Working status                                                                                                                                                                                                                                                                                                                                                |                                                                       |                                                                                                             |
+|                      |                             | BatteryLowStatus            | Contact, Number, Switch                 | Battery status                                                                                                                                                                                                                                                                                                                                                | inverted (false), lowThreshold (20)                                   |                                                                                                             |
+|                      |                             | FaultStatus                 | Contact, Number, String, Switch         | Fault status                                                                                                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NO_FAULT (0, OFF, CLOSED), GENERAL_FAULT (1, ON, OPEN)                                                      |
+|                      |                             | Name                        | String                                  | Name of the sensor                                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      |                             | TamperedStatus              | Contact, Number, String, Switch         | Tampered status                                                                                                                                                                                                                                                                                                                                               | inverted (false)                                                      | NOT_TAMPERED (0, OFF, CLOSED), TAMPERED (1, ON, OPEN)                                                       |
+| LightSensor          |                             |                             |                                         | Light sensor                                                                                                                                                                                                                                                                                                                                                  |                                                                       |                                                                                                             |
+|                      | LightLevel                  |                             | Number                                  | Light level in lux                                                                                                                                                                                                                                                                                                                                            | minValue (0.0001), maxValue (100000)                                  |                                                                                                             |
+|                      |                             | ActiveStatus                | Contact, Switch                         | Working status                                                                                                                                                                                                                                                                                                                                                |                                                                       |                                                                                                             |
+|                      |                             | BatteryLowStatus            | Contact, Number, Switch                 | Battery status                                                                                                                                                                                                                                                                                                                                                | inverted (false), lowThreshold (20)                                   |                                                                                                             |
+|                      |                             | FaultStatus                 | Contact, Number, String, Switch         | Fault status                                                                                                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NO_FAULT (0, OFF, CLOSED), GENERAL_FAULT (1, ON, OPEN)                                                      |
+|                      |                             | Name                        | String                                  | Name of the sensor                                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      |                             | TamperedStatus              | Contact, Number, String, Switch         | Tampered status                                                                                                                                                                                                                                                                                                                                               | inverted (false)                                                      | NOT_TAMPERED (0, OFF, CLOSED), TAMPERED (1, ON, OPEN)                                                       |
+| Lighting             |                             |                             |                                         | A lightbulb, can have further optional parameters for brightness, hue, etc                                                                                                                                                                                                                                                                                    |                                                                       |                                                                                                             |
+|                      | OnState                     |                             | Switch                                  | State of the light - ON/OFF                                                                                                                                                                                                                                                                                                                                   |                                                                       |                                                                                                             |
+|                      |                             | Brightness                  | Dimmer, Color                           | Brightness in % (1-100). See "Usage of dimmer modes" for configuration details.                                                                                                                                                                                                                                                                               |                                                                       |                                                                                                             |
+|                      |                             | ColorTemperature            | Dimmer, Number                          | Color temperature. If the item is a Number with no units, it is represented in mireds. The default value range is from 50 to 400 (2500 K to 20,000 K). If the item is a Dimmer, it will be transformed linearly to mireds. Color temperature should not be used in combination with hue, saturation and brightness.                                           | minValue (50), maxValue (400), inverted                               |                                                                                                             |
+|                      |                             | Hue                         | Dimmer, Color                           | Hue                                                                                                                                                                                                                                                                                                                                                           |                                                                       |                                                                                                             |
+|                      |                             | Name                        | String                                  | Name of the light                                                                                                                                                                                                                                                                                                                                             |                                                                       |                                                                                                             |
+|                      |                             | Saturation                  | Dimmer, Color                           | Saturation in % (1-100)                                                                                                                                                                                                                                                                                                                                       |                                                                       |                                                                                                             |
+| Lock                 |                             |                             |                                         | A Lock Mechanism                                                                                                                                                                                                                                                                                                                                              | inverted (false)                                                      |                                                                                                             |
+|                      | LockCurrentState            |                             | Contact, Number, String, Switch         | Current state of lock mechanism                                                                                                                                                                                                                                                                                                                               | inverted (false)                                                      | UNSECURED (0, OFF, CLOSED), SECURED (1, ON, OPEN), JAMMED (2), UNKNOWN (3)                                  |
+|                      | LockTargetState             |                             | Number, String, Switch                  | Target state of lock mechanism                                                                                                                                                                                                                                                                                                                                | inverted (false)                                                      | UNSECURED (0, OFF), SECURED (1, ON)                                                                         |
+|                      |                             | Name                        | String                                  | Name of the lock                                                                                                                                                                                                                                                                                                                                              |                                                                       |                                                                                                             |
+| Microphone           |                             |                             |                                         | Microphone accessory                                                                                                                                                                                                                                                                                                                                          |                                                                       |                                                                                                             |
+|                      | Mute                        |                             | Contact, Dimmer, Switch                 | Mute indication. ON/OPEN = microphone is muted                                                                                                                                                                                                                                                                                                                | inverted (false)                                                      |                                                                                                             |
+|                      |                             | Name                        | String                                  | Name of the microphone accessory                                                                                                                                                                                                                                                                                                                              |                                                                       |                                                                                                             |
+|                      |                             | Volume                      | Number                                  | Microphone volume from 0% to 100%                                                                                                                                                                                                                                                                                                                             |                                                                       |                                                                                                             |
+| MotionSensor         |                             |                             |                                         | Motion Sensor                                                                                                                                                                                                                                                                                                                                                 |                                                                       |                                                                                                             |
+|                      | MotionDetectedState         |                             | Contact, Dimmer, Switch                 | Motion sensor state (ON=motion detected, OFF=no motion)                                                                                                                                                                                                                                                                                                       | inverted (false)                                                      |                                                                                                             |
+|                      |                             | ActiveStatus                | Contact, Switch                         | Working status                                                                                                                                                                                                                                                                                                                                                |                                                                       |                                                                                                             |
+|                      |                             | BatteryLowStatus            | Contact, Number, Switch                 | Battery status                                                                                                                                                                                                                                                                                                                                                | inverted (false), lowThreshold (20)                                   |                                                                                                             |
+|                      |                             | FaultStatus                 | Contact, Number, String, Switch         | Fault status                                                                                                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NO_FAULT (0, OFF, CLOSED), GENERAL_FAULT (1, ON, OPEN)                                                      |
+|                      |                             | Name                        | String                                  | Name of the sensor                                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      |                             | TamperedStatus              | Contact, Number, String, Switch         | Tampered status                                                                                                                                                                                                                                                                                                                                               | inverted (false)                                                      | NOT_TAMPERED (0, OFF, CLOSED), TAMPERED (1, ON, OPEN)                                                       |
+| OccupancySensor      |                             |                             |                                         | Occupancy Sensor                                                                                                                                                                                                                                                                                                                                              |                                                                       |                                                                                                             |
+|                      | OccupancyDetectedState      |                             | Contact, Dimmer, Number, String, Switch | Occupancy sensor state                                                                                                                                                                                                                                                                                                                                        | inverted (false)                                                      | NOT_DETECTED (0, OFF, CLOSED), DETECTED (1, ON, OPEN)                                                       |
+|                      |                             | ActiveStatus                | Contact, Switch                         | Working status                                                                                                                                                                                                                                                                                                                                                |                                                                       |                                                                                                             |
+|                      |                             | BatteryLowStatus            | Contact, Number, Switch                 | Battery status                                                                                                                                                                                                                                                                                                                                                | inverted (false), lowThreshold (20)                                   |                                                                                                             |
+|                      |                             | FaultStatus                 | Contact, Number, String, Switch         | Fault status                                                                                                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NO_FAULT (0, OFF, CLOSED), GENERAL_FAULT (1, ON, OPEN)                                                      |
+|                      |                             | Name                        | String                                  | Name of the sensor                                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      |                             | TamperedStatus              | Contact, Number, String, Switch         | Tampered status                                                                                                                                                                                                                                                                                                                                               | inverted (false)                                                      | NOT_TAMPERED (0, OFF, CLOSED), TAMPERED (1, ON, OPEN)                                                       |
+| Outlet               |                             |                             |                                         | An accessory that can be turned off and on. While similar to a lightbulb, this will be presented differently in the Siri grammar and iOS apps                                                                                                                                                                                                                 |                                                                       |                                                                                                             |
+|                      | InUseStatus                 |                             | Contact, Dimmer, Switch                 | Indicates whether the outlet has an appliance e.g., a floor lamp, physically plugged in. This characteristic is set to True even if the plugged-in appliance is off.                                                                                                                                                                                          | inverted (false)                                                      |                                                                                                             |
+|                      | OnState                     |                             | Dimmer, Switch                          | State of the outlet - ON/OFF                                                                                                                                                                                                                                                                                                                                  |                                                                       |                                                                                                             |
+|                      |                             | Name                        | String                                  | Name of the switch                                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+| SecuritySystem       |                             |                             |                                         | Security system.                                                                                                                                                                                                                                                                                                                                              |                                                                       |                                                                                                             |
+|                      | CurrentSecuritySystemState  |                             | Number, String                          | Current state of the security system                                                                                                                                                                                                                                                                                                                          |                                                                       | STAY_ARM (0), AWAY_ARM (1), NIGHT_ARM (2), DISARMED (3), TRIGGERED (4)                                      |
+|                      | TargetSecuritySystemState   |                             | Number, String                          | Requested state of the security system. While the requested state is not DISARM, and the current state is DISARMED, HomeKit will display "Arming...", for example during an exit delay.                                                                                                                                                                       |                                                                       | STAY_ARM (0), AWAY_ARM (1), NIGHT_ARM (2), DISARM (3)    [*](#customizable-enum)                            |
+|                      |                             | FaultStatus                 | Contact, Number, String, Switch         | Fault status                                                                                                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NO_FAULT (0, OFF, CLOSED), GENERAL_FAULT (1, ON, OPEN)                                                      |
+|                      |                             | Name                        | String                                  | Name of the security system                                                                                                                                                                                                                                                                                                                                   |                                                                       |                                                                                                             |
+|                      |                             | TamperedStatus              | Contact, Number, String, Switch         | Tampered status                                                                                                                                                                                                                                                                                                                                               | inverted (false)                                                      | NOT_TAMPERED (0, OFF, CLOSED), TAMPERED (1, ON, OPEN)                                                       |
+| Slat                 |                             |                             |                                         | Slat which tilts on a vertical or a horizontal axis. Configuration "type:horizontal" or "type:vertical"                                                                                                                                                                                                                                                       |                                                                       |                                                                                                             |
+|                      | CurrentSlatState            |                             | Number, String                          | Current slat state.                                                                                                                                                                                                                                                                                                                                           |                                                                       | FIXED (0), JAMMED (1), SWINGING (2)                                                                         |
+|                      |                             | CurrentTiltAngle            | Dimmer, Number                          | Number Item = current angle of slats. values -90 to 90. A value of 0 indicates that the slats are rotated to a fully open position. Dimmer Item =  the percentage of openness (0%-100%)                                                                                                                                                                       |                                                                       |                                                                                                             |
+|                      |                             | Name                        | String                                  | Name of the slat                                                                                                                                                                                                                                                                                                                                              |                                                                       |                                                                                                             |
+|                      |                             | SwingMode                   | Number, Switch, String                  | Swing mode                                                                                                                                                                                                                                                                                                                                                    | inverted (false)                                                      | SWING_DISABLED (0, OFF), SWING_ENABLED (1, ON)                                                              |
+|                      |                             | TargetTiltAngle             | Dimmer, Number                          | Number Item = target angle of slats (-90 to +90). Dimmer Item =  the percentage of openness (0%-100%)                                                                                                                                                                                                                                                         |                                                                       |                                                                                                             |
+| SmartSpeaker         |                             |                             |                                         | Smart speaker accessory with Play/Stop/Pause control                                                                                                                                                                                                                                                                                                          |                                                                       |                                                                                                             |
+|                      | CurrentMediaState           |                             | Number, String                          | Current smart speaker state                                                                                                                                                                                                                                                                                                                                   |                                                                       | PLAY (0), PAUSE (1), STOP (2), UNKNOWN (3)                                                                  |
+|                      | TargetMediaState            |                             | Number, String                          | Target smart speaker state                                                                                                                                                                                                                                                                                                                                    |                                                                       | PLAY (0), PAUSE (1), STOP (2)                                                                               |
+|                      |                             | ConfiguredName              | String                                  | Name of the speaker accessory configured in iOS Home app. User can rename the speaker in iOS Home app and this characteristic can be used to reflect change in openHAB and sync name changes from openHAB to Home app.                                                                                                                                        |                                                                       |                                                                                                             |
+|                      |                             | Mute                        | Contact, Switch                         | Mute indication. ON/OPEN = speaker is muted                                                                                                                                                                                                                                                                                                                   | inverted (false)                                                      |                                                                                                             |
+|                      |                             | Name                        | String                                  | Name of the speaker accessory                                                                                                                                                                                                                                                                                                                                 |                                                                       |                                                                                                             |
+|                      |                             | Volume                      | Number                                  | Speaker volume from 0% to 100%                                                                                                                                                                                                                                                                                                                                |                                                                       |                                                                                                             |
+| SmokeSensor          |                             |                             |                                         | Smoke Sensor                                                                                                                                                                                                                                                                                                                                                  |                                                                       |                                                                                                             |
+|                      | SmokeDetectedState          |                             | Contact, Dimmer, Number, String, Switch | Smoke sensor state                                                                                                                                                                                                                                                                                                                                            | inverted (false)                                                      | NOT_DETECTED (0, OFF, CLOSED), DETECTED (1, ON, OPEN)                                                       |
+|                      |                             | ActiveStatus                | Contact, Switch                         | Working status                                                                                                                                                                                                                                                                                                                                                |                                                                       |                                                                                                             |
+|                      |                             | BatteryLowStatus            | Contact, Number, Switch                 | Battery status                                                                                                                                                                                                                                                                                                                                                | inverted (false), lowThreshold (20)                                   |                                                                                                             |
+|                      |                             | FaultStatus                 | Contact, Number, String, Switch         | Fault status                                                                                                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NO_FAULT (0, OFF, CLOSED), GENERAL_FAULT (1, ON, OPEN)                                                      |
+|                      |                             | Name                        | String                                  | Name of the sensor                                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      |                             | TamperedStatus              | Contact, Number, String, Switch         | Tampered status                                                                                                                                                                                                                                                                                                                                               | inverted (false)                                                      | NOT_TAMPERED (0, OFF, CLOSED), TAMPERED (1, ON, OPEN)                                                       |
+| Speaker              |                             |                             |                                         | Speaker accessory                                                                                                                                                                                                                                                                                                                                             |                                                                       |                                                                                                             |
+|                      | Mute                        |                             | Contact, Dimmer, Switch                 | Mute indication. ON/OPEN = speaker is muted                                                                                                                                                                                                                                                                                                                   | inverted (false)                                                      |                                                                                                             |
+|                      |                             | Active                      | Contact, Dimmer, Number, String, Switch | Accessory current working status                                                                                                                                                                                                                                                                                                                              | inverted (false)                                                      | INACTIVE (0, OFF), ACTIVE (1, ON)                                                                           |
+|                      |                             | Name                        | String                                  | Name of the speaker accessory                                                                                                                                                                                                                                                                                                                                 |                                                                       |                                                                                                             |
+|                      |                             | Volume                      | Number                                  | Speaker volume from 0% to 100%                                                                                                                                                                                                                                                                                                                                |                                                                       |                                                                                                             |
+| Switchable           |                             |                             |                                         | An accessory that can be turned off and on. While similar to a lightbulb, this will be presented differently in the Siri grammar and iOS apps                                                                                                                                                                                                                 |                                                                       |                                                                                                             |
+|                      | OnState                     |                             | Dimmer, Switch                          | State of the switch - ON/OFF                                                                                                                                                                                                                                                                                                                                  |                                                                       |                                                                                                             |
+|                      |                             | Name                        | String                                  | Name of the switch                                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+| Television           |                             |                             |                                         | Television accessory with inputs                                                                                                                                                                                                                                                                                                                              |                                                                       |                                                                                                             |
+|                      | Active                      |                             | Contact, Dimmer, Number, String, Switch | State of the television (on/off)                                                                                                                                                                                                                                                                                                                              | inverted (false)                                                      | INACTIVE (0, OFF), ACTIVE (1, ON)                                                                           |
+|                      |                             | ActiveIdentifier            | Number                                  | The input that is currently active (based on its identifier). Can also be configured via metadata, e.g. [ActiveIdentifier=1]                                                                                                                                                                                                                                  |                                                                       |                                                                                                             |
+|                      |                             | Brightness                  | Dimmer                                  | Screen brightness in % (1-100).                                                                                                                                                                                                                                                                                                                               |                                                                       |                                                                                                             |
+|                      |                             | ClosedCaptions              | Contact, Dimmer, Number, String, Switch | Indicates closed captions are enabled. Can also be configured via metadata, e.g. [ClosedCaptions=true]                                                                                                                                                                                                                                                        | inverted (false)                                                      | DISABLED (0, OFF), ENABLED (1, ON)                                                                          |
+|                      |                             | ConfiguredName              | String                                  | Name of the television accessory configured in the iOS Home app. User can rename the television in iOS Home app and this characteristic can be used to reflect change in openHAB and sync name changes from openHAB to Home app.                                                                                                                              |                                                                       |                                                                                                             |
+|                      |                             | CurrentMediaState           | Number, String                          | Current television state.                                                                                                                                                                                                                                                                                                                                     |                                                                       | PLAY (0), PAUSE (1), STOP (2), UNKNOWN (3)                                                                  |
+|                      |                             | Name                        | String                                  | Name of the television accessory                                                                                                                                                                                                                                                                                                                              |                                                                       |                                                                                                             |
+|                      |                             | PictureMode                 | Number, String                          | Selected picture mode.                                                                                                                                                                                                                                                                                                                                        |                                                                       | OTHER (0), STANDARD (1), CALIBRATED (2), CALIBRATED_DARK (3), VIVID (4), GAME (5), COMPUTER (6), CUSTOM (7) |
+|                      |                             | PowerMode                   | Switch, Number, String                  | This oddly named characteristic will receive an ON command when the user requests to open the TV's menu.                                                                                                                                                                                                                                                      | inverted (false)                                                      | SHOW (0, ON), HIDE (1, OFF)                                                                                 |
+|                      |                             | RemoteKey                   | String                                  | Receives a keypress event.                                                                                                                                                                                                                                                                                                                                    |                                                                       |                                                                                                             |
+|                      |                             | SleepDiscoveryMode          | Contact, Dimmer, Number, String, Switch | Indicates if the television is discoverable while in standby mode. Can also be configured via metadata, e.g. [SleepDiscoveryMode=true]                                                                                                                                                                                                                        | inverted (false)                                                      | NOT_DISCOVERABLE (0, OFF), ALWAYS_DISCOVERABLE (1, ON)                                                      |
+|                      |                             | TargetMediaState            | Number, String                          | Target television state.                                                                                                                                                                                                                                                                                                                                      |                                                                       | PLAY (0), PAUSE (1), STOP (2)                                                                               |
+| TelevisionSpeaker    |                             |                             |                                         | An accessory that can be added to a Television in order to control the speaker associated with it.                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      | Mute                        |                             | Switch                                  | If the television is muted. ON = muted, OFF = not muted.                                                                                                                                                                                                                                                                                                      |                                                                       |                                                                                                             |
+|                      |                             | Active                      | Contact, Dimmer, Number, String, Switch | Unknown. This characteristic is undocumented by Apple, but is still available.                                                                                                                                                                                                                                                                                | inverted (false)                                                      | INACTIVE (0, OFF), ACTIVE (1, ON)                                                                           |
+|                      |                             | Volume                      | Dimmer, Number                          | Current volume.                                                                                                                                                                                                                                                                                                                                               |                                                                       |                                                                                                             |
+|                      |                             | VolumeControlType           | String                                  | The type of control available. This will default to infer based on what other items are linked. NONE = status only, no control; RELATIVE = INCREMENT/DECREMENT only, no status; RELATIVE_WITH_CURRENT = INCREMENT/DECREMENT only with status; ABSOLUTE = direct status and control. Can also be configured via metadata, e.g. [VolumeControlType="ABSOLUTE"]. |                                                                       |                                                                                                             |
+|                      |                             | VolumeSelector              | Dimmer, String                          | If linked to a dimmer item, will send INCREASE/DECREASE commands. If linked to a string item, will send INCREMENT and DECREMENT.                                                                                                                                                                                                                              |                                                                       |                                                                                                             |
+| TemperatureSensor    |                             |                             |                                         | Temperature sensor                                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      | CurrentTemperature          |                             | Number                                  | current temperature                                                                                                                                                                                                                                                                                                                                           | minValue (0), maxValue (100), step (0.1)                              |                                                                                                             |
+|                      |                             | ActiveStatus                | Contact, Switch                         | Working status                                                                                                                                                                                                                                                                                                                                                |                                                                       |                                                                                                             |
+|                      |                             | BatteryLowStatus            | Contact, Number, Switch                 | Battery status                                                                                                                                                                                                                                                                                                                                                | inverted (false), lowThreshold (20)                                   |                                                                                                             |
+|                      |                             | FaultStatus                 | Contact, Number, String, Switch         | Fault status                                                                                                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NO_FAULT (0, OFF, CLOSED), GENERAL_FAULT (1, ON, OPEN)                                                      |
+|                      |                             | Name                        | String                                  | Name of the sensor                                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      |                             | TamperedStatus              | Contact, Number, String, Switch         | Tampered status                                                                                                                                                                                                                                                                                                                                               | inverted (false)                                                      | NOT_TAMPERED (0, OFF, CLOSED), TAMPERED (1, ON, OPEN)                                                       |
+| Thermostat           |                             |                             |                                         | A thermostat requires all mandatory characteristics defined below                                                                                                                                                                                                                                                                                             |                                                                       |                                                                                                             |
+|                      | CurrentHeatingCoolingMode   |                             | Number, String                          | Current heating cooling mode                                                                                                                                                                                                                                                                                                                                  |                                                                       | OFF (0, OFF), HEAT (1, ON), COOL (2)                                                                        |
+|                      | CurrentTemperature          |                             | Number                                  | Current temperature.                                                                                                                                                                                                                                                                                                                                          | minValue (0), maxValue (100), step (0.1)                              |                                                                                                             |
+|                      | TargetHeatingCoolingMode    |                             | Number, String                          | Target heating cooling mode                                                                                                                                                                                                                                                                                                                                   |                                                                       | OFF (0, OFF), HEAT (1, ON), COOL (2), AUTO (3) [*](#customizable-enum)                                      |
+|                      | TargetTemperature           |                             | Number                                  | Target temperature.                                                                                                                                                                                                                                                                                                                                           | minValue (10), maxValue (38), step (0.1)                              |                                                                                                             |
+|                      |                             | CoolingThresholdTemperature | Number                                  | Maximum temperature that must be reached before cooling is turned on                                                                                                                                                                                                                                                                                          | minValue (10), maxValue (35), step (0.1)                              |                                                                                                             |
+|                      |                             | HeatingThresholdTemperature | Number                                  | Minimum temperature that must be reached before heating is turned on                                                                                                                                                                                                                                                                                          | minValue (0), maxValue (25), step (0.1)                               |                                                                                                             |
+|                      |                             | Name                        | String                                  | Name of the thermostat                                                                                                                                                                                                                                                                                                                                        |                                                                       |                                                                                                             |
+|                      |                             | RelativeHumidity            | Number                                  | Relative humidity in % between 0 and 100.                                                                                                                                                                                                                                                                                                                     |                                                                       |                                                                                                             |
+| Valve                |                             |                             |                                         | Valve                                                                                                                                                                                                                                                                                                                                                         | ValveType = ["Generic", "Irrigation", "Shower", "Faucet"] ("Generic") |                                                                                                             |
+|                      | ActiveStatus                |                             | Dimmer, Switch                          | Accessory current working status. A value of "ON"/"OPEN" indicates that the accessory is active and is functioning without any errors.                                                                                                                                                                                                                        |                                                                       |                                                                                                             |
+|                      | InUseStatus                 |                             | Contact, Dimmer, Switch                 | Indicates whether fluid flowing through the valve. A value of "ON"/"OPEN" indicates that fluid is flowing.                                                                                                                                                                                                                                                    | inverted (false)                                                      |                                                                                                             |
+|                      |                             | Duration                    | Number                                  | Defines how long a valve should be set to Ê¼In Useʼ in second.                                                                                                                                                                                                                                                                                                 | homekitDefaultDuration = {default duration in seconds}                |                                                                                                             |
+|                      |                             | FaultStatus                 | Contact, Number, String, Switch         | Fault status                                                                                                                                                                                                                                                                                                                                                  | inverted (false)                                                      | NO_FAULT (0, OFF, CLOSED), GENERAL_FAULT (1, ON, OPEN)                                                      |
+|                      |                             | Name                        | String                                  | Name of the valve                                                                                                                                                                                                                                                                                                                                             |                                                                       |                                                                                                             |
+|                      |                             | RemainingDuration           | Number                                  | Describes the remaining duration on the accessory. the remaining duration increases/decreases from the accessoryʼs usual countdown. i.e. changes from 90 to 80 in a second.                                                                                                                                                                                   |                                                                       |                                                                                                             |
+| Window               |                             |                             |                                         | Motorized window. One Rollershutter item covers all mandatory characteristics. see examples below.                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      | CurrentPosition             |                             | Dimmer, Number, Rollershutter           | Current position of motorized window                                                                                                                                                                                                                                                                                                                          |                                                                       |                                                                                                             |
+|                      | PositionState               |                             | Number, Rollershutter, String           | Position state. If no state is provided, "STOPPED" is used.                                                                                                                                                                                                                                                                                                   |                                                                       | DECREASING (0), INCREASING (1), STOPPED (2)                                                                 |
+|                      | TargetPosition              |                             | Dimmer, Number, Rollershutter           | Target position of motorized window                                                                                                                                                                                                                                                                                                                           |                                                                       |                                                                                                             |
+|                      |                             | Name                        | String                                  | Name of the motorized window                                                                                                                                                                                                                                                                                                                                  |                                                                       |                                                                                                             |
+|                      |                             | HoldPosition                | Rollershutter, Switch                   | Motorized door should stop at its current position. ON is sent to Switch items. STOP is sent to Rollershutter items. Only supported by 3rd party Home apps (such as Elgato Eve)                                                                                                                                                                               |                                                                       |                                                                                                             |
+|                      |                             | ObstructionStatus           | Contact, Dimmer, Switch                 | Current status of obstruction sensor. ON-obstruction detected, OFF - no obstruction                                                                                                                                                                                                                                                                           |                                                                       |                                                                                                             |
+| WindowCovering       |                             |                             |                                         | Window covering / blinds. One Rollershutter item covers all mandatory characteristics. see examples below.                                                                                                                                                                                                                                                    |                                                                       |                                                                                                             |
+|                      | CurrentPosition             |                             | Dimmer, Number, Rollershutter           | Current position of window covering                                                                                                                                                                                                                                                                                                                           |                                                                       |                                                                                                             |
+|                      | PositionState               |                             | Number, Rollershutter, String           | Position state. If no state is provided, "STOPPED" is used.                                                                                                                                                                                                                                                                                                   |                                                                       | DECREASING (0), INCREASING (1), STOPPED (2)                                                                 |
+|                      | TargetPosition              |                             | Dimmer, Number, Rollershutter           | Target position of window covering                                                                                                                                                                                                                                                                                                                            |                                                                       |                                                                                                             |
+|                      |                             | CurrentHorizontalTiltAngle  | Dimmer, Number                          | Number Item = current angle of horizontal slats. values -90 to 90. A value of 0 indicates that the slats are rotated to a fully open position. A value of -90 indicates that the slats are rotated all the way in a direction where the user-facing edge is higher than the window-facing edge. Dimmer Item =  the percentage of openness (0%-100%)           |                                                                       |                                                                                                             |
+|                      |                             | CurrentVerticalTiltAngle    | Dimmer, Number                          | Number Item = current angle of vertical slats (-90 to +90) . Dimmer Item =  the percentage of openness (0%-100%)                                                                                                                                                                                                                                              |                                                                       |                                                                                                             |
+|                      |                             | HoldPosition                | Rollershutter, Switch                   | Motorized door should stop at its current position. ON is sent to Switch items. STOP is sent to Rollershutter items. Only supported by 3rd party Home apps (such as Elgato Eve)                                                                                                                                                                               |                                                                       |                                                                                                             |
+|                      |                             | Name                        | String                                  | Name of the windows covering                                                                                                                                                                                                                                                                                                                                  |                                                                       |                                                                                                             |
+|                      |                             | ObstructionStatus           | Contact, Dimmer, Switch                 | Current status of obstruction sensor. ON-obstruction detected, OFF - no obstruction                                                                                                                                                                                                                                                                           |                                                                       |                                                                                                             |
+|                      |                             | TargetHorizontalTiltAngle   | Dimmer, Number                          | Number Item = target angle of horizontal slats (-90 to +90). Dimmer Item =  the percentage of openness (0%-100%)                                                                                                                                                                                                                                              |                                                                       |                                                                                                             |
+|                      |                             | TargetVerticalTiltAngle     | Dimmer, Number                          | Number Item = target angle of vertical slats. Dimmer Item =  the percentage of openness (0%-100%)                                                                                                                                                                                                                                                             |                                                                       |                                                                                                             |
 
 ### Examples
 
index daff50df52c70d9a7a78d983aebcc5dd2576f889..f0ecf303eb00d8bbe6d4d49764700eeb421e9210 100644 (file)
@@ -34,20 +34,6 @@ public class HomekitSettings {
     public boolean useFahrenheitTemperature = false;
     public boolean useOHmDNS = false;
     public boolean blockUserDeletion = false;
-    public String thermostatTargetModeHeat = "HeatOn";
-    public String thermostatTargetModeCool = "CoolOn";
-    public String thermostatTargetModeAuto = "Auto";
-    public String thermostatTargetModeOff = "Off";
-    public String thermostatCurrentModeHeating = "HeatOn";
-    public String thermostatCurrentModeCooling = "CoolOn";
-    public String thermostatCurrentModeOff = "Off";
-    public String doorCurrentStateOpen = "OPEN";
-    public String doorCurrentStateOpening = "OPENING";
-    public String doorCurrentStateClosed = "CLOSED";
-    public String doorCurrentStateClosing = "CLOSING";
-    public String doorCurrentStateStopped = "STOPPED";
-    public String doorTargetStateClosed = "CLOSED";
-    public String doorTargetStateOpen = "OPEN";
     public String networkInterface;
 
     @Override
@@ -57,10 +43,6 @@ public class HomekitSettings {
         result = prime * result + ((pin == null) ? 0 : pin.hashCode());
         result = prime * result + ((setupId == null) ? 0 : setupId.hashCode());
         result = prime * result + port;
-        result = prime * result + ((thermostatTargetModeAuto == null) ? 0 : thermostatTargetModeAuto.hashCode());
-        result = prime * result + ((thermostatTargetModeCool == null) ? 0 : thermostatTargetModeCool.hashCode());
-        result = prime * result + ((thermostatTargetModeHeat == null) ? 0 : thermostatTargetModeHeat.hashCode());
-        result = prime * result + ((thermostatTargetModeOff == null) ? 0 : thermostatTargetModeOff.hashCode());
         result = prime * result + (useFahrenheitTemperature ? 1231 : 1237);
         result = prime * result + (useDummyAccessories ? 1249 : 1259);
         return result;
@@ -98,34 +80,6 @@ public class HomekitSettings {
         if (instances != other.instances) {
             return false;
         }
-        if (thermostatTargetModeAuto == null) {
-            if (other.thermostatTargetModeAuto != null) {
-                return false;
-            }
-        } else if (!thermostatTargetModeAuto.equals(other.thermostatTargetModeAuto)) {
-            return false;
-        }
-        if (thermostatTargetModeCool == null) {
-            if (other.thermostatTargetModeCool != null) {
-                return false;
-            }
-        } else if (!thermostatTargetModeCool.equals(other.thermostatTargetModeCool)) {
-            return false;
-        }
-        if (thermostatTargetModeHeat == null) {
-            if (other.thermostatTargetModeHeat != null) {
-                return false;
-            }
-        } else if (!thermostatTargetModeHeat.equals(other.thermostatTargetModeHeat)) {
-            return false;
-        }
-        if (thermostatTargetModeOff == null) {
-            if (other.thermostatTargetModeOff != null) {
-                return false;
-            }
-        } else if (!thermostatTargetModeOff.equals(other.thermostatTargetModeOff)) {
-            return false;
-        }
         if (useFahrenheitTemperature != other.useFahrenheitTemperature) {
             return false;
         }
index 0a3460691809989998c420f9e660a3d67b0c7af1..0d447f65a16626b136e026780fd832d57ef153f7 100644 (file)
@@ -43,6 +43,7 @@ import org.slf4j.LoggerFactory;
 
 import io.github.hapjava.accessories.HomekitAccessory;
 import io.github.hapjava.characteristics.Characteristic;
+import io.github.hapjava.characteristics.CharacteristicEnum;
 import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
 import io.github.hapjava.characteristics.impl.base.BaseCharacteristic;
 import io.github.hapjava.services.Service;
@@ -267,29 +268,38 @@ public abstract class AbstractHomekitAccessoryImpl implements HomekitAccessory {
                 .map(homekitTaggedItem -> homekitTaggedItem.getConfiguration(key, defaultValue)).orElse(defaultValue);
     }
 
-    /**
-     * update mapping with values from item configuration.
-     * it checks for all keys from the mapping whether there is configuration at item with the same key and if yes,
-     * replace the value.
-     *
-     * @param characteristicType characteristicType to identify item
-     * @param map mapping to update
-     * @param customEnumList list to store custom state enumeration
-     */
     @NonNullByDefault
-    public <T> void updateMapping(HomekitCharacteristicType characteristicType, Map<T, String> map,
-            @Nullable List<T> customEnumList) {
-        getCharacteristic(characteristicType).ifPresent(c -> {
-            final Map<String, Object> configuration = c.getConfiguration();
-            if (configuration != null) {
-                HomekitCharacteristicFactory.updateMapping(configuration, map, customEnumList);
-            }
-        });
+    protected <T extends Enum<T> & CharacteristicEnum> Map<T, String> createMapping(
+            HomekitCharacteristicType characteristicType, Class<T> klazz) {
+        return createMapping(characteristicType, klazz, null, false);
+    }
+
+    @NonNullByDefault
+    protected <T extends Enum<T> & CharacteristicEnum> Map<T, String> createMapping(
+            HomekitCharacteristicType characteristicType, Class<T> klazz, boolean inverted) {
+        return createMapping(characteristicType, klazz, null, inverted);
+    }
+
+    @NonNullByDefault
+    protected <T extends Enum<T> & CharacteristicEnum> Map<T, String> createMapping(
+            HomekitCharacteristicType characteristicType, Class<T> klazz, @Nullable List<T> customEnumList) {
+        return createMapping(characteristicType, klazz, customEnumList, false);
     }
 
+    /**
+     * create mapping with values from item configuration
+     * 
+     * @param characteristicType to identify item; must be present
+     * @param customEnumList list to store custom state enumeration
+     * @param inverted if ON/OFF and OPEN/CLOSED should be inverted by default (inverted on the item will double-invert)
+     * @return mapping of enum values to custom string values
+     */
     @NonNullByDefault
-    public <T> void updateMapping(HomekitCharacteristicType characteristicType, Map<T, String> map) {
-        updateMapping(characteristicType, map, null);
+    protected <T extends Enum<T> & CharacteristicEnum> Map<T, String> createMapping(
+            HomekitCharacteristicType characteristicType, Class<T> klazz, @Nullable List<T> customEnumList,
+            boolean inverted) {
+        HomekitTaggedItem item = getCharacteristic(characteristicType).get();
+        return HomekitCharacteristicFactory.createMapping(item, klazz, customEnumList, inverted);
     }
 
     /**
index 0d3f233d35d8ab9caf748ab11358cf0e3299932e..1b34a93d196ca4adbdfd1f0a92f0805f1afb6ebc 100644 (file)
@@ -16,7 +16,6 @@ import static org.openhab.io.homekit.internal.HomekitCharacteristicType.CURRENT_
 import static org.openhab.io.homekit.internal.HomekitCharacteristicType.POSITION_STATE;
 import static org.openhab.io.homekit.internal.HomekitCharacteristicType.TARGET_POSITION;
 
-import java.util.EnumMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -68,11 +67,7 @@ abstract class AbstractHomekitPositionAccessoryImpl extends AbstractHomekitAcces
                 false);
         closedPosition = inverted ? 0 : 100;
         openPosition = inverted ? 100 : 0;
-        positionStateMapping = new EnumMap<>(PositionStateEnum.class);
-        positionStateMapping.put(PositionStateEnum.DECREASING, "DECREASING");
-        positionStateMapping.put(PositionStateEnum.INCREASING, "INCREASING");
-        positionStateMapping.put(PositionStateEnum.STOPPED, "STOPPED");
-        updateMapping(POSITION_STATE, positionStateMapping);
+        positionStateMapping = createMapping(POSITION_STATE, PositionStateEnum.class);
     }
 
     public CompletableFuture<Integer> getCurrentPosition() {
index 90f59be408bbe07f993555fa03f38f7fc7129dda..6746cf1a4ff5565c9342535b1600869e85e43387 100644 (file)
@@ -14,7 +14,6 @@ package org.openhab.io.homekit.internal.accessories;
 
 import static org.openhab.io.homekit.internal.HomekitCharacteristicType.AIR_QUALITY;
 
-import java.util.EnumMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.CompletableFuture;
@@ -34,22 +33,12 @@ import io.github.hapjava.services.impl.AirQualityService;
  * @author Eugen Freiter - Initial contribution
  */
 public class HomekitAirQualitySensorImpl extends AbstractHomekitAccessoryImpl implements AirQualityAccessory {
-    private final Map<AirQualityEnum, String> qualityStateMapping = new EnumMap<AirQualityEnum, String>(
-            AirQualityEnum.class) {
-        {
-            put(AirQualityEnum.UNKNOWN, "UNKNOWN");
-            put(AirQualityEnum.EXCELLENT, "EXCELLENT");
-            put(AirQualityEnum.GOOD, "GOOD");
-            put(AirQualityEnum.FAIR, "FAIR");
-            put(AirQualityEnum.INFERIOR, "INFERIOR");
-            put(AirQualityEnum.POOR, "POOR");
-        }
-    };
+    private final Map<AirQualityEnum, String> qualityStateMapping;
 
     public HomekitAirQualitySensorImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException {
         super(taggedItem, mandatoryCharacteristics, updater, settings);
-        updateMapping(AIR_QUALITY, qualityStateMapping);
+        qualityStateMapping = createMapping(AIR_QUALITY, AirQualityEnum.class);
         getServices().add(new AirQualityService(this));
     }
 
index 45ec2ffe8232e8a7a42204395f024f88c6b0ab6d..21ef5ee050286bd087a4978c6096cdb931a02207 100644 (file)
@@ -15,6 +15,7 @@ package org.openhab.io.homekit.internal.accessories;
 import static org.openhab.io.homekit.internal.HomekitCharacteristicType.CARBON_DIOXIDE_DETECTED_STATE;
 
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
 import org.openhab.io.homekit.internal.HomekitAccessoryUpdater;
@@ -32,21 +33,20 @@ import io.github.hapjava.services.impl.CarbonDioxideSensorService;
  */
 public class HomekitCarbonDioxideSensorImpl extends AbstractHomekitAccessoryImpl
         implements CarbonDioxideSensorAccessory {
-    private final BooleanItemReader carbonDioxideDetectedReader;
+    private final Map<CarbonDioxideDetectedEnum, String> mapping;
 
     public HomekitCarbonDioxideSensorImpl(HomekitTaggedItem taggedItem,
             List<HomekitTaggedItem> mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings)
             throws IncompleteAccessoryException {
         super(taggedItem, mandatoryCharacteristics, updater, settings);
-        carbonDioxideDetectedReader = createBooleanReader(CARBON_DIOXIDE_DETECTED_STATE);
+        mapping = createMapping(CARBON_DIOXIDE_DETECTED_STATE, CarbonDioxideDetectedEnum.class);
         getServices().add(new CarbonDioxideSensorService(this));
     }
 
     @Override
     public CompletableFuture<CarbonDioxideDetectedEnum> getCarbonDioxideDetectedState() {
-        return CompletableFuture
-                .completedFuture(carbonDioxideDetectedReader.getValue() ? CarbonDioxideDetectedEnum.ABNORMAL
-                        : CarbonDioxideDetectedEnum.NORMAL);
+        return CompletableFuture.completedFuture(
+                getKeyFromMapping(CARBON_DIOXIDE_DETECTED_STATE, mapping, CarbonDioxideDetectedEnum.NORMAL));
     }
 
     @Override
index 2e34e5ef8f002e2b6b58fee7a76eab5fad6163b4..44432a47120f7e9f9e6eff5c8a0ab8b68ad230f3 100644 (file)
@@ -15,6 +15,7 @@ package org.openhab.io.homekit.internal.accessories;
 import static org.openhab.io.homekit.internal.HomekitCharacteristicType.CARBON_MONOXIDE_DETECTED_STATE;
 
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
 import org.openhab.io.homekit.internal.HomekitAccessoryUpdater;
@@ -32,21 +33,20 @@ import io.github.hapjava.services.impl.CarbonMonoxideSensorService;
  */
 public class HomekitCarbonMonoxideSensorImpl extends AbstractHomekitAccessoryImpl
         implements CarbonMonoxideSensorAccessory {
-    private final BooleanItemReader carbonMonoxideDetectedReader;
+    private final Map<CarbonMonoxideDetectedEnum, String> mapping;
 
     public HomekitCarbonMonoxideSensorImpl(HomekitTaggedItem taggedItem,
             List<HomekitTaggedItem> mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings)
             throws IncompleteAccessoryException {
         super(taggedItem, mandatoryCharacteristics, updater, settings);
-        carbonMonoxideDetectedReader = createBooleanReader(CARBON_MONOXIDE_DETECTED_STATE);
+        mapping = createMapping(CARBON_MONOXIDE_DETECTED_STATE, CarbonMonoxideDetectedEnum.class);
         getServices().add(new CarbonMonoxideSensorService(this));
     }
 
     @Override
     public CompletableFuture<CarbonMonoxideDetectedEnum> getCarbonMonoxideDetectedState() {
-        return CompletableFuture
-                .completedFuture(carbonMonoxideDetectedReader.getValue() ? CarbonMonoxideDetectedEnum.ABNORMAL
-                        : CarbonMonoxideDetectedEnum.NORMAL);
+        return CompletableFuture.completedFuture(
+                getKeyFromMapping(CARBON_MONOXIDE_DETECTED_STATE, mapping, CarbonMonoxideDetectedEnum.NORMAL));
     }
 
     @Override
index 6216f3a9092e9b34a9eb369ebb44f5cfb297814a..c2389e840b6e7b5bff4dfe0f1ddc5a0196ac00b9 100644 (file)
@@ -20,6 +20,7 @@ import java.util.EnumMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.concurrent.CompletableFuture;
 import java.util.function.BiFunction;
 import java.util.function.Consumer;
@@ -260,42 +261,86 @@ public class HomekitCharacteristicFactory {
                 "Unsupported optional characteristic. Characteristic type \"" + type.getTag() + "\"");
     }
 
-    public static <T extends Enum<T>> Map<T, String> createMapping(HomekitTaggedItem item, Class<T> klazz) {
+    /**
+     * Create an EnumMap for a particular CharacteristicEnum.
+     * 
+     * By default, the map will simply be from the Enum value to the string version of its value.
+     * If the item is a Number item, though, the values will the be underlying integer code
+     * for the item, as a String.
+     * Then the item's metadata will be inspected, applying any custom mappings.
+     * Finally, if customEnumList is supplied, it will be filled out with those mappings
+     * that are actually referenced in the metadata.
+     * 
+     * @param item
+     * @param klazz The HAP-Java Enum for the characteristic.
+     * @param customEnumList Optional output list of which enums are explicitly mentioned.
+     * @param inverted Default-invert the 0/1 values of the HAP enum when linked to a Switch or Contact item.
+     *            This is set by the addon when creating mappings for specific characteristics where the 0 and 1
+     *            values for the enum do not map naturally to 0/OFF/CLOSED and 1/ON/OPEN of openHAB items.
+     *            Note that this is separate from the inverted item-level metadata configuration, which can be
+     *            thought of independently as applying on top of this setting. It essentially "multiplies" out,
+     *            but can also be thought of as simply swapping whichever value OFF/CLOSED and ON/OPEN are
+     *            associated with, which has already been set.
+     * @return
+     */
+    public static <T extends Enum<T> & CharacteristicEnum> Map<T, String> createMapping(HomekitTaggedItem item,
+            Class<T> klazz, @Nullable List<T> customEnumList, boolean inverted) {
         EnumMap<T, String> map = new EnumMap(klazz);
+        var dataTypes = item.getBaseItem().getAcceptedDataTypes();
+        boolean switchType = dataTypes.contains(OnOffType.class);
+        boolean contactType = dataTypes.contains(OpenClosedType.class);
+        boolean percentType = dataTypes.contains(PercentType.class);
+        boolean numberType = dataTypes.contains(DecimalType.class) || percentType || switchType || contactType;
+
+        if (item.isInverted()) {
+            inverted = !inverted;
+        }
+        String onValue = switchType ? OnOffType.ON.toString() : OpenClosedType.OPEN.toString();
+        String offValue = switchType ? OnOffType.OFF.toString() : OpenClosedType.CLOSED.toString();
+
         for (var k : klazz.getEnumConstants()) {
-            map.put(k, k.toString());
+            if (numberType) {
+                int code = k.getCode();
+                if ((switchType || contactType) && code == 0) {
+                    map.put(k, inverted ? onValue : offValue);
+                } else if ((switchType || contactType) && code == 1) {
+                    map.put(k, inverted ? offValue : onValue);
+                } else if (percentType && code == 0) {
+                    map.put(k, "OFF");
+                } else if (percentType && code == 1) {
+                    map.put(k, "ON");
+                } else {
+                    map.put(k, Integer.toString(code));
+                }
+            } else {
+                map.put(k, k.toString());
+            }
         }
         var configuration = item.getConfiguration();
         if (configuration != null) {
-            updateMapping(configuration, map);
+            map.forEach((k, current_value) -> {
+                final Object newValue = configuration.get(k.toString());
+                if (newValue instanceof String || newValue instanceof Number) {
+                    map.put(k, newValue.toString());
+                    if (customEnumList != null) {
+                        customEnumList.add(k);
+                    }
+                }
+            });
         }
+        logger.debug("Created {} mapping for item {} ({}): {}", klazz.getSimpleName(), item.getName(),
+                item.getBaseItem().getClass().getSimpleName(), map);
         return map;
     }
 
-    /**
-     * Update mapping with values from item configuration.
-     * It checks for all keys from the mapping whether there is configuration at item with the same key and if yes,
-     * replace the value.
-     *
-     * @param configuration tagged item configuration
-     * @param map mapping to update
-     * @param customEnumList list to store custom state enumeration
-     */
-    public static <T> void updateMapping(Map<String, Object> configuration, Map<T, String> map,
-            @Nullable List<T> customEnumList) {
-        map.forEach((k, current_value) -> {
-            final Object new_value = configuration.get(k.toString());
-            if (new_value instanceof String) {
-                map.put(k, (String) new_value);
-                if (customEnumList != null) {
-                    customEnumList.add(k);
-                }
-            }
-        });
+    public static <T extends Enum<T> & CharacteristicEnum> Map<T, String> createMapping(HomekitTaggedItem item,
+            Class<T> klazz) {
+        return createMapping(item, klazz, null, false);
     }
 
-    public static <T> void updateMapping(Map<String, Object> configuration, Map<T, String> map) {
-        updateMapping(configuration, map, null);
+    public static <T extends Enum<T> & CharacteristicEnum> Map<T, String> createMapping(HomekitTaggedItem item,
+            Class<T> klazz, boolean inverted) {
+        return createMapping(item, klazz, null, inverted);
     }
 
     /**
@@ -312,17 +357,34 @@ public class HomekitCharacteristicFactory {
         final State state = item.getItem().getState();
         logger.trace("getKeyFromMapping: characteristic {}, state {}, mapping {}", item.getAccessoryType().getTag(),
                 state, mapping);
-        if (state instanceof StringType) {
-            return mapping.entrySet().stream().filter(entry -> state.toString().equalsIgnoreCase(entry.getValue()))
-                    .findAny().map(Map.Entry::getKey).orElseGet(() -> {
-                        logger.warn(
-                                "Wrong value {} for {} characteristic of the item {}. Expected one of following {}. Returning {}.",
-                                state.toString(), item.getAccessoryType().getTag(), item.getName(), mapping.values(),
-                                defaultValue);
-                        return defaultValue;
-                    });
+
+        String value;
+        if (state instanceof UnDefType) {
+            return defaultValue;
+        } else if (state instanceof StringType || state instanceof OnOffType || state instanceof OpenClosedType) {
+            value = state.toString();
+        } else if (state.getClass().equals(PercentType.class)) {
+            // We specifically want PercentType, but _not_ HSBType, so don't use instanceof
+            value = state.as(OnOffType.class).toString();
+        } else if (state.getClass().equals(DecimalType.class)) {
+            // We specifically want DecimalType, but _not_ PercentType or HSBType, so don't use instanceof
+            value = Integer.toString(((DecimalType) state).intValue());
+        } else {
+            logger.warn(
+                    "Wrong value type {} ({}) for {} characteristic of the item {}. Expected StringItem, NumberItem, or SwitchItem.",
+                    state.toString(), state.getClass().getSimpleName(), item.getAccessoryType().getTag(),
+                    item.getName());
+            return defaultValue;
         }
-        return defaultValue;
+
+        return mapping.entrySet().stream().filter(entry -> value.equalsIgnoreCase(entry.getValue())).findAny()
+                .map(Map.Entry::getKey).orElseGet(() -> {
+                    logger.warn(
+                            "Wrong value {} for {} characteristic of the item {}. Expected one of following {}. Returning {}.",
+                            state.toString(), item.getAccessoryType().getTag(), item.getName(), mapping.values(),
+                            defaultValue);
+                    return defaultValue;
+                });
     }
 
     // METHODS TO CREATE SINGLE CHARACTERISTIC FROM OH ITEM
@@ -339,47 +401,13 @@ public class HomekitCharacteristicFactory {
         return CompletableFuture.completedFuture(getKeyFromMapping(item, mapping, defaultValue));
     }
 
-    private static <T extends CharacteristicEnum> CompletableFuture<T> getEnumFromItem(HomekitTaggedItem item,
-            T offEnum, T onEnum, T defaultEnum) {
-        final State state = item.getItem().getState();
-        if (state instanceof OnOffType) {
-            return CompletableFuture
-                    .completedFuture(state.equals(item.isInverted() ? OnOffType.ON : OnOffType.OFF) ? offEnum : onEnum);
-        } else if (state instanceof OpenClosedType) {
-            return CompletableFuture.completedFuture(
-                    state.equals(item.isInverted() ? OpenClosedType.OPEN : OpenClosedType.CLOSED) ? offEnum : onEnum);
-        } else if (state instanceof DecimalType) {
-            return CompletableFuture.completedFuture(((DecimalType) state).intValue() == 0 ? offEnum : onEnum);
-        } else if (state instanceof UnDefType) {
-            return CompletableFuture.completedFuture(defaultEnum);
-        }
-        logger.warn(
-                "Item state {} is not supported. Only OnOffType,OpenClosedType and Decimal (0/1) are supported. Ignore item {}",
-                state, item.getName());
-        return CompletableFuture.completedFuture(defaultEnum);
-    }
-
-    private static <T extends Enum<T>> void setValueFromEnum(HomekitTaggedItem taggedItem, T value,
-            Map<T, String> map) {
-        taggedItem.send(new StringType(map.get(value)));
-    }
-
-    private static void setValueFromEnum(HomekitTaggedItem taggedItem, CharacteristicEnum value,
-            CharacteristicEnum offEnum, CharacteristicEnum onEnum) {
-        if (taggedItem.getBaseItem() instanceof SwitchItem) {
-            if (value.equals(offEnum)) {
-                taggedItem.send(taggedItem.isInverted() ? OnOffType.ON : OnOffType.OFF);
-            } else if (value.equals(onEnum)) {
-                taggedItem.send(taggedItem.isInverted() ? OnOffType.OFF : OnOffType.ON);
-            } else {
-                logger.warn("Enum value {} is not supported for {}. Only following values are supported: {},{}", value,
-                        taggedItem.getName(), offEnum, onEnum);
-            }
-        } else if (taggedItem.getBaseItem() instanceof NumberItem) {
-            taggedItem.send(new DecimalType(value.getCode()));
+    public static <T extends Enum<T>> void setValueFromEnum(HomekitTaggedItem taggedItem, T value, Map<T, String> map) {
+        if (taggedItem.getBaseItem() instanceof NumberItem) {
+            taggedItem.send(new DecimalType(Objects.requireNonNull(map.get(value))));
+        } else if (taggedItem.getBaseItem() instanceof SwitchItem) {
+            taggedItem.send(OnOffType.from(Objects.requireNonNull(map.get(value))));
         } else {
-            logger.warn("Item {} of type {} is not supported. Only Switch and Number item types are supported.",
-                    taggedItem.getName(), taggedItem.getBaseItem().getType());
+            taggedItem.send(new StringType(map.get(value)));
         }
     }
 
@@ -568,17 +596,15 @@ public class HomekitCharacteristicFactory {
 
     private static StatusFaultCharacteristic createStatusFaultCharacteristic(HomekitTaggedItem taggedItem,
             HomekitAccessoryUpdater updater) {
-        return new StatusFaultCharacteristic(
-                () -> getEnumFromItem(taggedItem, StatusFaultEnum.NO_FAULT, StatusFaultEnum.GENERAL_FAULT,
-                        StatusFaultEnum.NO_FAULT),
+        var map = createMapping(taggedItem, StatusFaultEnum.class);
+        return new StatusFaultCharacteristic(() -> getEnumFromItem(taggedItem, map, StatusFaultEnum.NO_FAULT),
                 getSubscriber(taggedItem, FAULT_STATUS, updater), getUnsubscriber(taggedItem, FAULT_STATUS, updater));
     }
 
     private static StatusTamperedCharacteristic createStatusTamperedCharacteristic(HomekitTaggedItem taggedItem,
             HomekitAccessoryUpdater updater) {
-        return new StatusTamperedCharacteristic(
-                () -> getEnumFromItem(taggedItem, StatusTamperedEnum.NOT_TAMPERED, StatusTamperedEnum.TAMPERED,
-                        StatusTamperedEnum.NOT_TAMPERED),
+        var map = createMapping(taggedItem, StatusTamperedEnum.class);
+        return new StatusTamperedCharacteristic(() -> getEnumFromItem(taggedItem, map, StatusTamperedEnum.NOT_TAMPERED),
                 getSubscriber(taggedItem, TAMPERED_STATUS, updater),
                 getUnsubscriber(taggedItem, TAMPERED_STATUS, updater));
     }
@@ -840,59 +866,46 @@ public class HomekitCharacteristicFactory {
 
     private static CurrentFanStateCharacteristic createCurrentFanStateCharacteristic(HomekitTaggedItem taggedItem,
             HomekitAccessoryUpdater updater) {
-        return new CurrentFanStateCharacteristic(() -> {
-            final @Nullable DecimalType value = taggedItem.getItem().getStateAs(DecimalType.class);
-            @Nullable
-            CurrentFanStateEnum currentFanStateEnum = value != null ? CurrentFanStateEnum.fromCode(value.intValue())
-                    : null;
-            if (currentFanStateEnum == null) {
-                currentFanStateEnum = CurrentFanStateEnum.INACTIVE;
-            }
-            return CompletableFuture.completedFuture(currentFanStateEnum);
-        }, getSubscriber(taggedItem, CURRENT_FAN_STATE, updater),
+        var map = createMapping(taggedItem, CurrentFanStateEnum.class);
+        return new CurrentFanStateCharacteristic(() -> getEnumFromItem(taggedItem, map, CurrentFanStateEnum.INACTIVE),
+                getSubscriber(taggedItem, CURRENT_FAN_STATE, updater),
                 getUnsubscriber(taggedItem, CURRENT_FAN_STATE, updater));
     }
 
     private static TargetFanStateCharacteristic createTargetFanStateCharacteristic(HomekitTaggedItem taggedItem,
             HomekitAccessoryUpdater updater) {
-        return new TargetFanStateCharacteristic(
-                () -> getEnumFromItem(taggedItem, TargetFanStateEnum.MANUAL, TargetFanStateEnum.AUTO,
-                        TargetFanStateEnum.AUTO),
-                (targetState) -> setValueFromEnum(taggedItem, targetState, TargetFanStateEnum.MANUAL,
-                        TargetFanStateEnum.AUTO),
+        var map = createMapping(taggedItem, TargetFanStateEnum.class);
+        return new TargetFanStateCharacteristic(() -> getEnumFromItem(taggedItem, map, TargetFanStateEnum.AUTO),
+                (targetState) -> setValueFromEnum(taggedItem, targetState, map),
                 getSubscriber(taggedItem, TARGET_FAN_STATE, updater),
                 getUnsubscriber(taggedItem, TARGET_FAN_STATE, updater));
     }
 
     private static RotationDirectionCharacteristic createRotationDirectionCharacteristic(HomekitTaggedItem taggedItem,
             HomekitAccessoryUpdater updater) {
+        var map = createMapping(taggedItem, RotationDirectionEnum.class);
         return new RotationDirectionCharacteristic(
-                () -> getEnumFromItem(taggedItem, RotationDirectionEnum.CLOCKWISE,
-                        RotationDirectionEnum.COUNTER_CLOCKWISE, RotationDirectionEnum.CLOCKWISE),
-                (value) -> setValueFromEnum(taggedItem, value, RotationDirectionEnum.CLOCKWISE,
-                        RotationDirectionEnum.COUNTER_CLOCKWISE),
+                () -> getEnumFromItem(taggedItem, map, RotationDirectionEnum.CLOCKWISE),
+                (value) -> setValueFromEnum(taggedItem, value, map),
                 getSubscriber(taggedItem, ROTATION_DIRECTION, updater),
                 getUnsubscriber(taggedItem, ROTATION_DIRECTION, updater));
     }
 
     private static SwingModeCharacteristic createSwingModeCharacteristic(HomekitTaggedItem taggedItem,
             HomekitAccessoryUpdater updater) {
-        return new SwingModeCharacteristic(
-                () -> getEnumFromItem(taggedItem, SwingModeEnum.SWING_DISABLED, SwingModeEnum.SWING_ENABLED,
-                        SwingModeEnum.SWING_DISABLED),
-                (value) -> setValueFromEnum(taggedItem, value, SwingModeEnum.SWING_DISABLED,
-                        SwingModeEnum.SWING_ENABLED),
-                getSubscriber(taggedItem, SWING_MODE, updater), getUnsubscriber(taggedItem, SWING_MODE, updater));
+        var map = createMapping(taggedItem, SwingModeEnum.class);
+        return new SwingModeCharacteristic(() -> getEnumFromItem(taggedItem, map, SwingModeEnum.SWING_DISABLED),
+                (value) -> setValueFromEnum(taggedItem, value, map), getSubscriber(taggedItem, SWING_MODE, updater),
+                getUnsubscriber(taggedItem, SWING_MODE, updater));
     }
 
     private static LockPhysicalControlsCharacteristic createLockPhysicalControlsCharacteristic(
             HomekitTaggedItem taggedItem, HomekitAccessoryUpdater updater) {
+        var map = createMapping(taggedItem, LockPhysicalControlsEnum.class);
         return new LockPhysicalControlsCharacteristic(
-                () -> getEnumFromItem(taggedItem, LockPhysicalControlsEnum.CONTROL_LOCK_DISABLED,
-                        LockPhysicalControlsEnum.CONTROL_LOCK_ENABLED, LockPhysicalControlsEnum.CONTROL_LOCK_DISABLED),
-                (value) -> setValueFromEnum(taggedItem, value, LockPhysicalControlsEnum.CONTROL_LOCK_DISABLED,
-                        LockPhysicalControlsEnum.CONTROL_LOCK_ENABLED),
-                getSubscriber(taggedItem, LOCK_CONTROL, updater), getUnsubscriber(taggedItem, LOCK_CONTROL, updater));
+                () -> getEnumFromItem(taggedItem, map, LockPhysicalControlsEnum.CONTROL_LOCK_DISABLED),
+                (value) -> setValueFromEnum(taggedItem, value, map), getSubscriber(taggedItem, LOCK_CONTROL, updater),
+                getUnsubscriber(taggedItem, LOCK_CONTROL, updater));
     }
 
     private static RotationSpeedCharacteristic createRotationSpeedCharacteristic(HomekitTaggedItem item,
@@ -1049,10 +1062,10 @@ public class HomekitCharacteristicFactory {
 
     private static ActiveCharacteristic createActiveCharacteristic(HomekitTaggedItem taggedItem,
             HomekitAccessoryUpdater updater) {
-        return new ActiveCharacteristic(
-                () -> getEnumFromItem(taggedItem, ActiveEnum.INACTIVE, ActiveEnum.ACTIVE, ActiveEnum.INACTIVE),
-                (value) -> setValueFromEnum(taggedItem, value, ActiveEnum.INACTIVE, ActiveEnum.ACTIVE),
-                getSubscriber(taggedItem, ACTIVE, updater), getUnsubscriber(taggedItem, ACTIVE, updater));
+        var map = createMapping(taggedItem, ActiveEnum.class, false);
+        return new ActiveCharacteristic(() -> getEnumFromItem(taggedItem, map, ActiveEnum.INACTIVE),
+                (value) -> setValueFromEnum(taggedItem, value, map), getSubscriber(taggedItem, ACTIVE, updater),
+                getUnsubscriber(taggedItem, ACTIVE, updater));
     }
 
     private static ConfiguredNameCharacteristic createConfiguredNameCharacteristic(HomekitTaggedItem taggedItem,
@@ -1081,25 +1094,24 @@ public class HomekitCharacteristicFactory {
 
     private static SleepDiscoveryModeCharacteristic createSleepDiscoveryModeCharacteristic(HomekitTaggedItem taggedItem,
             HomekitAccessoryUpdater updater) {
+        var map = createMapping(taggedItem, SleepDiscoveryModeEnum.class);
         return new SleepDiscoveryModeCharacteristic(
-                () -> getEnumFromItem(taggedItem, SleepDiscoveryModeEnum.NOT_DISCOVERABLE,
-                        SleepDiscoveryModeEnum.ALWAYS_DISCOVERABLE, SleepDiscoveryModeEnum.ALWAYS_DISCOVERABLE),
+                () -> getEnumFromItem(taggedItem, map, SleepDiscoveryModeEnum.ALWAYS_DISCOVERABLE),
                 getSubscriber(taggedItem, SLEEP_DISCOVERY_MODE, updater),
                 getUnsubscriber(taggedItem, SLEEP_DISCOVERY_MODE, updater));
     }
 
     private static PowerModeCharacteristic createPowerModeCharacteristic(HomekitTaggedItem taggedItem,
             HomekitAccessoryUpdater updater) {
-        return new PowerModeCharacteristic(
-                (value) -> setValueFromEnum(taggedItem, value, PowerModeEnum.HIDE, PowerModeEnum.SHOW));
+        var map = createMapping(taggedItem, PowerModeEnum.class, true);
+        return new PowerModeCharacteristic((value) -> setValueFromEnum(taggedItem, value, map));
     }
 
     private static ClosedCaptionsCharacteristic createClosedCaptionsCharacteristic(HomekitTaggedItem taggedItem,
             HomekitAccessoryUpdater updater) {
-        return new ClosedCaptionsCharacteristic(
-                () -> getEnumFromItem(taggedItem, ClosedCaptionsEnum.DISABLED, ClosedCaptionsEnum.ENABLED,
-                        ClosedCaptionsEnum.DISABLED),
-                (value) -> setValueFromEnum(taggedItem, value, ClosedCaptionsEnum.DISABLED, ClosedCaptionsEnum.ENABLED),
+        var map = createMapping(taggedItem, ClosedCaptionsEnum.class);
+        return new ClosedCaptionsCharacteristic(() -> getEnumFromItem(taggedItem, map, ClosedCaptionsEnum.DISABLED),
+                (value) -> setValueFromEnum(taggedItem, value, map),
                 getSubscriber(taggedItem, CLOSED_CAPTIONS, updater),
                 getUnsubscriber(taggedItem, CLOSED_CAPTIONS, updater));
     }
@@ -1114,12 +1126,10 @@ public class HomekitCharacteristicFactory {
 
     private static IsConfiguredCharacteristic createIsConfiguredCharacteristic(HomekitTaggedItem taggedItem,
             HomekitAccessoryUpdater updater) {
-        return new IsConfiguredCharacteristic(
-                () -> getEnumFromItem(taggedItem, IsConfiguredEnum.NOT_CONFIGURED, IsConfiguredEnum.CONFIGURED,
-                        IsConfiguredEnum.NOT_CONFIGURED),
-                (value) -> setValueFromEnum(taggedItem, value, IsConfiguredEnum.NOT_CONFIGURED,
-                        IsConfiguredEnum.CONFIGURED),
-                getSubscriber(taggedItem, CONFIGURED, updater), getUnsubscriber(taggedItem, CONFIGURED, updater));
+        var map = createMapping(taggedItem, IsConfiguredEnum.class);
+        return new IsConfiguredCharacteristic(() -> getEnumFromItem(taggedItem, map, IsConfiguredEnum.NOT_CONFIGURED),
+                (value) -> setValueFromEnum(taggedItem, value, map), getSubscriber(taggedItem, CONFIGURED, updater),
+                getUnsubscriber(taggedItem, CONFIGURED, updater));
     }
 
     private static InputSourceTypeCharacteristic createInputSourceTypeCharacteristic(HomekitTaggedItem taggedItem,
@@ -1132,9 +1142,9 @@ public class HomekitCharacteristicFactory {
 
     private static CurrentVisibilityStateCharacteristic createCurrentVisibilityStateCharacteristic(
             HomekitTaggedItem taggedItem, HomekitAccessoryUpdater updater) {
+        var map = createMapping(taggedItem, CurrentVisibilityStateEnum.class, true);
         return new CurrentVisibilityStateCharacteristic(
-                () -> getEnumFromItem(taggedItem, CurrentVisibilityStateEnum.HIDDEN, CurrentVisibilityStateEnum.SHOWN,
-                        CurrentVisibilityStateEnum.HIDDEN),
+                () -> getEnumFromItem(taggedItem, map, CurrentVisibilityStateEnum.HIDDEN),
                 getSubscriber(taggedItem, CURRENT_VISIBILITY, updater),
                 getUnsubscriber(taggedItem, CURRENT_VISIBILITY, updater));
     }
@@ -1146,19 +1156,18 @@ public class HomekitCharacteristicFactory {
 
     private static InputDeviceTypeCharacteristic createInputDeviceTypeCharacteristic(HomekitTaggedItem taggedItem,
             HomekitAccessoryUpdater updater) {
-        var mapping = createMapping(taggedItem, InputDeviceTypeEnum.class);
-        return new InputDeviceTypeCharacteristic(() -> getEnumFromItem(taggedItem, mapping, InputDeviceTypeEnum.OTHER),
+        var map = createMapping(taggedItem, InputDeviceTypeEnum.class);
+        return new InputDeviceTypeCharacteristic(() -> getEnumFromItem(taggedItem, map, InputDeviceTypeEnum.OTHER),
                 getSubscriber(taggedItem, INPUT_DEVICE_TYPE, updater),
                 getUnsubscriber(taggedItem, INPUT_DEVICE_TYPE, updater));
     }
 
     private static TargetVisibilityStateCharacteristic createTargetVisibilityStateCharacteristic(
             HomekitTaggedItem taggedItem, HomekitAccessoryUpdater updater) {
+        var map = createMapping(taggedItem, TargetVisibilityStateEnum.class, true);
         return new TargetVisibilityStateCharacteristic(
-                () -> getEnumFromItem(taggedItem, TargetVisibilityStateEnum.HIDDEN, TargetVisibilityStateEnum.SHOWN,
-                        TargetVisibilityStateEnum.HIDDEN),
-                (value) -> setValueFromEnum(taggedItem, value, TargetVisibilityStateEnum.HIDDEN,
-                        TargetVisibilityStateEnum.SHOWN),
+                () -> getEnumFromItem(taggedItem, map, TargetVisibilityStateEnum.HIDDEN),
+                (value) -> setValueFromEnum(taggedItem, value, map),
                 getSubscriber(taggedItem, TARGET_VISIBILITY_STATE, updater),
                 getUnsubscriber(taggedItem, TARGET_VISIBILITY_STATE, updater));
     }
index 22d1d7d023fe2fa41a558b3751a3fa2437d5556f..c5ded729a94049ac0653ee0473a8ce55d504292f 100644 (file)
@@ -15,6 +15,7 @@ package org.openhab.io.homekit.internal.accessories;
 import static org.openhab.io.homekit.internal.HomekitCharacteristicType.CONTACT_SENSOR_STATE;
 
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
 import org.openhab.io.homekit.internal.HomekitAccessoryUpdater;
@@ -31,19 +32,19 @@ import io.github.hapjava.services.impl.ContactSensorService;
  * @author Philipp Arndt - Initial contribution
  */
 public class HomekitContactSensorImpl extends AbstractHomekitAccessoryImpl implements ContactSensorAccessory {
-    private final BooleanItemReader contactSensedReader;
+    private final Map<ContactStateEnum, String> mapping;
 
     public HomekitContactSensorImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException {
         super(taggedItem, mandatoryCharacteristics, updater, settings);
-        contactSensedReader = createBooleanReader(CONTACT_SENSOR_STATE);
+        mapping = createMapping(CONTACT_SENSOR_STATE, ContactStateEnum.class);
         getServices().add(new ContactSensorService(this));
     }
 
     @Override
     public CompletableFuture<ContactStateEnum> getCurrentState() {
-        return CompletableFuture.completedFuture(
-                contactSensedReader.getValue() ? ContactStateEnum.NOT_DETECTED : ContactStateEnum.DETECTED);
+        return CompletableFuture
+                .completedFuture(getKeyFromMapping(CONTACT_SENSOR_STATE, mapping, ContactStateEnum.DETECTED));
     }
 
     @Override
index 20becbaadfb61bf91b4768e106e24c765375d1ee..4bb960254d97516a8fcf115ba4a9d6e3199b1070 100644 (file)
@@ -15,6 +15,7 @@ package org.openhab.io.homekit.internal.accessories;
 import static org.openhab.io.homekit.internal.HomekitCharacteristicType.FILTER_CHANGE_INDICATION;
 
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
 import org.openhab.io.homekit.internal.HomekitAccessoryUpdater;
@@ -32,20 +33,19 @@ import io.github.hapjava.services.impl.FilterMaintenanceService;
  * @author Eugen Freiter - Initial contribution
  */
 public class HomekitFilterMaintenanceImpl extends AbstractHomekitAccessoryImpl implements FilterMaintenanceAccessory {
-    private BooleanItemReader filterChangeIndication;
+    private final Map<FilterChangeIndicationEnum, String> mapping;
 
     public HomekitFilterMaintenanceImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException {
         super(taggedItem, mandatoryCharacteristics, updater, settings);
-        filterChangeIndication = createBooleanReader(FILTER_CHANGE_INDICATION);
+        mapping = createMapping(FILTER_CHANGE_INDICATION, FilterChangeIndicationEnum.class);
         getServices().add(new FilterMaintenanceService(this));
     }
 
     @Override
     public CompletableFuture<FilterChangeIndicationEnum> getFilterChangeIndication() {
-        return CompletableFuture
-                .completedFuture(filterChangeIndication.getValue() ? FilterChangeIndicationEnum.CHANGE_NEEDED
-                        : FilterChangeIndicationEnum.NO_CHANGE_NEEDED);
+        return CompletableFuture.completedFuture(
+                getKeyFromMapping(FILTER_CHANGE_INDICATION, mapping, FilterChangeIndicationEnum.NO_CHANGE_NEEDED));
     }
 
     @Override
index 49ad294b4e1630a37aa61a371b22dd952e531a8a..5ffe086a594a522a95a84a26347e1b80bf733fd7 100644 (file)
@@ -17,16 +17,10 @@ import static org.openhab.io.homekit.internal.HomekitCharacteristicType.OBSTRUCT
 import static org.openhab.io.homekit.internal.HomekitCharacteristicType.TARGET_DOOR_STATE;
 
 import java.util.List;
-import java.util.Optional;
+import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
-import org.openhab.core.items.Item;
-import org.openhab.core.library.items.StringItem;
-import org.openhab.core.library.items.SwitchItem;
-import org.openhab.core.library.types.OnOffType;
-import org.openhab.core.library.types.StringType;
 import org.openhab.io.homekit.internal.HomekitAccessoryUpdater;
-import org.openhab.io.homekit.internal.HomekitOHItemProxy;
 import org.openhab.io.homekit.internal.HomekitSettings;
 import org.openhab.io.homekit.internal.HomekitTaggedItem;
 import org.slf4j.Logger;
@@ -46,83 +40,29 @@ import io.github.hapjava.services.impl.GarageDoorOpenerService;
 public class HomekitGarageDoorOpenerImpl extends AbstractHomekitAccessoryImpl implements GarageDoorOpenerAccessory {
     private final Logger logger = LoggerFactory.getLogger(HomekitGarageDoorOpenerImpl.class);
     private final BooleanItemReader obstructionReader;
+    private final Map<CurrentDoorStateEnum, String> currentDoorStateMapping;
+    private final Map<TargetDoorStateEnum, String> targetDoorStateMapping;
 
     public HomekitGarageDoorOpenerImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException {
         super(taggedItem, mandatoryCharacteristics, updater, settings);
         obstructionReader = createBooleanReader(OBSTRUCTION_STATUS);
+        currentDoorStateMapping = createMapping(CURRENT_DOOR_STATE, CurrentDoorStateEnum.class, true);
+        targetDoorStateMapping = createMapping(TARGET_DOOR_STATE, TargetDoorStateEnum.class, true);
+
         getServices().add(new GarageDoorOpenerService(this));
     }
 
     @Override
     public CompletableFuture<CurrentDoorStateEnum> getCurrentDoorState() {
-        final Optional<HomekitTaggedItem> characteristic = getCharacteristic(CURRENT_DOOR_STATE);
-        final HomekitSettings settings = getSettings();
-        String stringValue = settings.doorCurrentStateClosed;
-        if (characteristic.isPresent()) {
-            stringValue = characteristic.get().getItem().getState().toString();
-        } else {
-            logger.warn("Missing mandatory characteristic {}", CURRENT_DOOR_STATE);
-        }
-        CurrentDoorStateEnum mode;
-
-        if (stringValue.equalsIgnoreCase(settings.doorCurrentStateClosed)) {
-            mode = CurrentDoorStateEnum.CLOSED;
-        } else if (stringValue.equalsIgnoreCase(settings.doorCurrentStateClosing)) {
-            mode = CurrentDoorStateEnum.CLOSING;
-        } else if (stringValue.equalsIgnoreCase(settings.doorCurrentStateOpen)) {
-            mode = CurrentDoorStateEnum.OPEN;
-        } else if (stringValue.equalsIgnoreCase(settings.doorCurrentStateOpening)) {
-            mode = CurrentDoorStateEnum.OPENING;
-        } else if (stringValue.equalsIgnoreCase(settings.doorCurrentStateStopped)) {
-            mode = CurrentDoorStateEnum.STOPPED;
-        } else if (stringValue.equals("UNDEF") || stringValue.equals("NULL")) {
-            logger.warn("Current door state not available. Relaying value of CLOSED to HomeKit");
-            mode = CurrentDoorStateEnum.CLOSED;
-        } else {
-            logger.warn("Unrecognized current door state: {}. Expected {}, {}, {}, {} or {} strings in value.",
-                    stringValue, settings.doorCurrentStateClosed, settings.doorCurrentStateClosing,
-                    settings.doorCurrentStateOpen, settings.doorCurrentStateOpening, settings.doorCurrentStateStopped);
-            mode = CurrentDoorStateEnum.CLOSED;
-        }
-        return CompletableFuture.completedFuture(mode);
+        return CompletableFuture.completedFuture(
+                getKeyFromMapping(CURRENT_DOOR_STATE, currentDoorStateMapping, CurrentDoorStateEnum.CLOSED));
     }
 
     @Override
     public CompletableFuture<TargetDoorStateEnum> getTargetDoorState() {
-        final Optional<HomekitTaggedItem> characteristic = getCharacteristic(TARGET_DOOR_STATE);
-        Item item;
-
-        if (characteristic.isPresent()) {
-            item = characteristic.get().getItem();
-        } else {
-            logger.warn("Missing mandatory characteristic {}", TARGET_DOOR_STATE);
-            return CompletableFuture.completedFuture(TargetDoorStateEnum.CLOSED);
-        }
-        TargetDoorStateEnum mode;
-
-        final Item baseItem = HomekitOHItemProxy.getBaseItem(item);
-        if (baseItem instanceof SwitchItem) {
-            mode = item.getState() == OnOffType.ON ? TargetDoorStateEnum.OPEN : TargetDoorStateEnum.CLOSED;
-        } else if (baseItem instanceof StringItem) {
-            final HomekitSettings settings = getSettings();
-            final String stringValue = item.getState().toString();
-            if (stringValue.equalsIgnoreCase(settings.doorTargetStateClosed)) {
-                mode = TargetDoorStateEnum.CLOSED;
-            } else if (stringValue.equalsIgnoreCase(settings.doorTargetStateOpen)) {
-                mode = TargetDoorStateEnum.OPEN;
-            } else {
-                logger.warn(
-                        "Unsupported value {} for {}. Only {} and {} supported. Check HomeKit settings if you want to change the mapping",
-                        stringValue, item.getName(), settings.doorTargetStateClosed, settings.doorTargetStateOpen);
-                mode = TargetDoorStateEnum.CLOSED;
-            }
-        } else {
-            logger.warn("Unsupported item type {} for {}. Only Switch and String are supported", baseItem.getType(),
-                    item.getName());
-            mode = TargetDoorStateEnum.CLOSED;
-        }
-        return CompletableFuture.completedFuture(mode);
+        return CompletableFuture.completedFuture(
+                getKeyFromMapping(TARGET_DOOR_STATE, targetDoorStateMapping, TargetDoorStateEnum.CLOSED));
     }
 
     @Override
@@ -132,26 +72,8 @@ public class HomekitGarageDoorOpenerImpl extends AbstractHomekitAccessoryImpl im
 
     @Override
     public CompletableFuture<Void> setTargetDoorState(TargetDoorStateEnum targetDoorStateEnum) {
-        final Optional<HomekitTaggedItem> characteristic = getCharacteristic(TARGET_DOOR_STATE);
-        final HomekitTaggedItem taggedItem;
-        if (characteristic.isPresent()) {
-            taggedItem = characteristic.get();
-        } else {
-            logger.warn("Missing mandatory characteristic {}", TARGET_DOOR_STATE);
-            return CompletableFuture.completedFuture(null);
-        }
-
-        if (taggedItem.getBaseItem() instanceof SwitchItem) {
-            taggedItem.send(OnOffType.from(targetDoorStateEnum == TargetDoorStateEnum.OPEN));
-        } else if (taggedItem.getBaseItem() instanceof StringItem) {
-            final HomekitSettings settings = getSettings();
-            taggedItem
-                    .send(new StringType(targetDoorStateEnum == TargetDoorStateEnum.OPEN ? settings.doorTargetStateOpen
-                            : settings.doorTargetStateClosed));
-        } else {
-            logger.warn("Unsupported item type {} for {}. Only Switch and String are supported",
-                    taggedItem.getBaseItem().getType(), taggedItem.getName());
-        }
+        HomekitCharacteristicFactory.setValueFromEnum(getCharacteristic(TARGET_DOOR_STATE).get(), targetDoorStateEnum,
+                targetDoorStateMapping);
         return CompletableFuture.completedFuture(null);
     }
 
index 629e816f56720bd281ec4d363c31b37d1fc0741c..dbd2a20338487184b77f5658949433b630ae6ed9 100644 (file)
@@ -18,18 +18,14 @@ import static org.openhab.io.homekit.internal.HomekitCharacteristicType.TARGET_H
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
-import java.util.EnumMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Optional;
 import java.util.concurrent.CompletableFuture;
 
 import org.eclipse.jdt.annotation.Nullable;
 import org.openhab.core.items.GenericItem;
-import org.openhab.core.library.items.StringItem;
 import org.openhab.core.library.types.OnOffType;
 import org.openhab.core.library.types.OpenClosedType;
-import org.openhab.core.library.types.StringType;
 import org.openhab.io.homekit.internal.HomekitAccessoryUpdater;
 import org.openhab.io.homekit.internal.HomekitCharacteristicType;
 import org.openhab.io.homekit.internal.HomekitSettings;
@@ -55,23 +51,8 @@ import io.github.hapjava.services.impl.HeaterCoolerService;
 public class HomekitHeaterCoolerImpl extends AbstractHomekitAccessoryImpl implements HeaterCoolerAccessory {
     private final Logger logger = LoggerFactory.getLogger(HomekitHeaterCoolerImpl.class);
     private final BooleanItemReader activeReader;
-    private final Map<CurrentHeaterCoolerStateEnum, String> currentStateMapping = new EnumMap<CurrentHeaterCoolerStateEnum, String>(
-            CurrentHeaterCoolerStateEnum.class) {
-        {
-            put(CurrentHeaterCoolerStateEnum.INACTIVE, "INACTIVE");
-            put(CurrentHeaterCoolerStateEnum.IDLE, "IDLE");
-            put(CurrentHeaterCoolerStateEnum.HEATING, "HEATING");
-            put(CurrentHeaterCoolerStateEnum.COOLING, "COOLING");
-        }
-    };
-    private final Map<TargetHeaterCoolerStateEnum, String> targetStateMapping = new EnumMap<TargetHeaterCoolerStateEnum, String>(
-            TargetHeaterCoolerStateEnum.class) {
-        {
-            put(TargetHeaterCoolerStateEnum.AUTO, "AUTO");
-            put(TargetHeaterCoolerStateEnum.HEAT, "HEAT");
-            put(TargetHeaterCoolerStateEnum.COOL, "COOL");
-        }
-    };
+    private final Map<CurrentHeaterCoolerStateEnum, String> currentStateMapping;
+    private final Map<TargetHeaterCoolerStateEnum, String> targetStateMapping;
 
     private final List<CurrentHeaterCoolerStateEnum> customCurrentStateList = new ArrayList<>();
     private final List<TargetHeaterCoolerStateEnum> customTargetStateList = new ArrayList<>();
@@ -81,8 +62,10 @@ public class HomekitHeaterCoolerImpl extends AbstractHomekitAccessoryImpl implem
         super(taggedItem, mandatoryCharacteristics, updater, settings);
         activeReader = new BooleanItemReader(getItem(ACTIVE_STATUS, GenericItem.class)
                 .orElseThrow(() -> new IncompleteAccessoryException(ACTIVE_STATUS)), OnOffType.ON, OpenClosedType.OPEN);
-        updateMapping(CURRENT_HEATER_COOLER_STATE, currentStateMapping, customCurrentStateList);
-        updateMapping(TARGET_HEATER_COOLER_STATE, targetStateMapping, customTargetStateList);
+        currentStateMapping = createMapping(CURRENT_HEATER_COOLER_STATE, CurrentHeaterCoolerStateEnum.class,
+                customCurrentStateList);
+        targetStateMapping = createMapping(TARGET_HEATER_COOLER_STATE, TargetHeaterCoolerStateEnum.class,
+                customTargetStateList);
         final HeaterCoolerService service = new HeaterCoolerService(this);
         service.addOptionalCharacteristic(new TemperatureDisplayUnitCharacteristic(this::getTemperatureDisplayUnit,
                 this::setTemperatureDisplayUnit, this::subscribeTemperatureDisplayUnit,
@@ -138,14 +121,9 @@ public class HomekitHeaterCoolerImpl extends AbstractHomekitAccessoryImpl implem
 
     @Override
     public CompletableFuture<Void> setTargetHeaterCoolerState(TargetHeaterCoolerStateEnum state) {
-        final Optional<HomekitTaggedItem> characteristic = getCharacteristic(
-                HomekitCharacteristicType.TARGET_HEATER_COOLER_STATE);
-        if (characteristic.isPresent()) {
-            ((StringItem) characteristic.get().getItem()).send(new StringType(targetStateMapping.get(state)));
-        } else {
-            logger.warn("Missing mandatory characteristic {}",
-                    HomekitCharacteristicType.TARGET_HEATING_COOLING_STATE.getTag());
-        }
+        HomekitCharacteristicFactory.setValueFromEnum(
+                getCharacteristic(HomekitCharacteristicType.TARGET_HEATER_COOLER_STATE).get(), state,
+                targetStateMapping);
         return CompletableFuture.completedFuture(null);
     }
 
index aab76fd707d5c0786353d6a39ab20cb5e6ba8a0e..0a61ab3b37a5c2d9faa4feef73ddd6e630ca019b 100644 (file)
@@ -44,14 +44,14 @@ import io.github.hapjava.services.impl.ServiceLabelService;
  */
 @NonNullByDefault({})
 public class HomekitIrrigationSystemImpl extends AbstractHomekitAccessoryImpl implements IrrigationSystemAccessory {
-    private BooleanItemReader inUseReader;
+    private Map<InUseEnum, String> inUseMapping;
     private Map<ProgramModeEnum, String> programModeMap;
     private static final String SERVICE_LABEL = "ServiceLabel";
 
     public HomekitIrrigationSystemImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException {
         super(taggedItem, mandatoryCharacteristics, updater, settings);
-        inUseReader = createBooleanReader(HomekitCharacteristicType.INUSE_STATUS);
+        inUseMapping = createMapping(HomekitCharacteristicType.INUSE_STATUS, InUseEnum.class);
         programModeMap = HomekitCharacteristicFactory
                 .createMapping(getCharacteristic(HomekitCharacteristicType.PROGRAM_MODE).get(), ProgramModeEnum.class);
         getServices().add(new IrrigationSystemService(this));
@@ -89,7 +89,8 @@ public class HomekitIrrigationSystemImpl extends AbstractHomekitAccessoryImpl im
 
     @Override
     public CompletableFuture<InUseEnum> getInUse() {
-        return CompletableFuture.completedFuture(inUseReader.getValue() ? InUseEnum.IN_USE : InUseEnum.NOT_IN_USE);
+        return CompletableFuture.completedFuture(
+                getKeyFromMapping(HomekitCharacteristicType.INUSE_STATUS, inUseMapping, InUseEnum.NOT_IN_USE));
     }
 
     @Override
index c6b07ba1da0b102b66ce42cb9b3c930322a8a3e2..8ec6bfd2ecf381c5a4ee3dcb8fdd07e83d8a5d83 100644 (file)
@@ -15,6 +15,7 @@ package org.openhab.io.homekit.internal.accessories;
 import static org.openhab.io.homekit.internal.HomekitCharacteristicType.LEAK_DETECTED_STATE;
 
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
 import org.openhab.io.homekit.internal.HomekitAccessoryUpdater;
@@ -31,19 +32,19 @@ import io.github.hapjava.services.impl.LeakSensorService;
  * @author Tim Harper - Initial contribution
  */
 public class HomekitLeakSensorImpl extends AbstractHomekitAccessoryImpl implements LeakSensorAccessory {
-    private final BooleanItemReader leakDetectedReader;
+    private final Map<LeakDetectedStateEnum, String> mapping;
 
     public HomekitLeakSensorImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException {
         super(taggedItem, mandatoryCharacteristics, updater, settings);
-        leakDetectedReader = createBooleanReader(LEAK_DETECTED_STATE);
+        mapping = createMapping(LEAK_DETECTED_STATE, LeakDetectedStateEnum.class);
         getServices().add(new LeakSensorService(this));
     }
 
     @Override
     public CompletableFuture<LeakDetectedStateEnum> getLeakDetected() {
-        return CompletableFuture.completedFuture(leakDetectedReader.getValue() ? LeakDetectedStateEnum.LEAK_DETECTED
-                : LeakDetectedStateEnum.LEAK_NOT_DETECTED);
+        return CompletableFuture.completedFuture(
+                getKeyFromMapping(LEAK_DETECTED_STATE, mapping, LeakDetectedStateEnum.LEAK_NOT_DETECTED));
     }
 
     @Override
index ae3b0e40db8976ec9116725c5df422b0e5c9a063..5f4c39d5d972eee6ca291c5d28e4e87d69545e7d 100644 (file)
 package org.openhab.io.homekit.internal.accessories;
 
 import java.util.List;
-import java.util.Optional;
+import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
-import org.eclipse.jdt.annotation.Nullable;
-import org.openhab.core.items.GenericItem;
-import org.openhab.core.library.items.SwitchItem;
-import org.openhab.core.library.types.DecimalType;
-import org.openhab.core.library.types.OnOffType;
-import org.openhab.core.types.State;
 import org.openhab.io.homekit.internal.HomekitAccessoryUpdater;
 import org.openhab.io.homekit.internal.HomekitCharacteristicType;
 import org.openhab.io.homekit.internal.HomekitSettings;
@@ -40,62 +34,34 @@ import io.github.hapjava.services.impl.LockMechanismService;
  *
  */
 public class HomekitLockImpl extends AbstractHomekitAccessoryImpl implements LockMechanismAccessory {
-    final OnOffType securedState;
-    final OnOffType unsecuredState;
+    final Map<LockCurrentStateEnum, String> currentStateMapping;
+    final Map<LockTargetStateEnum, String> targetStateMapping;
 
     public HomekitLockImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             HomekitAccessoryUpdater updater, HomekitSettings settings) {
         super(taggedItem, mandatoryCharacteristics, updater, settings);
-        securedState = taggedItem.isInverted() ? OnOffType.OFF : OnOffType.ON;
-        unsecuredState = taggedItem.isInverted() ? OnOffType.ON : OnOffType.OFF;
+
+        currentStateMapping = createMapping(HomekitCharacteristicType.LOCK_CURRENT_STATE, LockCurrentStateEnum.class);
+        targetStateMapping = createMapping(HomekitCharacteristicType.LOCK_TARGET_STATE, LockTargetStateEnum.class);
         getServices().add(new LockMechanismService(this));
     }
 
     @Override
     public CompletableFuture<LockCurrentStateEnum> getLockCurrentState() {
-        final Optional<GenericItem> item = getItem(HomekitCharacteristicType.LOCK_CURRENT_STATE, GenericItem.class);
-        LockCurrentStateEnum lockState = LockCurrentStateEnum.UNKNOWN;
-        if (item.isPresent()) {
-            final State state = item.get().getState();
-            if (state instanceof DecimalType) {
-                lockState = LockCurrentStateEnum.fromCode(((DecimalType) state).intValue());
-            } else if (state instanceof OnOffType) {
-                lockState = state.equals(securedState) ? LockCurrentStateEnum.SECURED : LockCurrentStateEnum.UNSECURED;
-            }
-        }
-        return CompletableFuture.completedFuture(lockState);
+        return CompletableFuture.completedFuture(getKeyFromMapping(HomekitCharacteristicType.LOCK_CURRENT_STATE,
+                currentStateMapping, LockCurrentStateEnum.UNKNOWN));
     }
 
     @Override
     public CompletableFuture<LockTargetStateEnum> getLockTargetState() {
-        final @Nullable OnOffType state = getStateAs(HomekitCharacteristicType.LOCK_TARGET_STATE, OnOffType.class);
-        if (state != null) {
-            return CompletableFuture.completedFuture(
-                    state == securedState ? LockTargetStateEnum.SECURED : LockTargetStateEnum.UNSECURED);
-        }
-        return CompletableFuture.completedFuture(LockTargetStateEnum.UNSECURED);
-        // Apple HAP specification has only SECURED and UNSECURED values for lock target state.
-        // unknown does not supported for target state.
+        return CompletableFuture.completedFuture(getKeyFromMapping(HomekitCharacteristicType.LOCK_TARGET_STATE,
+                targetStateMapping, LockTargetStateEnum.UNSECURED));
     }
 
     @Override
     public CompletableFuture<Void> setLockTargetState(LockTargetStateEnum state) {
-        getItem(HomekitCharacteristicType.LOCK_TARGET_STATE, SwitchItem.class).ifPresent(item -> {
-            switch (state) {
-                case SECURED:
-                    if (item instanceof SwitchItem) {
-                        item.send(securedState);
-                    }
-                    break;
-                case UNSECURED:
-                    if (item instanceof SwitchItem) {
-                        item.send(unsecuredState);
-                    }
-                    break;
-                default:
-                    break;
-            }
-        });
+        HomekitCharacteristicFactory.setValueFromEnum(
+                getCharacteristic(HomekitCharacteristicType.LOCK_TARGET_STATE).get(), state, targetStateMapping);
         return CompletableFuture.completedFuture(null);
     }
 
index ca78ee2191f72c63e042287c1201a8c6c3bd8e35..eb84a493d0226bd5bbaf8d0187fcda383f2663ba 100644 (file)
@@ -15,6 +15,7 @@ package org.openhab.io.homekit.internal.accessories;
 import static org.openhab.io.homekit.internal.HomekitCharacteristicType.OCCUPANCY_DETECTED_STATE;
 
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
 import org.openhab.io.homekit.internal.HomekitAccessoryUpdater;
@@ -31,19 +32,19 @@ import io.github.hapjava.services.impl.OccupancySensorService;
  * @author Tim Harper - Initial contribution
  */
 public class HomekitOccupancySensorImpl extends AbstractHomekitAccessoryImpl implements OccupancySensorAccessory {
-    private final BooleanItemReader occupancySensedReader;
+    private final Map<OccupancyDetectedEnum, String> mapping;
 
     public HomekitOccupancySensorImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException {
         super(taggedItem, mandatoryCharacteristics, updater, settings);
-        occupancySensedReader = createBooleanReader(OCCUPANCY_DETECTED_STATE);
+        mapping = createMapping(OCCUPANCY_DETECTED_STATE, OccupancyDetectedEnum.class);
         getServices().add(new OccupancySensorService(this));
     }
 
     @Override
     public CompletableFuture<OccupancyDetectedEnum> getOccupancyDetected() {
         return CompletableFuture.completedFuture(
-                occupancySensedReader.getValue() ? OccupancyDetectedEnum.DETECTED : OccupancyDetectedEnum.NOT_DETECTED);
+                getKeyFromMapping(OCCUPANCY_DETECTED_STATE, mapping, OccupancyDetectedEnum.NOT_DETECTED));
     }
 
     @Override
index 5b28bacaab27bc3ac9212aebfba0377a791c1721..0a147f2e9cc127fca2860e23522fbec61744e483 100644 (file)
@@ -16,13 +16,10 @@ import static org.openhab.io.homekit.internal.HomekitCharacteristicType.SECURITY
 import static org.openhab.io.homekit.internal.HomekitCharacteristicType.SECURITY_SYSTEM_TARGET_STATE;
 
 import java.util.ArrayList;
-import java.util.EnumMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
-import org.openhab.core.library.items.StringItem;
-import org.openhab.core.library.types.StringType;
 import org.openhab.io.homekit.internal.HomekitAccessoryUpdater;
 import org.openhab.io.homekit.internal.HomekitCharacteristicType;
 import org.openhab.io.homekit.internal.HomekitSettings;
@@ -44,35 +41,18 @@ import io.github.hapjava.services.impl.SecuritySystemService;
  * @author Cody Cutrer - Initial contribution
  */
 public class HomekitSecuritySystemImpl extends AbstractHomekitAccessoryImpl implements SecuritySystemAccessory {
-    private final Map<CurrentSecuritySystemStateEnum, String> currentStateMapping = new EnumMap<CurrentSecuritySystemStateEnum, String>(
-            CurrentSecuritySystemStateEnum.class) {
-        {
-            put(CurrentSecuritySystemStateEnum.DISARMED, "DISARMED");
-            put(CurrentSecuritySystemStateEnum.AWAY_ARM, "AWAY_ARM");
-            put(CurrentSecuritySystemStateEnum.STAY_ARM, "STAY_ARM");
-            put(CurrentSecuritySystemStateEnum.NIGHT_ARM, "NIGHT_ARM");
-            put(CurrentSecuritySystemStateEnum.TRIGGERED, "TRIGGERED");
-        }
-    };
-    private final Map<TargetSecuritySystemStateEnum, String> targetStateMapping = new EnumMap<TargetSecuritySystemStateEnum, String>(
-            TargetSecuritySystemStateEnum.class) {
-        {
-            put(TargetSecuritySystemStateEnum.DISARM, "DISARM");
-            put(TargetSecuritySystemStateEnum.AWAY_ARM, "AWAY_ARM");
-            put(TargetSecuritySystemStateEnum.STAY_ARM, "STAY_ARM");
-            put(TargetSecuritySystemStateEnum.NIGHT_ARM, "NIGHT_ARM");
-        }
-    };
-    private final List<CurrentSecuritySystemStateEnum> customCurrentStateList;
-    private final List<TargetSecuritySystemStateEnum> customTargetStateList;
+    private final Map<CurrentSecuritySystemStateEnum, String> currentStateMapping;
+    private final Map<TargetSecuritySystemStateEnum, String> targetStateMapping;
+    private final List<CurrentSecuritySystemStateEnum> customCurrentStateList = new ArrayList<>();
+    private final List<TargetSecuritySystemStateEnum> customTargetStateList = new ArrayList<>();
 
     public HomekitSecuritySystemImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             HomekitAccessoryUpdater updater, HomekitSettings settings) {
         super(taggedItem, mandatoryCharacteristics, updater, settings);
-        customCurrentStateList = new ArrayList<>();
-        customTargetStateList = new ArrayList<>();
-        updateMapping(SECURITY_SYSTEM_CURRENT_STATE, currentStateMapping, customCurrentStateList);
-        updateMapping(SECURITY_SYSTEM_TARGET_STATE, targetStateMapping, customTargetStateList);
+        currentStateMapping = createMapping(SECURITY_SYSTEM_CURRENT_STATE, CurrentSecuritySystemStateEnum.class,
+                customCurrentStateList);
+        targetStateMapping = createMapping(SECURITY_SYSTEM_TARGET_STATE, TargetSecuritySystemStateEnum.class,
+                customTargetStateList);
         getServices().add(new SecuritySystemService(this));
     }
 
@@ -98,8 +78,9 @@ public class HomekitSecuritySystemImpl extends AbstractHomekitAccessoryImpl impl
 
     @Override
     public void setTargetSecuritySystemState(TargetSecuritySystemStateEnum state) {
-        getItem(HomekitCharacteristicType.SECURITY_SYSTEM_TARGET_STATE, StringItem.class)
-                .ifPresent(item -> item.send(new StringType(targetStateMapping.get(state))));
+        HomekitCharacteristicFactory.setValueFromEnum(
+                getCharacteristic(HomekitCharacteristicType.SECURITY_SYSTEM_TARGET_STATE).get(), state,
+                targetStateMapping);
     }
 
     @Override
index 21dc6d7d9a2d9919bee3094dd2ddb7a874e35597..379293ad72cb0ccde44da90831029dd2985da5f2 100644 (file)
@@ -14,7 +14,6 @@ package org.openhab.io.homekit.internal.accessories;
 
 import static org.openhab.io.homekit.internal.HomekitCharacteristicType.CURRENT_SLAT_STATE;
 
-import java.util.EnumMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.CompletableFuture;
@@ -43,11 +42,7 @@ public class HomekitSlatImpl extends AbstractHomekitAccessoryImpl implements Sla
         super(taggedItem, mandatoryCharacteristics, updater, settings);
         final String slatTypeConfig = getAccessoryConfiguration(CONFIG_TYPE, "horizontal");
         slatType = "horizontal".equalsIgnoreCase(slatTypeConfig) ? SlatTypeEnum.HORIZONTAL : SlatTypeEnum.VERTICAL;
-        currentSlatStateMapping = new EnumMap<>(CurrentSlatStateEnum.class);
-        currentSlatStateMapping.put(CurrentSlatStateEnum.FIXED, "FIXED");
-        currentSlatStateMapping.put(CurrentSlatStateEnum.SWINGING, "SWINGING");
-        currentSlatStateMapping.put(CurrentSlatStateEnum.JAMMED, "JAMMED");
-        updateMapping(CURRENT_SLAT_STATE, currentSlatStateMapping);
+        currentSlatStateMapping = createMapping(CURRENT_SLAT_STATE, CurrentSlatStateEnum.class);
         getServices().add(new SlatService(this));
     }
 
index 4ab0324462984d149adcec4b9207e46be023a687..1b4872fe130c9e8c500d3cf9844117aaa4e72c4b 100644 (file)
@@ -15,13 +15,10 @@ package org.openhab.io.homekit.internal.accessories;
 import static org.openhab.io.homekit.internal.HomekitCharacteristicType.CURRENT_MEDIA_STATE;
 import static org.openhab.io.homekit.internal.HomekitCharacteristicType.TARGET_MEDIA_STATE;
 
-import java.util.EnumMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
-import org.openhab.core.library.items.StringItem;
-import org.openhab.core.library.types.StringType;
 import org.openhab.io.homekit.internal.HomekitAccessoryUpdater;
 import org.openhab.io.homekit.internal.HomekitSettings;
 import org.openhab.io.homekit.internal.HomekitTaggedItem;
@@ -43,18 +40,8 @@ public class HomekitSmartSpeakerImpl extends AbstractHomekitAccessoryImpl implem
     public HomekitSmartSpeakerImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             HomekitAccessoryUpdater updater, HomekitSettings settings) {
         super(taggedItem, mandatoryCharacteristics, updater, settings);
-        currentMediaState = new EnumMap<>(CurrentMediaStateEnum.class);
-        currentMediaState.put(CurrentMediaStateEnum.STOP, "STOP");
-        currentMediaState.put(CurrentMediaStateEnum.PLAY, "PLAY");
-        currentMediaState.put(CurrentMediaStateEnum.PAUSE, "PAUSE");
-        currentMediaState.put(CurrentMediaStateEnum.UNKNOWN, "UNKNOWN");
-        updateMapping(CURRENT_MEDIA_STATE, currentMediaState);
-
-        targetMediaState = new EnumMap<>(TargetMediaStateEnum.class);
-        targetMediaState.put(TargetMediaStateEnum.STOP, "STOP");
-        targetMediaState.put(TargetMediaStateEnum.PLAY, "PLAY");
-        targetMediaState.put(TargetMediaStateEnum.PAUSE, "PAUSE");
-        updateMapping(TARGET_MEDIA_STATE, targetMediaState);
+        currentMediaState = createMapping(CURRENT_MEDIA_STATE, CurrentMediaStateEnum.class);
+        targetMediaState = createMapping(TARGET_MEDIA_STATE, TargetMediaStateEnum.class);
         getServices().add(new SmartSpeakerService(this));
     }
 
@@ -82,8 +69,8 @@ public class HomekitSmartSpeakerImpl extends AbstractHomekitAccessoryImpl implem
 
     @Override
     public CompletableFuture<Void> setTargetMediaState(final TargetMediaStateEnum targetState) {
-        getItem(TARGET_MEDIA_STATE, StringItem.class)
-                .ifPresent(item -> item.send(new StringType(targetMediaState.get(targetState))));
+        HomekitCharacteristicFactory.setValueFromEnum(getCharacteristic(TARGET_MEDIA_STATE).get(), targetState,
+                targetMediaState);
         return CompletableFuture.completedFuture(null);
     }
 
index bbe94b35c0b73bf079e62987967205103389a8e1..20261455255bd0bffa927c2dc5cc7dc0dcd46cf8 100644 (file)
@@ -15,6 +15,7 @@ package org.openhab.io.homekit.internal.accessories;
 import static org.openhab.io.homekit.internal.HomekitCharacteristicType.SMOKE_DETECTED_STATE;
 
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
 import org.openhab.io.homekit.internal.HomekitAccessoryUpdater;
@@ -31,19 +32,19 @@ import io.github.hapjava.services.impl.SmokeSensorService;
  * @author Cody Cutrer - Initial contribution
  */
 public class HomekitSmokeSensorImpl extends AbstractHomekitAccessoryImpl implements SmokeSensorAccessory {
-    private final BooleanItemReader smokeDetectedReader;
+    private final Map<SmokeDetectedStateEnum, String> mapping;
 
     public HomekitSmokeSensorImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException {
         super(taggedItem, mandatoryCharacteristics, updater, settings);
-        smokeDetectedReader = createBooleanReader(SMOKE_DETECTED_STATE);
+        mapping = createMapping(SMOKE_DETECTED_STATE, SmokeDetectedStateEnum.class);
         this.getServices().add(new SmokeSensorService(this));
     }
 
     @Override
     public CompletableFuture<SmokeDetectedStateEnum> getSmokeDetectedState() {
-        return CompletableFuture.completedFuture(
-                smokeDetectedReader.getValue() ? SmokeDetectedStateEnum.DETECTED : SmokeDetectedStateEnum.NOT_DETECTED);
+        return CompletableFuture
+                .completedFuture(getKeyFromMapping(SMOKE_DETECTED_STATE, mapping, SmokeDetectedStateEnum.NOT_DETECTED));
     }
 
     @Override
index 8f196e8c9de3dde4c05cc36c42185ff8d4ac5550..60f1f09054696fde4d5155e6c7e763b66f79e4ec 100644 (file)
@@ -17,16 +17,13 @@ import static org.openhab.io.homekit.internal.HomekitCharacteristicType.TARGET_H
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
-import java.util.EnumMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.concurrent.CompletableFuture;
 
 import org.openhab.core.library.items.NumberItem;
-import org.openhab.core.library.items.StringItem;
 import org.openhab.core.library.types.DecimalType;
-import org.openhab.core.library.types.StringType;
 import org.openhab.io.homekit.internal.HomekitAccessoryUpdater;
 import org.openhab.io.homekit.internal.HomekitCharacteristicType;
 import org.openhab.io.homekit.internal.HomekitSettings;
@@ -64,23 +61,12 @@ class HomekitThermostatImpl extends AbstractHomekitAccessoryImpl implements Ther
     public HomekitThermostatImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             HomekitAccessoryUpdater updater, HomekitSettings settings) {
         super(taggedItem, mandatoryCharacteristics, updater, settings);
-        currentHeatingCoolingStateMapping = new EnumMap<>(CurrentHeatingCoolingStateEnum.class);
-        currentHeatingCoolingStateMapping.put(CurrentHeatingCoolingStateEnum.OFF, settings.thermostatCurrentModeOff);
-        currentHeatingCoolingStateMapping.put(CurrentHeatingCoolingStateEnum.COOL,
-                settings.thermostatCurrentModeCooling);
-        currentHeatingCoolingStateMapping.put(CurrentHeatingCoolingStateEnum.HEAT,
-                settings.thermostatCurrentModeHeating);
-        targetHeatingCoolingStateMapping = new EnumMap<>(TargetHeatingCoolingStateEnum.class);
-        targetHeatingCoolingStateMapping.put(TargetHeatingCoolingStateEnum.OFF, settings.thermostatTargetModeOff);
-        targetHeatingCoolingStateMapping.put(TargetHeatingCoolingStateEnum.COOL, settings.thermostatTargetModeCool);
-        targetHeatingCoolingStateMapping.put(TargetHeatingCoolingStateEnum.HEAT, settings.thermostatTargetModeHeat);
-        targetHeatingCoolingStateMapping.put(TargetHeatingCoolingStateEnum.AUTO, settings.thermostatTargetModeAuto);
         customCurrentHeatingCoolingStateList = new ArrayList<>();
         customTargetHeatingCoolingStateList = new ArrayList<>();
-        updateMapping(CURRENT_HEATING_COOLING_STATE, currentHeatingCoolingStateMapping,
-                customCurrentHeatingCoolingStateList);
-        updateMapping(TARGET_HEATING_COOLING_STATE, targetHeatingCoolingStateMapping,
-                customTargetHeatingCoolingStateList);
+        currentHeatingCoolingStateMapping = createMapping(CURRENT_HEATING_COOLING_STATE,
+                CurrentHeatingCoolingStateEnum.class, customCurrentHeatingCoolingStateList);
+        targetHeatingCoolingStateMapping = createMapping(TARGET_HEATING_COOLING_STATE,
+                TargetHeatingCoolingStateEnum.class, customTargetHeatingCoolingStateList);
         this.getServices().add(new ThermostatService(this));
     }
 
@@ -165,8 +151,8 @@ class HomekitThermostatImpl extends AbstractHomekitAccessoryImpl implements Ther
 
     @Override
     public void setTargetState(TargetHeatingCoolingStateEnum mode) {
-        getItem(TARGET_HEATING_COOLING_STATE, StringItem.class)
-                .ifPresent(item -> item.send(new StringType(targetHeatingCoolingStateMapping.get(mode))));
+        HomekitCharacteristicFactory.setValueFromEnum(getCharacteristic(TARGET_HEATING_COOLING_STATE).get(), mode,
+                targetHeatingCoolingStateMapping);
     }
 
     @Override
index ca5bbf3bcfc0d1f73c4a84525f1030576870943c..117d29d1febae0fc66e7f2c9ae82587fbe9c9389 100644 (file)
                        <description>Advanced network settings.</description>
                        <advanced>true</advanced>
                </parameter-group>
-               <parameter-group name="thermostatTargetHeatingCooling">
-                       <label>Thermostat Target Heating/Cooling Mapping</label>
-                       <description>String values used by your thermostat to set different target heating/cooling modes.</description>
-                       <advanced>true</advanced>
-               </parameter-group>
-               <parameter-group name="thermostatCurrentHeatingCooling">
-                       <label>Thermostat Current Heating/Cooling Mapping</label>
-                       <description>String values used by your thermostat to set different current heating/cooling modes.</description>
-                       <advanced>true</advanced>
-               </parameter-group>
                <parameter name="name" type="text" required="false" groupName="core">
                        <label>Bridge name</label>
                        <description>Name of the HomeKit bridge.</description>
                        <description>Defines whether or not to direct HomeKit clients to use fahrenheit temperatures instead of celsius.</description>
                        <default>false</default>
                </parameter>
-               <parameter name="thermostatTargetModeCool" type="text" required="true"
-                       groupName="thermostatTargetHeatingCooling">
-                       <label>Cool Value</label>
-                       <description>Word used to set the target heatingCoolingMode to COOL (if a thermostat is defined).</description>
-                       <default>CoolOn</default>
-                       <advanced>true</advanced>
-               </parameter>
-               <parameter name="thermostatTargetModeHeat" type="text" required="true"
-                       groupName="thermostatTargetHeatingCooling">
-                       <label>Heat Value</label>
-                       <description>Word used to set the target heatingCoolingMode to HEAT (if a thermostat is defined).</description>
-                       <default>HeatOn</default>
-                       <advanced>true</advanced>
-               </parameter>
-               <parameter name="thermostatTargetModeAuto" type="text" required="true"
-                       groupName="thermostatTargetHeatingCooling">
-                       <label>Auto Value</label>
-                       <description>Word used to set the target heatingCoolingMode to AUTO (if a thermostat is defined).</description>
-                       <default>Auto</default>
-                       <advanced>true</advanced>
-               </parameter>
-               <parameter name="thermostatTargetModeOff" type="text" required="true"
-                       groupName="thermostatTargetHeatingCooling">
-                       <label>Off Value</label>
-                       <description>Word used to set the target heatingCoolingMode to OFF (if a thermostat is defined).</description>
-                       <default>Off</default>
-                       <advanced>true</advanced>
-               </parameter>
-               <parameter name="thermostatCurrentModeHeating" type="text" required="true"
-                       groupName="thermostatCurrentHeatingCooling">
-                       <label>Heating Value</label>
-                       <description>Value for setting target heatingCoolingCurrentMode to HEAT (IE: indicating that the heater is currently
-                               warming the home).</description>
-                       <default>Heating</default>
-                       <advanced>true</advanced>
-               </parameter>
-               <parameter name="thermostatCurrentModeCooling" type="text" required="true"
-                       groupName="thermostatCurrentHeatingCooling">
-                       <label>Cooling Value</label>
-                       <description>Value for setting target heatingCoolingCurrentMode to COOL (IE: indicating that the air condition is
-                               currently cooling the home).</description>
-                       <default>Cooling</default>
-                       <advanced>true</advanced>
-               </parameter>
-               <parameter name="thermostatCurrentModeOff" type="text" required="true"
-                       groupName="thermostatCurrentHeatingCooling">
-                       <label>Off Value</label>
-                       <description>Value for setting target heatingCoolingCurrentMode to OFF (IE: the hvac is currently idle, because the
-                               target temperature has been reached per the mode).</description>
-                       <default>Off</default>
-                       <advanced>true</advanced>
-               </parameter>
                <parameter name="useOHmDNS" type="boolean" required="false" groupName="network">
                        <label>Use openHAB mDNS service</label>
                        <description>Defines whether mDNS service of openHAB or a separate instance of mDNS should be used.</description>
index 0aef5ac4f5f2eb245894604eda107c181106fb62..7db2b2234b12902948432842addeff409c5993d2 100644 (file)
@@ -5,10 +5,6 @@ io.config.homekit.group.network.label = Network Settings
 io.config.homekit.group.network.description = Advanced network settings.
 io.config.homekit.group.thermostat.label = Thermostat Settings
 io.config.homekit.group.thermostat.description = Advanced thermostat settings.
-io.config.homekit.group.thermostatCurrentHeatingCooling.label = Thermostat Current Heating/Cooling Mapping
-io.config.homekit.group.thermostatCurrentHeatingCooling.description = String values used by your thermostat to set different current heating/cooling modes.
-io.config.homekit.group.thermostatTargetHeatingCooling.label = Thermostat Target Heating/Cooling Mapping
-io.config.homekit.group.thermostatTargetHeatingCooling.description = String values used by your thermostat to set different target heating/cooling modes.
 io.config.homekit.instances.label = Instances
 io.config.homekit.instances.description = Defines how many bridges to expose. Necessary if you have more than 149 accessories. Accessories must be assigned to additional instances via metadata. Additional bridges will use incrementing port numbers.
 io.config.homekit.name.label = Bridge name
@@ -23,20 +19,6 @@ io.config.homekit.qrCode.label = HomeKit QR Code
 io.config.homekit.qrCode.description = Scan QR code with home app to add openHAB as HomeKit bridge.
 io.config.homekit.setupId.label = Setup ID
 io.config.homekit.setupId.description = Setup ID used for pairing using QR Code. Alphanumeric code of length 4.
-io.config.homekit.thermostatCurrentModeCooling.label = Cooling Value
-io.config.homekit.thermostatCurrentModeCooling.description = Value for setting target heatingCoolingCurrentMode to COOL (IE: indicating that the air condition is currently cooling the home).
-io.config.homekit.thermostatCurrentModeHeating.label = Heating Value
-io.config.homekit.thermostatCurrentModeHeating.description = Value for setting target heatingCoolingCurrentMode to HEAT (IE: indicating that the heater is currently warming the home).
-io.config.homekit.thermostatCurrentModeOff.label = Off Value
-io.config.homekit.thermostatCurrentModeOff.description = Value for setting target heatingCoolingCurrentMode to OFF (IE: the hvac is currently idle, because the target temperature has been reached per the mode).
-io.config.homekit.thermostatTargetModeAuto.label = Auto Value
-io.config.homekit.thermostatTargetModeAuto.description = Word used to set the target heatingCoolingMode to AUTO (if a thermostat is defined).
-io.config.homekit.thermostatTargetModeCool.label = Cool Value
-io.config.homekit.thermostatTargetModeCool.description = Word used to set the target heatingCoolingMode to COOL (if a thermostat is defined).
-io.config.homekit.thermostatTargetModeHeat.label = Heat Value
-io.config.homekit.thermostatTargetModeHeat.description = Word used to set the target heatingCoolingMode to HEAT (if a thermostat is defined).
-io.config.homekit.thermostatTargetModeOff.label = Off Value
-io.config.homekit.thermostatTargetModeOff.description = Word used to set the target heatingCoolingMode to OFF (if a thermostat is defined).
 io.config.homekit.useDummyAccessories.label = Use Dummy Accessories
 io.config.homekit.useDummyAccessories.description = Create dummy accessories when an item is missing. See <a href="https://www.openhab.org/addons/integrations/homekit/#dummy-accessories">the documentation</a> for more information.
 io.config.homekit.useFahrenheitTemperature.label = Use Fahrenheit Temperature