Schlage Encode Plus

1 Like

Got it working! Thank you very much! Now I can make sure my door is locked and alert if it has been left open!

Check the above few posts!

Is the schlage integration local or needs to cloud?

Right now, because the Encode Plus won’t work through the Homekit integration, the integration a couple of posts above is the only option, and it’s cloud dependent, since it’s using Schlage’s cloud API.

I setup a local-only integration between the Encode Plus and Apple Home. After some tweaks it’s been working great for ~6 months.

This “manual” sync of the lock state between HA and Apple Home allows for locking and unlocking the lock from Home Assistant, and for the lock status to change in HA when it changes in Apple Home.

The lock is paired with Homekit in Apple Home, so that I can use the Home Key feature of the lock.

I have an Apple device that acts as an Apple Home hub.

The benefit of also running the Schlage integration in HACS is to get the lock battery % into HA.

Template lock:

lock:
  - platform: template
    name: Front Door Lock
    value_template: "{{ is_state('input_boolean.front_door_lock_status', 'on') }}"
    unlock:
      service: input_boolean.turn_on
      data:
        entity_id: input_boolean.front_door_lock_action_unlock
    lock:
      service: input_boolean.turn_on
      data:
        entity_id: input_boolean.front_door_lock_action_lock

Helpers – input booleans

Home Assistant Automations:

alias: Front Door Lock – actions – unlock
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.front_door_lock_action_unlock
    to: "on"
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id:
        - input_boolean.front_door_lock_action_unlock
mode: single
alias: Front Door Lock – actions – lock
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.front_door_lock_action_lock
    to: "on"
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id: input_boolean.front_door_lock_action_lock
mode: single

HA Homekit Bridge

homekit:
  name: "HA Bridge YAML"
  filter:
    include_entities:
        - input_boolean.front_door_lock_status
        - input_boolean.front_door_lock_action_unlock
        - input_boolean.front_door_lock_action_lock

Apple Home Automations:

3 Likes

How do you get it into HA from HomeKit? Also, what device are you using as an Apple Home hub?

How do you get it into HA from HomeKit?

HA exposes 3 input booleans (switch helpers) to HomeKit. Automations configured in Apple Home set the state of the status helper, and react to lock state changes in HA via the “action” helpers. Please see the final section/screenshot in my earlier post for a summary of the 4 automations involved.

When the lock status changes on the Apple Home side (e.g. unlocked via the knob), then the Apple Home automation sets the “lock status” switch (e.g. to off).

When the template lock on the HA side changes (e.g. unlock is requested), then an Apple Home Automation that is watching the “action unlock” helper switch acts by unlocking the door.

Also, what device are you using as an Apple Home hub?

HomePod Mini originally, because it’s the cheapest. I later got a recent Apple TV, and wish I had gone straight for the Apple TV (because I am using https://www.scrypted.app and the camera generates sooo much WiFi traffic when the HomePod Mini is the active hub).

1 Like

Ahhhhh, sorry, yes I see now, you’re not directly integrating the lock, you’re essentially using virtual switches and automations to sync them between the HA side and the HomeKit side.

I am glad I bought the 128GB/Ethernet model of the Apple TV just last week then, I was considering a Home Pod but I hate WiFi, so out of principle I got the Apple TV, even it is just going to be an expensive “hub”.

All good, glad to help! That’s exactly right :smile:.

/offtopic follows :wink:

…Apple TV…expensive “hub”.

Yep, the HomePod Mini is sitting in a corner of my office now, muted (I long-ago standardized on Google devices for voice control and whole-home audio [for better or for worse]).

I really want to like the Apple TV as a streaming device vs. the Chromecast w/ Google TV. The Apple TV interface is snappy vs. the incessant UI lag on all of Google’s devices. But my family has found it annoying to browse content on iPhone and not be able to “cast” it onto the TV with a couple taps…so the Apple TV is relegated to a secondary role…

1 Like

Not sure if this is a reason for hope or not, but it seems to me a change was just put into aiohomekit that may address the bluetooth pairing with the Encode Plus. That gets merged into the homekit controller coponent in HA core. If that’s true, not sure how long it will take to roll up into an HA monthly stable release. Maybe somebody using beta releases for HA can see it already?
Here are some of relevant links:
Handle missing perms when decoding the GATT database by bdraco · Pull Request #320 · Jc2k/aiohomekit (github.com)
Bump aiohomekit to 2.6.16 by bdraco · Pull Request #98490 · home-assistant/core (github.com)

1 Like

Will give it a shot if and when it happens!

I have several of these locks now and wanted to follow your lead on a local option using HomeKit. If I am reading the automation correctly, you have a 20 second delay before turning off/on the input_boolean that would signal to HomeKit to lock/unlcok the lock. Curious about the need for the delay. Is it necessary to avoid things getting out of sync? or other purpose.

TIA

Since this Schlage lock is now in HA proper and the HACS version is no longer needed I’m wondering if this work around for those of us wanting to use Homekey is still the preferred method. I tried adding this template to my configuration.yml but the helpers did not appear for me. So the automations reference non-existent entities. I have the bridge configured but need the helpers to send to HomeKit at this point. Any pointers on what I may need to do or may have done wrong appreciated.

Just realized I needed to add the code for the helpers to the configuration.yml as well.

When you mentioned that using the Schlage integration as well is good for battery state…Doesn’t that defeat the purpose of using Homekit, Apple HUB, and having this run on Thread?

Wouldn’t Schlage integration still need WIFI to get the battery status, or would this still somehow remain on Thread?

These now show as merged, does that mean so long as I am running the latest Home Assistant, this should now work? :open_mouth:

You are right, the Schlage cloud integration in HA core is used to get the battery status – and this requires the lock to be on Wi-Fi.

The reason I setup the HomeKit bits is because I wanted lock/unlock to function locally. If there were a way to get the battery status into HA locally, I would :).

I continue to use this HA-HomeKit setup for local control of lock and it’s been 99-100% reliable. As you said, I started down this path because Apple Home Key support was critical and non-negotiable for my needs.

The only issue I’ve had is sometimes after restarting HA the lock will show as unlocked even though it’s locked. I usually resolve this by “re-locking” the lock from HA, which propagates back to HA from HomeKit to tell HA that the lock is indeed locked.

You have the Encode Plus directly paired to HA via the Homekit integration? And then you’re exporting it back out to Apple Home via the HA Homebridge integration?

The Apple Home Key still works if you do that?