Closed madcat-nl closed 1 year ago
it seems that the current state and target state is a bit different: SecuritySystemCurrentState extends Characteristic { public static readonly STAY_ARM = 0; public static readonly AWAY_ARM = 1; public static readonly NIGHT_ARM = 2; public static readonly DISARMED = 3; public static readonly ALARM_TRIGGERED = 4;
export class SecuritySystemTargetState extends Characteristic { public static readonly STAY_ARM = 0; public static readonly AWAY_ARM = 1; public static readonly NIGHT_ARM = 2; public static readonly DISARM = 3;
Everything within the 800's block is a valid value. Think issue is further down in the 1300's... this should fix it:
case this.swTypeVal == Constants.DeviceTypeSecuritySystem:
{
var systemState = Characteristic.SecuritySystemCurrentState.STAY_ARM;
var targetState = Characteristic.SecuritySystemTargetState.STAY_ARM;
switch (message.nvalue) {
case 0: //Disarm
case 1: //Normal Delay
case 13: //Disarm
systemState = Characteristic.SecuritySystemCurrentState.DISARMED;
targetState = Characteristic.SecuritySystemTargetState.DISARM;
break;
case 9: //Arm Away
case 10: //Arm Away Delayed
systemState = Characteristic.SecuritySystemCurrentState.AWAY_ARM;
targetState = Characteristic.SecuritySystemTargetState.AWAY_ARM;
break;
case 11: //Arm Home
case 12: //Arm Home Delayed
systemState = Characteristic.SecuritySystemCurrentState.STAY_ARM;
targetState = Characteristic.SecuritySystemTargetState.STAY_ARM;
break;
case 6:
systemState = Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED;
targetState = Characteristic.SecuritySystemTargetState.STAY_ARM;
break;
default:
case 2:
systemState = Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED;
targetState = Characteristic.SecuritySystemTargetState.STAY_ARM;
break;
case 3: //Alarm Delayed
case 4: //Motion
case 5: //No Motion
case 7: //Panic End
case 8:
}
this.cachedValues[Characteristic.SecuritySystemCurrentState.UUID] = systemState;
var service = this.getService(Service.SecuritySystem);
var currentStateCharacteristic = this.getCharacteristic(service, Characteristic.SecuritySystemCurrentState);
var targetStateCharacteristic = this.getCharacteristic(service, Characteristic.SecuritySystemTargetState);
callback(currentStateCharacteristic, systemState);
callback(targetStateCharacteristic, targetState);
break;
}
Fix for this was pushed out in 2.1.40...
When the security alarm of domoticz is set to panic (6)/alarm (2) i do see an panic in homekit but it then drops this warning and set the state to "home" again
[homebridge-edomoticz] This plugin generated a warning from the characteristic 'Security System Target State': characteristic was supplied illegal value: number 4 exceeded maximum of 3. See https://git.io/JtMGR for more info.
i think the error is near with domoticz_accessory.js line 820 - 880
can you also set "case 2: //Alarm" at line 1349 to systemState = Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED;