ebaauw / homebridge-rpi

Homebridge plugin for Raspberry Pi.
Apache License 2.0
308 stars 18 forks source link

Feature Request: Lock Mechanism from GPIO out #63

Closed MichlW closed 3 years ago

MichlW commented 3 years ago

I wired my door opener (a door buzzer) through a relais from GPIO OUT and want to expose it as Lock to HomeKit.

With your Plugin I can configure a Switch that works great and behaves exactly like my door opener. When I press the button it gets opened for two seconds (it hums) and then gets automatically closed again.

What i request is: Could you implement the functions of the existing switch as an HomeKit compatible Lock Mechanism or Lock Management service (Sorry, I do not know the differences) to your plugin as an additional supported device type?

Thanks in advance.

ebaauw commented 3 years ago

Lock Management Service seems to defined for programming smart locks, that's way too complex and definitely out of the question here.

Lock Mechanism is for a traditional door lock, that you can lock and unlock. It requires a Current Lock State and a Target Lock State. That doesn't seem to fit your door opener, since it doesn't provide a current state.

MichlW commented 3 years ago

Thanks for your feedback. I know that this kind of door opener is really simple - basically CurrentLockState and TargetLockState alsways have the same states. I just can perform the action to open the door and it gets closed automatically after some time. So closing the door as an TargetLockState is not possible. This is why I mentioned your Switch Service with the possibility to automatically switch off after some time.

Unfortunately and AFAIK HomeKit only provides an Unlock Button if a MotionSensor (The DoorBell), a Lock and a Camera is configured in the same room. That is why I want to expose a Lock device and not a simple Switch.

image

This is what i want to achive

Thanks in advance.

ebaauw commented 3 years ago

Not sure with the latest iOS versions, but I think the services need to be in the same (video doorbell) accessory, no longer just in the same room. Could you please check with the HomeKit Accessory Simulator, what type of accessory Homebridge RPi should expose for this to work? Please export the accessory from the simulator and attach the export file.

MichlW commented 3 years ago

I do not have a Mac computer nor a developer Account...

Maybe you could add a kind of „simple Lock“ with the ability to open and close and automatic close after a certain time where CurrentLockState simply follows TargetLockState? This is quite enough for GPIO driven Lock mechanism and would work for open/close devices and open/automaticclose devices. (Like your Switch)

Maybe I should search for cmd plugin with direct control of pigpiod and manually „fake“ my LockDevice on this way?!?

ebaauw commented 3 years ago

Sorry, I'm not going to do trial and error for a setup that I cannot test myself.

MichlW commented 3 years ago

Could you please have a look at: https://github.com/dubocr/homebridge-gpio-device#lockmechanism

That is exactly what I need, but I am not able to switch to this plugin, because I ran Homebridge from Docker container and need the remote functionallity from pigpiod.

For now my setup is configured as switch and it works like a charm.

{
 "device": "switch",
 "name": "Türöffner",
 "gpio": 24,
 "pulse": 100
}

Problem is, that its no Lock device type and I can not tell Siri "please open the door". Instead I must say "please activate Türöffner" which is not very user friendly.

I can test this for you if you want, but you do not need the physical hardware - it is simply GPIO ON -> wait 100ms -> GPIO OFF.

Thanks in advance.

piotr0777 commented 3 years ago

+1 👍

Would be really nice to have a basic Lock feature. In my case I have a switch connected to an electric door latch. The switch is set up to activate for 5 seconds to open the electric latch during that period of time. It would be nice if the switch could be visible in HomeKit as a Lock... in this way I would be able to tell Siri "Unlock the door" instead of "Turn on the door".

It is also more secure to set a door latch up as a Lock device in HomeKit as in order to activate a Lock you need to unlock your iPhone first. Also when you use HomePod, Siri has some restrictions regarding opening Locks through HomePod. While having a latch configured as a Switch there is no need to unlock your iPhone to turn the switch on, respectively HomePod will take request from anyone in that matter...which is not an ideal scenario.

I currently use this package https://www.npmjs.com/package/homebridge-gpio-device This package allows creating simple Locks instead of Switches, but I would rather use your package :) { "accessory": "GPIODevice", "type": "LockMechanism", "name": "Front Door", "pin": 6, "duration": 5 },

thorget commented 3 years ago

That would be a nice upgrade, now i have to use other gpio plugin. You should check their repositori too. Thank in advance . Peace;)

mikebannan commented 3 years ago

I'm also using a Switch to activate a solenoid lock, and have set a Scene to "Unlock the Studio Door". The Switch (turn-on) is the only accessory in the Scene. I can tell Siri "Unlock the Audio Door". This solves your problem without the complications of a Lock device.

And since it's just a Switch, I can also use the double-tap-the-phone shortcut to Unlock the Door.