Giter VIP home page Giter VIP logo

homekey-esp32's People

Contributors

rednblkx avatar z-pi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homekey-esp32's Issues

Home key not working on home kit

Hi thanks for your job
Ido all in the document and all running well.
The mqtt in home assistant working and talking with homkit well.
But if im scanning my iphone its give me OK but nothing do in home kit.
What i need to do to fix that?
Thanks for all
IMG_2185
IMG_2184

image

HomeKey Authenticating Issue

First of all thank you and congrats for putting this together!

I managed to get the project working on an ESP32 with PN532 connected through SPI and I've paired it with HomeKit. The homekey is added to wallet, the "dummy" switch works, however the key does not seem to toggle the switch. Phone responds to the ECP by selecting the key but the authentication does not succeed, ending with a red (!) mark saying "Try again". I tried manually selecting the key but nothing changes.

This is the last part of the logs on the serial monitor:

[...]
Response Status: 91
 DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF  DE AD BE EE FF DE AD BE EE FF 

SHARED KEY:   DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE
DERIVED KEY:  DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE

DATA MATERIAL:  DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DEDE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE

KEYING MATERIAL:  DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE

DATA MATERIAL:  DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DEDE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DEDE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE

KEYING MATERIAL:  DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE
PERSISTENT KEY:  DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE
VOLATILE KEY:  DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE
KENC:  DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE 
KMAC:  DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF DE 
KRMAC:  DE AD BE EE FF DE AD BE EE FF DE AD BE EE FF
 DE AD BE EE FF DE AD BE
DE AD BE EE FF DE AD BE

decrypted data: 
decrypted length: 0


SOMETHING WENT WRONG
 80 3C 00 00

Response Status: 3

Any idea what might be wrong, or is this not implemented yet?

Thank you!

cant compile

Hi
currently i´ll get the following issue:

src/main.cpp: In member function 'virtual void LockMechanism::loop()':
src/main.cpp:156:109: error: no matching function for call to 'PN532::readPassiveTargetID(int, uint8_t [16], uint8_t*, uint16_t [1], uint8_t [1], int, bool)'

Do you see the same?
Best
Thorsten

1 out of 2 home devices fails to utilize express mode.

The latest build has issues when polling the HomeKey on my iPhone 12 Pro iOS 17.0. My partner's iPhone 15 Pro Max iOS 17.3 has no issue with Express mode. I tried pairing it from both of our devices. I erased ESP32 flash multiple times. I rebooted phone, but issue persisted.

Looking at the logs I get:
at the beginning when pairing the lock:

Starting HAP Server on port 80 supporting 9 simultaneous HomeKit Controller Connections...

DEVICE NOT YET PAIRED -- PLEASE PAIR WITH HOMEKIT APP
[...]
*** ERROR: Unrecognized Controller PairingID

Then when approaching the reader I get:

I (284881) LockMechanism: *** PASSIVE TARGET DETECTED ***

This is the same behavior as when I'm approaching a random NFC card. However, using the HomeKey in the Wallet the authentication succeeds.

Any idea what's going on?
I can't seem to change the log level. It said it's on Level 2 but I see no difference from level 0. I'm starting to wonder if the issue is with my phone, however Express Mode works in other circumstances (with transit cards)

Crash?

Hi
didnt realize that this is why it´s propably often not working.
Also the iPhone is often not triggering the "apple value add" thing which triggers the HomeKey to be presented.
Does this panic does help in any directon?

`I (3797) HKAuthCtx: Ephemeral Key generated
E (4025) HKAuthCtx: Response Status not 0x90, something went wrong!
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

Core 1 register dump:
PC : 0x400d45de PS : 0x00060d30 A0 : 0x800e557e A1 : 0x3ffc42a0
A2 : 0x3ffc4418 A3 : 0x3ffc4458 A4 : 0x00000001 A5 : 0x00000000
A6 : 0x00000fb9 A7 : 0x3f405164 A8 : 0x800d45da A9 : 0x3ffc4280
A10 : 0x00000000 A11 : 0x3ffc42fc A12 : 0x00000004 A13 : 0x3ffc4320
A14 : 0x3ffc42f0 A15 : 0x3ffc434c SAR : 0x0000001b EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000001 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffd

Backtrace: 0x400d45db:0x3ffc42a0 0x400e557b:0x3ffc4400 0x400f563f:0x3ffc45a0 0x400f5747:0x3ffc4670 0x400d4d76:0x3ffc4690 0x4011791d:0x3ffc46b0

#0 0x400d45db:0x3ffc42a0 in AuthenticationContext::fast_auth(bool) at src/auth/authContext.cpp:415
#1 0x400e557b:0x3ffc4400 in LockMechanism::loop() at src/main.cpp:179
#2 0x400f563f:0x3ffc45a0 in Span::pollTask() at .pio/libdeps/wemos_d1_mini32/HomeSpan/src/HomeSpan.cpp:278
#3 0x400f5747:0x3ffc4670 in Span::poll() at .pio/libdeps/wemos_d1_mini32/HomeSpan/src/HomeSpan.cpp:164
#4 0x400d4d76:0x3ffc4690 in loop() at src/main.cpp:871
#5 0x4011791d:0x3ffc46b0 in loopTask(void*) at /Users/thorsten/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:50

ELF file SHA256: 30765105d23cddf3

Rebooting...
ets Jul 29 2019 12:21:46
`

