entmike / homebridge-cmdaccessory

Command plugin for HomeBridge to appear as different accessories (Switch, Lock, Window Blinds, Lights, etc)
16 stars 5 forks source link

No more notifications with LockMechanism #9

Open manu3b1 opened 4 years ago

manu3b1 commented 4 years ago

With iOS 13, LockMechanism accessories do not trigger notifications anymore during polling. Look like polling should only update LockCurrentState, not LockTargetState.

Works better after patching index.js to get:

cmdAccessoryPlatform.prototype.statePolling = function (name) {
    var accessory = this.accessories[name];
    var thisSwitch = accessory.context;
    var prop = this.getStatePropertyName(accessory.context.type);
    var arrProp = prop.split(",");
    var self = this;
    // Clear polling
    clearTimeout(this.polling[name]);

    this.getState(thisSwitch, function (error, state) {
        // Update state if there's no error
        if (!error && state !== thisSwitch.state) {
            thisSwitch.state = state;
            // Update only the LockCurrentState
            for (var i = 0; i < 1 /*arrProp.length*/; i++) {