GithubHelp home page GithubHelp logo

mixiaoxiao / arduino-homekit-esp32 Goto Github PK

View Code? Open in Web Editor NEW
211.0 211.0 58.0 2.16 MB

[Deprecated] Native Apple HomeKit accessory implementation for the ESP32 Arduino core.

License: MIT License

C 97.99% C++ 2.01%
esp32 homekit homekit-adk

arduino-homekit-esp32's People

Contributors

mixiaoxiao 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

arduino-homekit-esp32's Issues

ESP Button For Multiple outputs

How will i be able to connect multiple outputs with respective buttons?
i've tried multiple ways. but it is not working properly. can you suggest the way ahead?

homekit_storage_reset() causes a crash

I added "homekit_storage_reset ()" right before "Init Button" in the example. ESP32 started rebooting constantly because of this. When I delete "homekit_storage_reset ()", the device works but still remembers the old keys.

Guru Meditation Error: Core  0 panic'ed (StoreProhibited). Exception was unhandled.
Core 0 register dump:
PC      : 0x4000c314  PS      : 0x00060f30  A0      : 0x800d7283  A1      : 0x3ffb1ef0  
A2      : 0x00000000  A3      : 0x3ffb1f30  A4      : 0x00000004  A5      : 0x00000000  
A6      : 0x00000000  A7      : 0x00000000  A8      : 0x00000000  A9      : 0x3ffb1ed0  
A10     : 0x3ffbe83c  A11     : 0x3f401382  A12     : 0x3f401382  A13     : 0x3ffb6610  
A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x00000004  EXCCAUSE: 0x0000001d  
EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff  

Backtrace: 0x4000c314:0x3ffb1ef0 0x400d7280:0x3ffb1f00 0x400d74e4:0x3ffb1f20 0x400d1984:0x3ffb1f50 0x400ebaa3:0x3ffb1fb0 0x4008835d:0x3ffb1fd0

Rebooting...
ets Jun  8 2016 00:22:57

I added "homekit_storage_reset ()" because I wanted to delete the saved keys from the previous iPhone.

Dependencies

Can you please share which versions of each library you are using? I am trying to improve this project with "ESPConnect" shared by ayushsharma82, and I didi it before, but then I lose documentation regarding dependencies and now I got a lot of errors cause of libreries versions (i hope)

ESPButton - doubleclick?

I can't do doubleclick with this example, someone can explain how to do that?

20:17:44.112 -> >>> [1175246] HomeKit: heap: 247576, sockets: 1
20:17:46.573 -> [1177734] ESPButton: change (down)
20:17:46.610 -> [1177734] ESPButton: not stable
20:17:46.610 -> [1177750] ESPButton: not stable
20:17:46.610 -> [1177766] ESPButton: not stable
20:17:46.647 -> [1177782] ESPButton: t: 1177782, raw: 1177734
20:17:46.647 -> [1177782] ESPButton: stable (down)
20:17:46.681 -> [1177830] ESPButton: change (up)
20:17:46.681 -> [1177830] ESPButton: not stable
20:17:46.716 -> [1177846] ESPButton: not stable
20:17:46.716 -> [1177862] ESPButton: not stable
20:17:46.716 -> [1177878] ESPButton: t: 1177878, raw: 1177830
20:17:46.755 -> [1177878] ESPButton: stable (up)
20:17:46.755 -> [1177878] ESPButton: Button(0): SingleClick
20:17:46.755 -> ButtonEvent: SingleClick

every time I try do a double click is only single click, someone try the untouched ESPButton.h code?

ESP32S3

Is there any version of this library that works with esp32s3?

can't create 2 devices

I tried to use 2 different esp8266 module, but there are some conflicts if both module in same LAN.
does anybody had same problem?

STA Connection looping

Hello, I appriciate your work, library is Great!

I faced one strange issue. Not sure if it is connected, but it happened only to multiply accessories devices. So I have Lightbulb, temperature sensor, humidity sensor, 2x switches and a smoke sensor at one ESP32.

