-
Notifications
You must be signed in to change notification settings - Fork 70
Feature Request: Add some more configurable settings #54
Copy link
Copy link
Open
Description
Hi everyone,
I really like this code and just implemented it for opening doors.
What I miss are some configurable settings and an option to set up a static HomeKit Code. I implemented it like shown below.
Since I'm not a software developer and not very experienced in Python (or Github) maybe someone else can comment and/or maybe integrate into the code.
What I did were the following "enhancements":
configuration.json
{
"logging": {
"level": 20
},
"nfc": {
"path": "tty:usbserial-0001:pn532",
"broadcast": true
},
"hap": {
"port": 51926,
"persist": "hap.state",
"default": "locked",
"throttle_polling": 0.25,
#--
"pincode": "123-45-678",
"lock-name": "NFC Lock",
"info_manufacturer": "Manufacturer",
"info_model": "Lock Model",
"info_firmware_revision": "1.0",
"info_serial_number": "1.2.3.4"
#--
},
"homekey": {
"persist": "homekey.json",
"express": true,
"finish": "silver",
"flow": "fast"
}
}
And main.py:
def configure_hap_accessory(config: dict, homekey_service=None):
#--
# driver = AccessoryDriver(port=config["port"], persist_file=config["persist"])
driver = AccessoryDriver(port=config["port"], persist_file=config["persist"], pincode=bytes(config["pincode"], "utf-8"))
#--
accessory = Lock(
driver,
#--
# "NFC Lock",
f"{(config.get("lock-name") or "NFC Lock")}",
#--
service=homekey_service,
lock_state_at_startup=int(config.get("default") != "unlocked")
)
#--
accessory.set_info_service(
manufacturer=f"{(config.get("info_manufacturer") or "Manufacturer")}",
model=f"{(config.get("info_model") or "Model")}",
firmware_revision=f"{(config.get("info_firmware_revision") or "0")}",
serial_number=f"{(config.get("info_serial_number") or "0.0")}"
)
#--
driver.add_accessory(accessory=accessory)
return driver, accessory
This displays more information in the Home App and allows the static configuration of a HomeKit pairing code.
Here fore example I was not able to catch if no variable "pincode" was configured in configuration.json.
Perhaps someone has an idea.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels