Git Product home page Git Product logo

esp8266-homekit's People

Contributors

adyipool avatar adysan avatar homeaccessorykid 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  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

esp8266-homekit's Issues

Help With Compiling

Hi, sorry I wasn't sure exactly where to put a question like this.

I'm new to GitHub and I'm just trying to follow the Build Instructions, when I try to compile the ESP8266-HomeKit using deploy.sh but instead of the expected success message Im getting "/bin/sh: xtensa-lx106-elf-gcc: command not found" a number of time after large blocks of what look like file paths, then at the end it says:

"make[2]: xtensa-lx106-elf-gcc: No such file or directory
make[2]: *** [.output/eagle/debug/obj/chacha.o] Error 1
make[1]: *** [.subdirs] Error 2
make: *** [.subdirs] Error 2"

I restarted from the beginning following the instruction as carefully as I could but have come up with the same thing, any advice would be appreciated

Web server for config

Either rest API or website for config would be good, like some of the other firmwares have.

Unreachable from other iOS device

Hi!
The code works as charm, but if I change my device e.g. to an iPad, the accessory is unreachable (while from the iOS device I've paired from is still works). Any idea?

Hanging in boot process after installation

I followed the Instructions in the Wiki. With the gen_misc.sh script i used the defaults and edited the files as recommended. I also tried it with flashing blank.bin and esp_init_data_default.bin: ~/Python/esptool/esptool.py --baud 230400 -p /dev/cu.SLAB_USBtoUART write_flash 0x00000 ../ESP8266_BIN/eagle.flash.bin 0x14000 ../ESP8266_BIN/eagle.irom0text.bin 0x3fe000 bin/blank.bin 0x3fc000 bin/esp_init_data_default.bin

The esp i am using is the: NodeMcu Amica V3 ESP-12E ESP12E 4MB FLASH
Workstation is a MacBook

This is what i receive if i connect to my esp via uart:

$ pio device monitor --port /dev/cu.SLAB_USBtoUART --baud 74880
--- Miniterm on /dev/cu.SLAB_USBtoUART  74880,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
load 0x40100000, len 30372, room 16
tail 4
chksum 0x88
load 0x3ffe8000, len 2860, room 4
tail 8
chksum 0xe9
load 0x3ffe8b40, len 3152, room 0
tail 0
chksum 0x9a

csum 0x9a
OS SDK ver: 1.5.0-dev(488a5a6) compiled @ Feb 27 2017 11:49:07
rf_cal[0] !=0x05,is 0xFF

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 30372, room 16
tail 4
chksum 0x88
load 0x3ffe8000, len 2860, room 4
tail 8
chksum 0xe9
load 0x3ffe8b40, len 3152, room 0
tail 0
chksum 0x9a
csum 0x9a
OS SDK ver: 1.5.0-dev(488a5a6) compiled @ Feb 27 2017 11:49:07
rf_cal[0] !=0x05,is 0xFF

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)
...
...
...
keeps rebooting as long as the power is connected

Any Idea what to do?

Toogle Switch

Hey !
I found a firmware pre-compile on the internet (here) and it runs great but I would like to make a change so that the switch is recognized as a tootgle (dry contact).

Can anyone help me ?

Use homekit on Arduino

Hello
I wish I could use homekit on the arduino IDE, does anyone know how?

Thanking you in advance

cordially

missing shell script

The build steps mention this file, but I can't find it anywhere.

../third_party/make_lib.sh

How to wipe SRP Key and Wi-Fi credentials

I paired and unpaired my ESP8266 with HomeKit. Now when I try to repair, they fail. I have traced this to the SRP Key and stored Wi-Fi credentials. How can I clear this part of the flash on the ESP8266?

This is the output in my console:

pairing 0, heap 19848, system time=7652
pairing 0, heap 19808, system time=10652
pairing 0, heap 19808, system time=13652
chas: 1.9=valF -> bool
pairing 0, heap 19808, system time=16652
pairing 0, heap 19808, system time=19652
pairing 0, heap 19808, system time=22652
pairing 0, heap 19808, system time=25652
pairing 0, heap 19808, system time=28652
chas: 1.9=valT -> bool
pairing 0, heap 19808, system time=31652

ENJOY

With pride and quite some delay I present to you my code base for the ESP8266
See https://youtu.be/Xnr-utWDIR8 for a demo

