@mrdj863 interesting, I was wondering if there were any devices besides Nanoleaf using HAP over Thread currently. What is it broadcasting? _hap._udp
?
Wow surprised to see you on this thread lambda.
Actually in the code block that you were helping me troubleshoot that I posted on your thread, there is a cluster of Nanoleaf bulbs and in between it is Encode Plus, which is this lock.
I didn’t get a chance to work out my IPv6 settings on my ubiquity network but when I’m home next week, I plan on digging deeper.
Looks like hap.udp
2022-08-23 20:27:52.102 DEBUG (MainThread) [homeassistant.components.zeroconf] service_update: type=_hap._udp.local. name=Encode Plus._hap._udp.local. state_change=ServiceStateChange.Updated
2022-08-23 20:27:52.103 DEBUG (MainThread) [homeassistant.components.zeroconf] service_update: type=_hap._udp.local. name=Nanoleaf A19 7BSK._hap._udp.local. state_change=ServiceStateChange.Updated
2022-08-23 20:27:52.103 DEBUG (MainThread) [homeassistant.components.zeroconf] Discovered new device Encode Plus._hap._udp.local. ZeroconfServiceInfo(host='fd54:6e34:1e50:0:ecc5:dea1:f1c9:609d', addresses=['fd54:6e34:1e50:0:ecc5:dea1:f1c9:609d'], port=5683, hostname='Encode-Plus.local.', type='_hap._udp.local.', name='Encode Plus._hap._udp.local.', properties={'_raw': {'c#': b'1', 'ff': b'1', 'id': b'C8:15:DD:9E:F2:31', 'md': b'be499WB', 'pv': b'1.2', 's#': b'7', 'sf': b'0', 'ci': b'6', 'sh': b'VYYK3A=='}, 'c#': '1', 'ff': '1', 'id': 'C8:15:DD:9E:F2:31', 'md': 'be499WB', 'pv': '1.2', 's#': '7', 'sf': '0', 'ci': '6', 'sh': 'VYYK3A=='})
2022-08-23 20:27:52.104 DEBUG (MainThread) [homeassistant.components.zeroconf] Discovered new device Nanoleaf A19 7BSK._hap._udp.local. ZeroconfServiceInfo(host='fd54:6e34:1e50:0:d179:d25a:4f37:5d36', addresses=['fd54:6e34:1e50:0:d179:d25a:4f37:5d36'], port=5683, hostname='Nanoleaf-A19-7BSK.local.', type='_hap._udp.local.', name='Nanoleaf A19 7BSK._hap._udp.local.', properties={'_raw': {'c#': b'2', 'ff': b'2', 'id': b'35:F9:9C:95:D5:B9', 'md': b'NL45', 'pv': b'1.2', 's#': b'91', 'sf': b'0', 'ci': b'5', 'sh': b'vW6VBA=='}, 'c#': '2', 'ff': '2', 'id': '35:F9:9C:95:D5:B9', 'md': 'NL45', 'pv': '1.2', 's#': '91', 'sf': '0', 'ci': '5', 'sh': 'vW6VBA=='})
Yep, that should work with my HAP/Thread code. The tricky part is getting HAP devices on a Thread network without pairing them. If the ZC property sf
is 0, the device is already paired and cannot be added to HA. HAP/BLE was also released in 2022.8 which may be worth a try.
EDIT: Someone should try removing the device from the Apple Home app & see if the lock sticks around on Thread (advertising _hap._udp
but with a new ID). If so, congrats, it is now pairable with HA.
@punk-kaos Great news, I got stuck on the auth and gave up… Happy to test, I have 5 Encodes and would love to have them in HASS.
Yeah, that Cognito auth is kinda rough, but thats good for security. And it doesn’t help that some of the data is hard coded in the APK, luckily it all was there when I de-ODEXed the APK.
I’m leaning towards making it an MQTT bridge, as that’ll work for lots of automation platforms. I’ll toss something out fairly soon if my day is slow today.
Ok, this is really dirty right now but it does work… Most of the time.
Put your app username and pass in at the top, then run.
It will output the current lock state to the console, then attempt to lock the door(You can change it from lock/unlock in the call near the bottom) then it will sleep 10 seconds and query the state again.
It does work, it toggles the lock HOWEVER it doesn’t always seem to do it consistently and I’ve not yet figured out why that is yet…
Once I do I plan to wrap it in an MQTT lib so it’ll talk nicely to anything you like via MQTT but I have to sort out why its being cranky first. I’m open to suggestions!
Well… After powercycling my lock it seems to be working perfectly. I’m gonna test a bit more but that intermittent issue might have been totally with the lock itself.
Just tested, worked to lock my lock without any changes to the code (just creds).
I have multiple locks so will likely have to iterate through the device list and sort each lock into an object.
Awesome! Nice to see confirmation I’m not crazy!
Yeah, it assumes right now that there’s only one lock for simplicity. Once I flesh it out a bit I’ll have it check for multiple locks. Its already pulling the first lock ID so it has the tools needed.
Had a couple more minutes to play with code, I wrapped it in an MQTT wrapper, it now will connect to an MQTT broker and provide lock status updates every 30 seconds as well as accept lock/unlock commands via MQTT. That should be enough to get it working in most home automation frameworks!
Any plans to make it a full on integration in HASS?
Truthfully I don’t use HASS. I’m on OpenHAB, I just stumbled in here looking for info on the Schlage API via Google when I got frustrated with how little ability to integrate with it there was. This was just the only source of bread crumbs on what it was doing internally that I could find so when that was enough for me to crack the code I wanted to pay that info back with some working code.
All that to say, probably not because I’d have to learn HASS. But you never know…
Thats fine, I can build it… didnt want to do double the work.
Works for me! I’m happy to provide any support I can, just let me know!
Thanks, keep us in the loop if you come up with an integration! I was working the Yonomi angle but they didn’t want to work with individuals.
Thanks for the groundwork!
My pleasure! Glad I can share something useful! I’ve been running this with my home automation setup for the last 5 days and so far its pretty solid. Not too bad for something hacked together in an afternoon Mcnutter1 was going to look into bringing it to full integration status, so hopefully it’ll get there in the near future. But for now it should work ok as an MQTT client.
First, thank thank you punk-kaos and everyone who has been working at a solution!
I apologize in advance for my ignorance, but if I want to try and test this right away, do I just drop this file (doorlock.py) into a subfolder under custom_components and modify the text to suit my case (i.e. input username, password, & mqtt broker)? or is there more I need to do here?
Almost.
I configured an MQTT lock; restarted HA to pickup new configs; downloaded doorlock.py; configured the username
, password
with my Schlage credentials; configured broker
, port
, topic
with my MQTT info; installed python dependencies (in a virtualenv, by trying to run doorlock.py, getting an error, pip installing the dependency); let doorlock.py run forever; profit!
I appreciate the response. The part I am struggling with is running doorlock.py in a virtual environment. What can/should I use given that I am running HASS on a PI 4B? AppDaemon?
AppDaemon is the path I have been pursuing so far, but without success. It seems AppDaemon is looking for a class statement (i.e. class DoorLock(hass.Hass) ) within doorlock.py , which it then wants called out within the apps.yaml file…??
…so it seems I’m stuck
any help would be appreciated.