Homekit lock not toggle

I'm using homebrige and added the HK lock generaed by this project.
Installed Mosquitto on my respberry pi so I'm connected and and looks but.
I also set MQTT_HOMEKEY_ALWAYS_UNLOCK = 1 since I want it only to onlock and I will create an automation to lock it by sensor state.
But I can only unlock it in homekit.
If I click lock it seems like it stuck on loading.
Anyone knows why?

My config:

// MQTT Broker Settings
#define MQTT_HOST "MY_IP" // IP adress of mqtt broker
#define MQTT_PORT 1884 // Port of mqtt broker
#define MQTT_CLIENTID "homekey_mqtt" // client-id to connect to mqtt broker
#define MQTT_USERNAME "MY_PASSWORD" // username to connect to mqtt broker
#define MQTT_PASSWORD "MY_PASSWORD" // password to connect to mqtt broker

// MQTT Flags
#define MQTT_CUSTOM_STATE_ENABLED 0 // Flag to enable the use of custom states and relevant MQTT Topics
#define MQTT_HOMEKEY_ALWAYS_UNLOCK 1 // Flag indicating if a successful Homekey authentication should always set and publish the unlock state
#define MQTT_HOMEKEY_ALWAYS_LOCK 0 // Flag indicating if a successful Homekey authentication should always set and publish the lock state

// MQTT Topics
#define MQTT_CUSTOM_STATE_TOPIC "topic/custom_state" // MQTT Topic for publishing custom lock state
#define MQTT_CUSTOM_STATE_CTRL_TOPIC "topic/set_custom_state" // MQTT Control Topic with custom lock state
#define MQTT_AUTH_TOPIC "topic/auth" // MQTT Topic for publishing HomeKey authentication data or RFID UID
#define MQTT_SET_STATE_TOPIC "topic/set_state" // MQTT Control Topic for the HomeKit lock state (current and target)
#define MQTT_SET_TARGET_STATE_TOPIC "topic/set_target_state" // MQTT Control Topic for the HomeKit lock target state
#define MQTT_SET_CURRENT_STATE_TOPIC "topic/set_current_state" // MQTT Control Topic for the HomeKit lock current state
#define MQTT_STATE_TOPIC "topic/state" // MQTT Topic for publishing the HomeKit lock target state

// Miscellaneous
#define HK_CODE "46637726" // code used for homekit setup
#define LED_PIN 2 // status led pin, built in is pin 2
#define OTA_PWD "homespan-ota" // custom password for ota
#define NAME "HK Lock" // Device name
#define DISCOVERY 0 // Enable or disable discovery for home assistant tags functionality, set to 1 to enable.
#define CONTROL_PIN 26 // GPIO Pin for a Configuration Mode button (more info on https://github.com/HomeSpan/HomeSpan/blob/master/docs/UserGuide.md#device-configuration-mode)

[Upload issue]: overlap at address: 0x1000

It builds fine but uploading fails with:

esptool write_flash: error: argument <address> <filename>: Detected overlap at address: 0x1000 for file: ~HomeKey-ESP32/.pio/build/release/bootloader.bin

I built it with the project fresh/clean. PIO VSCode add-on is latest version.
I'm using an ESP32 dev module.

ESPHome

Any chance you will be able to integrate your project with ESPHome? There are thousands of Homeassistant users that already have ESPHome integrated with their deployments – adding an ESP32-based HomeKey lock would be amazing!!!

Can't get Wifi connected, ESP rebooting constantly

Hi,

i compiled and flashed on a ESP32-WROOM-32, it's booting but there is constantly output flowing over the screen i cannot press W + Enter or A nor it's doesn't react to the cables shortended between GND and GPIO26, what i am doing wrong?