I am well aware that sections of the code need clean up, that I tend to use short variable names that everybody advices against and that not all code is optimal.
Yet I feel that the community will be able to improve on this and make the ESP8266 a very nice HomeKid platform. I hope to learn how to use GitHub with your help and to see many exciting Accessories in the years to come.

Enjoy! (and spread the word...)
HacK

Firmware Update Over The Air (FOTA)

I've started thinking about FOTA and how it should work for us.
Please add to these thoughts? Anyone got experience?

Some objectives I see for now:

  • a service will help to trigger the pulling of new software from the app (switch type, hidden?)
  • also a periodic pull can be supported
  • default will download from the code delivered by Travis (is this realistic, will this actually work?)
  • will work with the 1024=512+512 model (like till now we supported the 512 model)

Some issues I already see:

  • the user database is now at sector 0x13 but must move to 0x7A
    this is not backward compatible so should we offer a bin that migrates it or just instruction?
  • how do we introduce this? separate branch, forget about old system, make it mutual work...?
  • Is there an app for a firmware update service already that we can leverage or shall we write our own HK enabled app? (search in Apple spec for firmware and see the expectations)

Positive news:

  • because the other model, no adapted .ld file needed anymore
  • sector 0x7A seems to work for old and new approach.

Second distribution on GPLv2 license

Part of my doubt is that I would like people to be able to build and sell devices based on this library.
I see GPLv2 as an obstacle for that.
Still I consider to publish the same initial code under GPLv2 for a true open source community
Please indicate if there are people in favour of that and would prefer to deliver their attributions to the GPLv2 distribution over the Apache2 distribution.

TIA,
HacK

Thermostat Sensor example

Hi
I'm very interesting about this project, it looks very promise.
I'm not a developer guru, but can read and modify some code :)
I'm looking how to write thermostat code, I understand how to read temperature sensor
But can't understand how to store HEATING_THRESHOLD_TEMPERATURE_C
and where it can be stored

Also in your demo, I see how to get state from a sensor when it requested,
but how to get state continuously?
Like get the temperature from a sensor, compare with stored HEATING_THRESHOLD_TEMPERATURE_C and turn on or off relay when it needed, without interacting with homekit?

Installation problem

Hello, I have done everything as instructed in wikis and the result is below

esptool.py
 v2.0-beta2