I also added EPROM to remember statuses when electicity shuting down. Adresses i used:

  • int addressInt1 = 0;
  • int addressBool1 = sizeof(int);
  • int addressBool2 = sizeof(int) + sizeof(bool);

Everything worked perfect during 3 days so I tried to automate it using Commands (defualt IPhone App). I know it gonna work with Home Center, but Commands give you oportunity to automate your accessories even you have no IPad/Apple TV/Home Pod. So I configuered my lightbulb (it has only &cha_on, &cha_bright UI) to turn on at 6am and one more to turn off at 3pm. It worked for 3 days and then my device jumped to status "Not responding".

Now I am trying to figure out what happened. I added Serial Port for debugging and faced this:

12:49:18.044 -> Gr eiainErr oe0 ai'd(nerp d ieu nCU)
12:49:18.044 -> oe 0rgse up
C   :0404e6 S   :00003 A    x81faae A    x360 
A    x3a2 A    x0000 A    x0004 A    x0007 
12:49:18.122 -> 6   :0354 7   :00000 A    x8155 9   :0360 
A0   x3a2 A1   x401 A2   x3cd0 1   :00000 
12:49:18.122 -> 1   :00000 1   :00000 SR   x0001 ECAS x0000 
12:49:18.122 -> XVDR:00000 LE   x40c2 LN   x40c2 LON  xffffffff 
12:49:18.122 -> 
12:49:18.122 -> akrc: x088:xffb57041faab:xffb5b0040f9:xffb53 x08f4:xffb57

oe 1rgse up
C   :0401 S   :00004 0   :0802 A    x3f1 
12:49:18.122 -> 2   :065 3   :00000 A    x0000 A    x0002 
12:49:18.122 -> 6   :00002 A    x300 8   :0680 9   :0efffffff 
12:49:18.122 -> 1   :0e5e A1   x0002 A2   x0005 A3   xefffffff 
12:49:18.122 -> 1   :0e5e A5   x0000 SR   x0000 XCUE:00000 
12:49:18.122 -> XVDR:00000 LE   x40c2 LN   x40c2 LON  xffffffff 
12:49:18.122 -> 
12:49:18.122 -> akrc: x08dae:xffb10 x08ac303f3 x086703f5 x0d26:xffb100407f:xffb100409103fb00408903fd0