I can also upload pictures and or console output if i am able to capture because its constaly repeating things.

EDIT: this repeats constantly in serial console:

`
I (1020) SETUP: setup > HOMEKEY ISSUERS: 0


                                                        Welcome to HomeSpan!
                                                                            Apple HomeKit for the Espressif ESP-32 WROOM and Arduino IDE
                                                                                                                                        ************************************************************

                                                                                                                                                                                                    ** Please ensure serial monitor is set to transmit <newlines>

                                                                                                                                                                                                                                                                 Message Logs:     Level 0
                                                                                                                                                                                                                                                                                          Status LED:       Pin 2  (Auto Off=15 sec)
       Device Control:   Pin 26
                               Sketch Version:   1
                                                  HomeSpan Version: 1.9.0
                                                                         Arduino-ESP Ver.: 2.0.16
                                                                                                 ESP-IDF Version:  4.4.7
                                                                                                                        ESP32 Chip:       ESP32-D0WD-V3 Rev 3 dual-core 4MB Flash
                                                                                                                                                                                 ESP32 Board:      esp32
                                                                                                                                                                                                        PWM Resources:    16 channels, 8 timers, max 20-bit duty resolution
                                                                                                                                                                                                                                                                           Sodium Version:   1.0.12-idf  Lib 9.4
                                                                                                                                                                                                                                                                                                                MbedTLS Version:  Mbed TLS 2.28.7
                    Sketch Compiled:  Jun  6 2024 22:40:50
                                                          Partition:        app0I (3088) system_api: Base MAC address is not set

I (3089) system_api: read default base MAC address from EFUSE

MAC Address: 0C:B8:15:XX:XX:XX

                               Device Name:      HK Lock

                                                        ets Jul 29 2019 12:21:46

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:5596
ho 0 tail 12 room 4
load:0x40078000,len:15860
load:0x40080400,len:3624
entry 0x4008064c
W (172) boot.esp32: PRO CPU has been reset by WDT.
W (172) boot.esp32: WDT reset info: PRO CPU PC=0x40082ba1
W (174) boot.esp32: WDT reset info: APP CPU PC=0x40089ff8
I (790) cpu_start: Multicore app
I (790) cpu_start: Pro cpu up.
I (791) cpu_start: Starting app cpu, entry point is 0x40082150
I (0) cpu_start: App cpu up.
I (808) cpu_start: Pro cpu start user code
I (809) cpu_start: cpu freq: 240000000
I (809) cpu_start: Application information:
I (813) cpu_start: Project name: HomeKey-ESP32
I (819) cpu_start: App version: 1
I (823) cpu_start: Compile time: Jun 6 2024 22:37:34
I (829) cpu_start: ELF file SHA256: c0fac961be02dcb6...
I (835) cpu_start: ESP-IDF: 4.4.7
I (840) cpu_start: Min chip rev: v0.0
I (844) cpu_start: Max chip rev: v3.99
I (849) cpu_start: Chip rev: v3.0
I (854) heap_init: Initializing. RAM available for dynamic allocation:
I (861) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (867) heap_init: At 3FFBB650 len 000249B0 (146 KiB): DRAM
I (874) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (880) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (886) heap_init: At 40098CA8 len 00007358 (28 KiB): IRAM
I (894) spi_flash: detected chip: gd
I (897) spi_flash: flash io: dio
I (906) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
II (929) gpio: GPIO[26]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (930) gpio: GPIO[2]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0

Generating SRP verification data for new Setup Code: 466-37-726 ... New Code Saved!
Setup Payload for Optional QR Code: X-HM://00057L40U

`

It looks like its rebooting all the time.

W (172) boot.esp32: PRO CPU has been reset by WDT.
W (172) boot.esp32: WDT reset info: PRO CPU PC=0x40082ba1
W (174) boot.esp32: WDT reset info: APP CPU PC=0x40089ff8

Best Regards X23

buzzer and LED

HI,
I would like to implement your project on my home automation.
I saw how your device works and with a small plugin that I wrote in Python I am able to integrate it into my domoticz hub
I wanted to ask you if you could include in the code the use of a simple buzzer (for reading confirmation of the NFC device) and some LEDs to be used on MQTT to be turned on for your own use (you can integrate it with DISCOVERY of Home Assistant)
Thank you very much for your time on this project.

Esp32 WT32-ETH01

Hi how its possible to working with ESP32 WT32-ETH01
Its esp with LAN Cable.
I don't want working on WiFi
Thanks for all your job its the best way i see🙏