Connecting....
Detecting chip type... ESP8266
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 230400
Changed.
Attaching SPI flash...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0040
Compressed 36432 bytes to 26362...
Wrote 36432 bytes (26362 compressed) at 0x00000000 in 1.2 seconds (effective 249.8 kbit/s)...
Hash of data verified.
Compressed 391572 bytes to 283524...
Wrote 391572 bytes (283524 compressed) at 0x00014000 in 12.5 seconds (effective 249.9 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...

but the esp8266 is not connecting to my AP although I have uncommented the user_init function and inserted my APssid and password correctly

Any ideas?

The future of this code base

Recently Maxim released a similar repository delivering the same functionality, based on my code.
This code is still in development and I would not run it for real life accessories just yet.
At the same time, Maxim does know how to write code a lot better than me.
I intend to invest in his code and bring it to the level where my code is currently, and beyond.

My code had also hit the limits of memory and flash size and I feel that Maxim's code will allow to overcome these better than my spaghetti code.

Finally, because he based his code in esp-open-rtos, more drivers and support are available to make real accessories come to life.

So, the effort has just been shifted sideways and up one gear.
I hope you will also join that bandwagon.

Source code organization

This is my first GitHub project and also writing c-code for ESP_RTOS is a first time.

In order to make this project as accessible as possible to others, help to suggest how to setup the directory structure and include structures etc... in a better way

Thanks in advance,
HacK

extending the API

... understanding more it seems the problem does not exist ... see last answer

Currently the API works but is a bit limited.
We can upload an initial value and a callback for a set of predefined cTypes.
All this is coded in the function addCharacteristic

However, there are cTypes that need more variables than that.

How do we feel we want additional variables to be conveyed to the more complex characteristics?

My best guess for now is to set up a few variables like item1 through item9 that if you set them before defining a characteristic they will set a particular variable of a particular characteristic.

Does anyone have a better idea??
PS, do not overcomplicate it please...

NOOS SDK

Thank you for your hard work.
I just setting my environment for esp dev. So I new in C.
Please tell me what point of using RTOS?
Is it possible to use NONOS?
Thank you.

RGB led example

sers=addAccessory(accs,++aid);
//service 0 describes the accessory
chas=addService(      sers,++iid,APPLE,ACCESSORY_INFORMATION_S);
addCharacteristic(chas,aid,++iid,APPLE,NAME_C,accname,NULL);
addCharacteristic(chas,aid,++iid,APPLE,MANUFACTURER_C,"Bio*X HOME",NULL);
addCharacteristic(chas,aid,++iid,APPLE,MODEL_C,"0.0.1 talqini",NULL);
addCharacteristic(chas,aid,++iid,APPLE,SERIAL_NUMBER_C,"BHQYKCH-2017-0001",NULL);
addCharacteristic(chas,aid,++iid,APPLE,IDENTIFY_C,NULL,identify);
//service 1
chas=addService(      sers,++iid,APPLE,LIGHTBULB_S);
addCharacteristic(chas,aid,++iid,APPLE,NAME_C,"QYK Chiroq",NULL);
addCharacteristic(chas,aid,++iid,APPLE,ON_C,"1",led);
//service 2
chas=addService(      sers,++iid,APPLE,LIGHTBULB_S);
addCharacteristic(chas,aid,++iid,APPLE,BRIGHTNESS_C,"1",rgbled);
addCharacteristic(chas,aid,++iid,APPLE,HUE_C,"1",rgbled);
addCharacteristic(chas,aid,++iid,APPLE,SATURATION_C,"1",rgbled);

Cannot pair

I've got everything to run up to the point where my ESP8622 with ESP8622-HomeKit-Demo is discoverable in the Home app. The app then asks me for the pairing code, which for me still is the default one.
However, the procss doesn't finish after 25 seconds for me as the tutorial states. It instead times out after 120 seconds, when the app tells me it cannot connect to the device. I tried to increase the clock speed to 80MHz in the build process, thinking that would help speeding up the crypto but to no avail.

Is there anything I can do to debug this process? How do I compile the code with debugging on?
I am, by the way on the current iOS 11 beta with all my devices, is anyone else experiencing problems on these?

video instruction

can someone make a video with instructions on how to make a homekit accessory from esp8266

Village at sha2017.org

A homekit village has been started by me.

I will attend at SHA2017, the famous hacker festival in the Netherlands held every 4 years.

I hope we can meet with likeminded HomeKit hackers and make the Arduino library or assembly crypto. And make those hardware items that have shown up the other day...

If you are interested, please leave a message or contact me at home-accessory-at-xs4all.nl

To Do List

This issue is intended is a working to do list. It will probably remain open during the life of this project.

To do

  • set clockspeed to 160MHz at crypto moments
  • maybe make IP based on link local addresses or
    remove the default gateway from the IP stack => security is improved if it can only talk locally
  • make sendbuffer before encrypt more automatic instead of +2x0x18
  • queuelength is maxtcpcon
  • replace plink_active with my own linked list of pcryp
  • remove existing connections coming from the same IP when new connection
  • unify all sends into data_send
  • use vTaskList to find stack usage
  • store clientkeys in an encrypted format
  • make remove invited key more robust
  • swap buffer for encrypt input with output and then it can grow what is needed
  • do encryption concatenation backward so you need a 0x400 input buffer max
  • verify is calculation of len in decrypt is OK, should be shifting with loop, right?
  • after deleteing a guest, track down existing TCP sessions and kill those
  • if tcp not encrypted within 2 seconds, close it
  • fix issue of notes8a.txt

Doing

  • Add Travis CI build job

Done

  • Change mdns flooding approach into a real bonjour strategy #32
  • only accept pair-setup URL if pairing
  • keepalive doesn't kill because events keep it awake or it is just broken! #13
  • use state=4 as criterion not to send more... #13
  • make identity a random value on factory reset
  • make a mdns routine that really builds the message #11
  • Reorganize code #2
  • make the callback routine responsible for init etc. by using a param to be multiuse
  • when disconnect, remove the event flag
  • if not encrypted, do not accept json messages
  • get random keys in place
  • change v for B in crytoinit
  • make SRP step 1 part of init in case of pairing
  • get debug printing conditional
  • implement GET /characteristics
  • make multiple clients work in parallel
  • event message
  • implement GET /identify
  • identify before pair
  • make an 'update' routine
  • make the setup of a characteristic a routine with some params
  • unify all routines in one file an make it a library
  • consider vTaskdelay in mdns loop
  • change decrypt out buffer from objects[3] to a dynamic buffer (if too big)
  • make pairing variables dynamic, not global
  • and do something usefull with this foundation ;-)
  • gpio stuff can be done without driver stuff??
  • consider espconn_find_connection
  • already prepare accessory message while verifying signature

