sibartlett / homebridge-wink3

Homebridge plugin for wink.com
https://sibartlett.github.io/homebridge-wink3
ISC License
54 stars 20 forks source link

Door sensors reporting as sensor image, but behave like lock #47

Closed bernesto closed 6 years ago

bernesto commented 7 years ago

Not sure if this is a HomeKit issue or a Wink3 issue. But all of my door sensors report as openable/closable. So if you tap one, it says "Opening..." until you actually open and close the door again.

mriksman commented 7 years ago

I have no idea why, after three versions, it is still done this way...

Open sensor_pod.js in /usr/lib/node_modules/homebridge-wink3/dist/devices and find replace the code for the Service.Door.

//      service: Service.Door,
      service: Service.ContactSensor,
      supported: isDoor,
      characteristics: [{
//        characteristic: Characteristic.CurrentPosition,
        characteristic: Characteristic.ContactSensorState,
//        get: state => state.opened ? 100 : 0
        get: state => {
                if (state.opened)
                        return Characteristic.ContactSensorState.CONTACT_NOT_DETECTED;
                else
                        return Characteristic.ContactSensorState.CONTACT_DETECTED;
        }
//      }, {
//        characteristic: Characteristic.PositionState,
//        value: Characteristic.PositionState.STOPPED
      }]

Afterwards, delete the cachedAccessories file in .homebridge/accessories in order for the devices to be readied (thus ensuring no duplicates).

Once added, you can change the type - Window, Blinds, Door, ContactSensor, Garage Door Opener - all show different icons.

schmittx commented 7 years ago

I submitted a fix for this, check #54, hopefully it will get merged soon!

sibartlett commented 7 years ago

I’ll be merging the fix soon, sorry for the delay.

mriksman commented 7 years ago

Hmm, I need to learn how to do this fix and merge stuff... I have a few fixes....

schmittx commented 7 years ago

@sibartlett No need to be sorry, we all appreciate your hard work on this!

sibartlett commented 7 years ago

The fix is merged.