Just found this amazing item on AliExpress. Check it out! ₪37.61 67% Off | WT32-ETH01 Embedded Serial Port Networking Ethernet Bluetooth-compatible WIFI Combo Gateway MCU ESP32 Wireless Module Board
https://a.aliexpress.com/_EvBJprt

No recovery from failed PN532 communication

I’ve got a reader in a place with a wifi antenna, switching power supply and 230v wiring all nearby.
It was rock solid when I tried it for a week at my desk without these noisy neighbours.
But with all this interference it seems to loose the communication with the PN532 after a while and when it does it never recovers until i reset it.
In this state it’s reachable via Mqtt and works normally in HomeKit but no longer responds to nfc tags or homekeys.
I’ve managed to improve the wiring SPI placement so it now lasts a day instead of a few hours, but it would probably be a good idea to retry if SPI with the pn532 fails

Didn't find PN53x board

image

I have this error. PN532 is correctly connected with LED on. Wiring is correct according guide.

I use this board

image

What I'm doing wrong?

HKAuthCtx: fast_auth > FAST Flow failed!

Hi
i´m meanwhile have new NFC readers (different brands) and multiple ESPs...
Unfortunaintly the new code always shows me "HKAuthCtx: fast_auth > FAST Flow failed!"
Is there anything i can share which helps to troubleshoot this?

It had earlier not worked perfect (code till EOY23) - but with the new code it seems never working.
Is this maybe related to multiple Homekit-controllers (2 AppleTV and 1 iPod mini)

Thanks for any advice
Kind regards
Thorsten

Convert to esp-homekit-sdk

Hello, first of all thank you for doing a really great project. I want to ask if there is any way to use it in esp-homekit-sdk, because my project needs to use esp-idf to deeply access some hardware functions.

[FR] Ability to keep lock state after reboot

I’ve noticed that after power outages or randomly (probably due to ESP32 reboots) the state of the lock changes to unlocked in Home app, although that does not trigger any mqtt message to be sent in order to mess with automations. However, while in that state (HomeKey lock entity state unlocked but actual lock locked) it messes with the HomeKey authentication and automation logic in the sense that when scanning the HomeKey it will broadcast a lock mqtt message when I actually want to unlock the door, so nothing happens. If a second HomeKey authentication is attempted, the actual lock will unlock since they are now both (HomeKey entity and actual lock) in sync.

Anyone else has this issue?
Am I doing something wrong?
Is there any way we can keep the lock state after reboots/power outages?

Thanks!

Home Assistant Discovery not working?

Hello, thanks for that project!
For me almost everything is working fine, but the device does not show up in HASS.
I set DISCOVERY to 1 in the config file, but it is not recognized and the tags section in HASS is empty.
What did I miss?

Lock entity not not getting toggled

I just updated to the latest main commit and I'm having issues with getting the Lock entity toggled. I can't toggle it manually either.
When using the HomeKey it doesn't react. When doing manually it hangs on "Unlocking" in the Home app with the following logs in serial monitor:

I (179621) LockMechanism: update > New LockState=0, Current LockState=1
I (546199) LockMechanism: update > New LockState=1, Current LockState=1
I (549684) LockMechanism: update > New LockState=0, Current LockState=1
I (552368) LockMechanism: update > New LockState=1, Current LockState=1
I (554962) LockMechanism: update > New LockState=0, Current LockState=1

Is this just me?

Running on ethernet (WT32-ETH01) - restart loop every 10 sec

I have an WT32-ETH01 (ESP32 with LAN 8720 ethernet chipset and RJ45 port) and HomeKey-ESP32 works fine in WiFi mode on this board (needed to change pins_arduino.h to make it work: SS = 4; MOSI = 23; MISO = 19; SCK = 18;). I was then adapting the Ethernet modification for HomeSpan (HomeSpan/HomeSpan#738) and was trying to integrate it with HomeKey-ESP32. The program launches and ethernet connection works, the WT32-ETH01 reacts to random NFC cards and I can see MQTT messages coming through. But every 10 sec the device does a restart with the message "*** FACTORY RESET! Restarting...".

Not publishing RFID Cards

Thank you for making this awesome project, it's working perfectly with my Apple devices and publishing the data to MQTT. I just have one problem the esp32 is not publishing the UID or any other information when reading a passive card. The log shows the UID but it is not published to the MQTT "Auth" topic. Is there something I need to activate to get this to work?
Screenshot 2024-02-11 at 15 08 23
Screenshot 2024-02-11 at 15 08 38

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.