add support for further HomeKit parameters (#1543)

Signed-off-by: Eugen <eugen@relotrust.com>
pull/1547/head
eugen 2022-11-16 23:02:49 +01:00 committed by GitHub
parent 26c3e35356
commit 322263a336
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 46 additions and 15 deletions

View File

@ -156,7 +156,8 @@ export const accessories = {
{ label: 'CurrentHeatingCoolingMode', mandatory: true }, { label: 'CurrentHeatingCoolingMode', mandatory: true },
{ label: 'TargetHeatingCoolingMode', mandatory: true }, { label: 'TargetHeatingCoolingMode', mandatory: true },
{ label: 'CoolingThresholdTemperature', mandatory: false }, { label: 'CoolingThresholdTemperature', mandatory: false },
{ label: 'HeatingThresholdTemperature', mandatory: false } { label: 'HeatingThresholdTemperature', mandatory: false },
{ label: 'RelativeHumidity', mandatory: false }
], ],
'HeaterCooler': [ 'HeaterCooler': [
{ label: 'ActiveStatus', mandatory: true }, { label: 'ActiveStatus', mandatory: true },
@ -244,6 +245,13 @@ for (const a in accessories) {
} }
} }
const instanceParameter = {
name: 'Instance',
label: 'Instance',
description: 'HomeKit bridge instance number in case of multiple bridge instances. if unsure, leave empty',
type: 'INTEGER'
}
const valveTypeParameter = { const valveTypeParameter = {
name: 'homekitValveType', name: 'homekitValveType',
label: 'Valve Type', label: 'Valve Type',
@ -312,6 +320,12 @@ const stepValue = {
type: 'INTEGER' type: 'INTEGER'
} }
const batteryLowThreshold = {
name: 'lowThreshold',
label: 'battery low threshold. applicable only for items of type Number',
type: 'INTEGER'
}
const m = (name, type, label, description) => { const m = (name, type, label, description) => {
return { return {
name, name,
@ -335,31 +349,44 @@ const dimmerFilterType = {
} }
export const homekitParameters = { export const homekitParameters = {
'Valve': [valveTypeParameter, valveTimerParameter, valveDefaultDuration], 'Valve': [instanceParameter, valveTypeParameter, valveTimerParameter, valveDefaultDuration],
'Lighting.Brightness': [minValue, maxValue, dimmerFilterType], 'Lighting.Brightness': [instanceParameter, minValue, maxValue, dimmerFilterType],
'TemperatureSensor.CurrentTemperature': [minValue, maxValue], 'TemperatureSensor.CurrentTemperature': [instanceParameter, minValue, maxValue],
'LeakSensor': [invertedParameter], 'LeakSensor': [instanceParameter, invertedParameter],
'LeakSensor.LeakDetectedState': [invertedParameter], 'LeakSensor.LeakDetectedState': [invertedParameter],
'MotionSensor': [invertedParameter], 'LeakSensor.BatteryLowStatus': [batteryLowThreshold, invertedParameter],
'MotionSensor': [instanceParameter, invertedParameter],
'MotionSensor.MotionDetectedState': [invertedParameter], 'MotionSensor.MotionDetectedState': [invertedParameter],
'OccupancySensor': [invertedParameter], 'MotionSensor.BatteryLowStatus': [batteryLowThreshold, invertedParameter],
'OccupancySensor': [instanceParameter, invertedParameter],
'OccupancySensor.BatteryLowStatus': [batteryLowThreshold, invertedParameter],
'OccupancySensor.OccupancyDetectedState': [invertedParameter], 'OccupancySensor.OccupancyDetectedState': [invertedParameter],
'ContactSensor': [invertedParameter], 'ContactSensor': [instanceParameter, invertedParameter],
'ContactSensor.BatteryLowStatus': [batteryLowThreshold, invertedParameter],
'ContactSensor.ContactSensorState': [invertedParameter], 'ContactSensor.ContactSensorState': [invertedParameter],
'SmokeSensor': [invertedParameter], 'SmokeSensor': [instanceParameter, invertedParameter],
'SmokeSensor.BatteryLowStatus': [batteryLowThreshold, invertedParameter],
'SmokeSensor.SmokeDetectedState': [invertedParameter], 'SmokeSensor.SmokeDetectedState': [invertedParameter],
'CarbonDioxideSensor': [invertedParameter], 'CarbonDioxideSensor': [instanceParameter, invertedParameter],
'CarbonDioxideSensor.CarbonDioxideDetectedState': [invertedParameter], 'CarbonDioxideSensor.CarbonDioxideDetectedState': [invertedParameter],
'CarbonMonoxideSensor': [invertedParameter], 'CarbonDioxideSensor.BatteryLowStatus': [batteryLowThreshold, invertedParameter],
'CarbonMonoxideSensor': [instanceParameter, invertedParameter],
'CarbonMonoxideSensor.CarbonMonoxideDetectedState': [invertedParameter], 'CarbonMonoxideSensor.CarbonMonoxideDetectedState': [invertedParameter],
'Window': [invertedParameter], 'CarbonMonoxideSensor.BatteryLowStatus': [batteryLowThreshold, invertedParameter],
'Door': [invertedParameter], 'LightSensor.BatteryLowStatus': [batteryLowThreshold, invertedParameter],
'WindowCovering': [invertedParameter], 'HumiditySensor.BatteryLowStatus': [batteryLowThreshold, invertedParameter],
'Battery': [chargeableParameter], 'TemperatureSensor.BatteryLowStatus': [batteryLowThreshold, invertedParameter],
'Window': [instanceParameter, invertedParameter],
'Door': [instanceParameter, invertedParameter],
'WindowCovering': [instanceParameter, invertedParameter],
'Battery': [instanceParameter, chargeableParameter],
'Battery.BatteryLowStatus': [batteryLowThreshold, invertedParameter],
'Fan': [instanceParameter],
'Fan.TargetFanState': [invertedParameter], 'Fan.TargetFanState': [invertedParameter],
'Fan.RotationDirection': [invertedParameter], 'Fan.RotationDirection': [invertedParameter],
'Fan.SwingMode': [invertedParameter], 'Fan.SwingMode': [invertedParameter],
'Fan.LockControl': [invertedParameter], 'Fan.LockControl': [invertedParameter],
'Thermostat': [instanceParameter],
'Thermostat.CurrentTemperature': [minValue, maxValue, stepValue], 'Thermostat.CurrentTemperature': [minValue, maxValue, stepValue],
'Thermostat.TargetTemperature': [minValue, maxValue, stepValue], 'Thermostat.TargetTemperature': [minValue, maxValue, stepValue],
'Thermostat.CoolingThresholdTemperature': [minValue, maxValue, stepValue], 'Thermostat.CoolingThresholdTemperature': [minValue, maxValue, stepValue],
@ -375,6 +402,8 @@ export const homekitParameters = {
m('COOL', 'TEXT', 'COOL', 'Value for thermostat mode "cool"'), m('COOL', 'TEXT', 'COOL', 'Value for thermostat mode "cool"'),
m('AUTO', 'TEXT', 'AUTO', 'Value for thermostat mode "auto"') m('AUTO', 'TEXT', 'AUTO', 'Value for thermostat mode "auto"')
], ],
'AirQualitySensor': [instanceParameter],
'AirQualitySensor.BatteryLowStatus': [batteryLowThreshold, invertedParameter],
'AirQualitySensor.AirQuality': [ 'AirQualitySensor.AirQuality': [
m('UNKNOWN', 'TEXT', 'UNKNOWN', 'Value for air quality "unknown"'), m('UNKNOWN', 'TEXT', 'UNKNOWN', 'Value for air quality "unknown"'),
m('EXCELLENT', 'TEXT', 'EXCELLENT', 'Value for air quality "excellent"'), m('EXCELLENT', 'TEXT', 'EXCELLENT', 'Value for air quality "excellent"'),
@ -383,6 +412,8 @@ export const homekitParameters = {
m('INFERIOR', 'TEXT', 'INFERIOR', 'Value for air quality "inferior"'), m('INFERIOR', 'TEXT', 'INFERIOR', 'Value for air quality "inferior"'),
m('POOR', 'TEXT', 'POOR', 'Value for air quality "poor"') m('POOR', 'TEXT', 'POOR', 'Value for air quality "poor"')
], ],
'AirQualitySensor.VOCDensity': [minValue, maxValue, stepValue],
'SecuritySystem': [instanceParameter],
'SecuritySystem.CurrentSecuritySystemState': [ 'SecuritySystem.CurrentSecuritySystemState': [
m('STAY_ARM', 'TEXT', 'STAY_ARM', 'Value for security state "stay arm"'), m('STAY_ARM', 'TEXT', 'STAY_ARM', 'Value for security state "stay arm"'),
m('AWAY_ARM', 'TEXT', 'AWAY_ARM', 'Value for security state "arm away"'), m('AWAY_ARM', 'TEXT', 'AWAY_ARM', 'Value for security state "arm away"'),