Rboig.
ets Jun  8 2016 00:22:57
12:49:25.019 -> 
12:49:25.019 -> rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
12:49:25.065 -> configsip: 0, SPIWP:0xee
12:49:25.065 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
12:49:25.065 -> mode:DIO, clock div:2
12:49:25.065 -> load:0x3fff0018,len:4
12:49:25.065 -> load:0x3fff001c,len:1216
12:49:25.065 -> ho 0 tail 12 room 4
12:49:25.065 -> load:0x40078000,len:9720
12:49:25.065 -> ho 0 tail 12 room 4
12:49:25.065 -> load:0x40080400,len:6364
12:49:25.065 -> entry 0x400806b8
12:49:25.451 -> [ESPConnect][40] STA Pre-configured:
12:49:25.451 -> [ESPConnect][40] SSID: MyWiFy
12:49:25.451 -> [ESPConnect][40] Password: MyPassword
12:49:25.451 -> 
12:49:25.451 -> [ESPConnect][40] Connecting to STA [#������������'��'�����'���'

then it stay in loop with broken characters "������������'��'�����'���"

After rebooting device - it is connecting well and working some time ( up to week):

error: homekit/types.h: No such file or directory

ResolveLibrary(homekit/types.h)
  -> 候选: []
/Users/wisonlau/Desktop/Arduino-HomeKit-ESP32-master/examples/ESP32_homekit_wolfssl_4_3_0/ESP32_homekit/builtin_led_accessory.c:10:27: fatal error: homekit/types.h: No such file or directory
compilation terminated.
为 “arduino_homekit_server.h” 找到了多个库
  使用:/Users/wisonlau/Documents/Arduino/libraries/ESPHap
  未使用:/Users/wisonlau/Documents/Arduino/libraries/HomeKit-ESP8266
使用 1.0 版本的 WiFi 库,在列出的文件夹中:/Users/wisonlau/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/WiFi
使用 1.1 版本的 ESPHap 库,在列出的文件夹中:/Users/wisonlau/Documents/Arduino/libraries/ESPHap
使用 1.1 版本的 Ticker 库,在列出的文件夹中:/Users/wisonlau/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/Ticker
exit status 1

Compilation error: homekit/types.h: No such file or directory

2 IOS cannot pair with one device

Hi @Mixiaoxiao .
I have problem with this library.
when the fist IOS device pairs with ESP8266 homeKit, the second IOS device not pair with it ?
can u solve this problem ? Thanks you !

Can't update door status in Homekit

First of all thank you @Mixiaoxiao for this great library!

I try to use Homekit for our door opener via a relay that supplies the door opener with power for 3 seconds at a time.
After the 3 seconds the door status should return to "Closed" (1) in Homekit.
Unfortunately, the status in Homekit remains in "Open", even if I use homkit_characteristic_notify

`#include <Arduino.h>
#include <arduino_homekit_server.h>
#include "wifi_info.h"
#define LOG_D(fmt, ...) printf_P(PSTR(fmt "\n") , ##VA_ARGS);

int relay = 15; // Pin D8

void setup() {
pinMode(relay, OUTPUT);
Serial.begin(115200);
wifi_connect();
//homekit_storage_reset();
my_homekit_setup();
}

void loop() {
my_homekit_loop();
delay(10);
}

//==============================
// HomeKit setup and loop
//==============================

// Zugriff auf die Definitionen des Accessories in my_accessory.c
extern "C" homekit_server_config_t config;

extern "C" homekit_characteristic_t cha_lock_current_state;
extern "C" homekit_characteristic_t cha_lock_target_state;

static uint32_t next_heap_millis = 0;

// Diese Funktion wird aufgerufen, wenn das Schloss via HomeKit betätigt wird
void set_lock(const homekit_value_t value) {
uint8_t state = value.int_value;
cha_lock_current_state.value.int_value = state;
if(state == 0){
// Schloss wurde via HomeKit geöffnet
open_lock();
}
if(state == 1){
// Schloss wurde via HomeKit geschlossen
close_lock();
}
// HomeKit-Status aktualisieren
homekit_characteristic_notify(&cha_lock_current_state, cha_lock_current_state.value);
}

void my_homekit_setup() {

cha_lock_target_state.setter = set_lock;
arduino_homekit_setup(&config);

}

void my_homekit_loop() {
arduino_homekit_loop();
const uint32_t t = millis();
if (t > next_heap_millis) {
// heap-Info alle 30 Sekunden im seriellen Monitor ausgeben
next_heap_millis = t + 30 * 1000;
LOG_D("Free heap: %d, HomeKit clients: %d",
ESP.getFreeHeap(), arduino_homekit_connected_clients_count());

}
}

/* Diese beiden Funktionen werden aufgerufen, wenn das Schloss in HomeKit betätigt wird */
void open_lock(){
Serial.println("Schloss öffnen");
// hier beliebige Aktion einfügen
digitalWrite(relay, HIGH);
cha_lock_current_state.value.int_value = 0;
homekit_characteristic_notify(&cha_lock_current_state, cha_lock_current_state.value);

delay(3000);
digitalWrite(relay, LOW);
cha_lock_current_state.value.int_value = 1;
homekit_characteristic_notify(&cha_lock_current_state, cha_lock_current_state.value);
}

void close_lock(){
Serial.println("Schloss schließen");
// hier beliebige Aktion einfügen
digitalWrite(relay, LOW);
}`

"Not Response" in iPhone Home.app

I am using the example from the library. I added ESP32 to my Home.app on the iPhone. Everything worked fine. After restarting ESP32, I get the message "Not Response" on my iPhone, usually 2 or 3 ESP32 restarts help and I can control the built-in LED again.

I have found this problem arises when sockets is less than 1 (0 or -1).

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.