Licence
MIT
Version
2.0.1
Deps
3
Size
9 kB
Vulns
0
Weekly
0
Homebridge Electromagnetic Lock
Homebridge Electromagnetic Lock plugin to control electromagnetic lock via Raspberry Pi GPIO lines.
Objective
Electromagnetic lock controlled through libgpiod.
Installation
- install homebridge
npm install -g homebridge - install libgpiod
sudo apt install -y gpiod libgpiod-dev - install this plugin
npm install -g homebridge-electromagnetic-lock - update your
~/.homebridge/config.jsonfile (usesample-config.jsonas a reference)
Configuration
Sample accessory:
"accessories": [
{
"accessory": "ElectromagneticLock",
"name": "Lock",
"lockPin": 18,
"gpioChip": 0,
"activeLow": true,
"unlockingDuration": 2
}
]
Fields:
accessorymust always be ElectromagneticLocknameaccessory name, e.g. LocklockPinBCM GPIO / libgpiod line number for unlocking lock, not physical board pingpioChip[optional, default: 0] GPIO chip number used by libgpiod, usually 0 on Raspberry PiactiveLow[optional, default: true] true: relay activated by low state (0), false: relay activated by high state (1), affects lockPinunlockingDuration[optional, default: 2] how long lockPin should be active (seconds)
For example, Raspberry Pi physical pin 12 is BCM GPIO 18, so use "lockPin": 18.
Upgrading from v1.x
Version 2.0.0 changed the GPIO backend from rpi-gpio/sysfs to libgpiod. The lockPin option now uses the BCM GPIO / libgpiod line number, not the physical board pin.
For example, if v1.x used physical pin 12, v2.x should use "lockPin": 18.
Troubleshooting
- check platform: Homebridge
- check plugin dependency: [underscore](Install: npm install underscore -> https://www.npmjs.com/package/underscore)
- check plugin dependency: node-libgpiod
Attribution
This project is based on Homebridge GPIO Electromagnetic Lock by Panda Unit sp. z o.o. (github.com/pandaunit/homebridge-gpio-electromagnetic-lock).