Not possible

  • store myusername and mykey and peerkey in RTC-flash -- it is not flash but ram
  • make task stack value 256 instead of 2560 -- crashes and didn't make an advantage in heap report

Other Services doesnt work

I have compiled the code, and have been playing around with it a bit. Everything works fine for me, but if i want to change SWITCH_S service (button_led DEMO project) for example to MOTION_SENSOR_S
chas=addService( sers,++iid,APPLE,MOTION_SENSOR_S); addCharacteristic(chas,aid,++iid,APPLE,NAME_C,"motion",NULL); addCharacteristic(chas,aid,++iid,APPLE,MOTION_DETECTED_C,"1",NULL);
pairing doesnt work anymore and for other services - the same issue. What am i doing wrong? Thx in advance .

xQueue usage

Hi Thanks for such great firmware.

Just wondered that any particular reason that you are using queue system?

It increases complex and causing race conditions issue. Sometimes I am not able to pair due to packet sent before lock being removed.

Cheers
Jimmy Fan

Error: implicit declaration of function 'wc_HKDF'

Hello!
I'm using GNU toolchain (Windows)
After compiling and creating libwolfcrypt.a there is an error:

hkc.c: In function 'crypto_setup5':
hkc.c:1931:17: error: implicit declaration of function 'wc_HKDF' [-Werror=implicit-function-declaration]
             r = wc_HKDF(SHA512, srp.key, srp.keySz, esalt, esaltSz, einfo, einfoSz,
                 ^

Can in my case it is necessary to include any define?

Running into error when running ./gen_misc.sh

I keep running into this error, what are the steps to fix it?

xtensa-lx106-elf-gcc  -L/Volumes/ESPopenSDK/esp-open-sdk/ESP8266_RTOS_SDK/lib -Wl,--gc-sections -nostdlib -T/Volumes/ESPopenSDK/esp-open-sdk/ESP8266_RTOS_SDK/ld/eagle.app.v6.ld -Wl,--no-check-sections -u call_user_start -Wl,-static -Wl,--start-group -lcirom -lcrypto -lespconn -lespnow -lfreertos -lgcc -lhal -ljson -llwip -lmain -lmesh -lmirom -lnet80211 -lnopoll -lphy -lpp -lpwm -lsmartconfig -lspiffs -lssl -lwpa -lwps -lhkc user/.output/eagle/debug/lib/libuser.a driver/.output/eagle/debug/lib/libdriver.a wolfcrypt/.output/eagle/debug/lib/libwolfcrypt.a -Wl,--end-group -o .output/eagle/debug/image/eagle.app.v6.out 
/Volumes/ESPopenSDK/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/../../../../xtensa-lx106-elf/bin/ld: cannot find -lhkc
collect2: error: ld returned 1 exit status
make: *** [.output/eagle/debug/image/eagle.app.v6.out] Error 1

Motion Sensor Example?

I've been trying like crazy to build an example of a motion sensor working from a button/pir/etc (short IO to GND or High). I seem to fall short with the interrupts and having the push working as it should. Have anyone else tried this and had success?

HAP Bonjour Discovery

I've used espconn_mdns in ESP8266_NONOS_SDK to send HAP Bonjour Discovery packets with:
- host_name = "HAPTest"
- server_name = "hap"
- server_port = 661
- ipAddr = ...
- txt_data = {"c# = 1", "ci = 1", "ff = 0", "id = 1A:2B:3C:25:67:4F", "md = HAPTest", "pv = 1.0", "s# = 1", "sf = 1"}

These packets have been showing up in Discovery - Bonjour Browser (https://itunes.apple.com/us/app/discovery-bonjour-browser/id305441017?mt=8) but Home app cannot find them (there is no accessory showing up in Home app).

My question is why you use mdns char array instead of espconn_mdns to send HAP Bonjour Discovery packets; and why Home app can not find accessory was made by espconn_mdns in ESP8266_NONOS_SDK as i did?

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.