Coder Social home page Coder Social logo

balassamarton / dreamdesk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ma-lwa-re/dreamdesk

0.0 0.0 0.0 127 KB

Framework that makes compatible any electrical standing desk with a home automation solution like Apple Homekit, Google Home, or Amazon Alexa, allowing your desk to be controlled by your phone, a computer, or a home speaker.

Home Page: https://ma.lwa.re/dreamdesk

License: MIT License

C 98.37% CMake 1.63%

dreamdesk's Introduction

The Dreamdesk Project

The aim of this project was to create a framework that makes compatible any electrical standing desk with a home automation solution like Apple Homekit, Google Home, or Amazon Alexa, allowing your desk to be controlled by your phone, a computer, or a home speaker.

It has been tested and currently works with any desk relying on the Dynamic Motion system by Logicdata, like the Yaasa Desks, Gravit iDesk, or the Lidle LifeUP in addition to the IKEA Bekant desks.

The code was developped in C for the ESP32 microcontrollers family. A detailed write-up about the project is available at

Config

Select Features

Edit the CMakeLists.txt file to select what kind of desk you want to control and other optional features. The project version will be used to check if a newer version is available during the OTA update process.

# REQUIRED: Choose your desk type (LOGICDATA | IKEA)
set(DESK_TYPE "LOGICDATA")

# OPTIONAL: Choose your home automation ecosystem (HOMEKIT | NEST | ALEXA | NONE)
set(HOME_AUTOMATION "HOMEKIT")

# OPTIONAL: Enable sensors (ON | OFF)
set(SENSORS ON)

# OPTIONAL: Set the temperature scale (C | F | K)
set(SENSORS_SCALE "C")

# OPTIONAL: Enable Over The Air (OTA) updates (ON | OFF)
set(OTA_UPDATES ON)

# OPTIONAL: Set the project version
set(PROJECT_VER "2.4.0.1")

Setup

Espressif SDK

git clone -b v4.4 --recursive https://github.com/espressif/esp-idf.git esp-idf-v4.4
cd esp-idf-v4.4
bash install.sh
source export.sh

HomeKit ADK

ESP-IDF currently uses MbedTLS 2.16.x, whereas HomeKit ADK requires 2.18. A branch mbedtls-2.16.6-adk is being maintained here which has the required patches from 2.18, on top of 2.16.6.

cd $IDF_PATH/components/mbedtls/mbedtls
git pull
git checkout -b mbedtls-2.16.6-adk origin/mbedtls-2.16.6-adk
cd $IDF_PATH/../
git clone --recursive https://github.com/espressif/esp-apple-homekit-adk.git

HomeKit Setup Code

cd $IDF_PATH/../esp-apple-homekit-adk/homekit_adk
make tools
cd Tools
./provision_raspi.sh --category 14 --setup-code 133-71-337 --setup-id DDSK Dreamdesk
cd Dreamdesk
cp ../../../tools/accessory_setup/accessory_setup.csv .
python $IDF_PATH/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py generate accessory_setup.csv accessory_setup.bin 0x6000
esptool.py -p $ESPPORT write_flash 0x34C000 accessory_setup.bin

Resetting HomeKit Pairing

The accessory pairing information is stored in the NVS (Non Volatile Storage) partition. Once paired, the accessory cannot be paired again, without clearing this pairing information first. It can be done as below:

esptool.py -p $ESPPORT erase_region 0x10000 0x6000

Dreamdesk

cd $IDF_PATH/../
git clone --recursive https://github.com/ma-lwa-re/dreamdesk.git
cd dreamdesk
idf.py set-target esp32s3
export ESPPORT=/dev/cu.usbserial-0001
idf.py build flash

Wifi

The wifi credentials were previously hardcoded in the wifi.h header, but are now directly written in a standalone partition on the ESP32.

It has the advantage that no secrets are stored in the code section anymore, and thus allows the same code to run on multiple devices, over-the-air (OTA) updates, or modification of wifi credentials without having to reflash the device.

cp wifi.csv $IDF_PATH/components/nvs_flash/nvs_partition_generator
cd $IDF_PATH/components/nvs_flash/nvs_partition_generator
# Edit the wifi.csv and replace the DEFAULT_SSID and DEFAULT_PASSWORD strings
python3 nvs_partition_gen.py generate wifi.csv wifi.bin 0x3000
esptool.py -p $ESPPORT write_flash 0x340000 wifi.bin

Code Signing

The integrity of the application can be secure and checked using an RSA signature scheme. The binary is signed after compilation with the private key that can be generated with espsecure.py or openssl, and the corresponding public key is embedded into the binary for verification.

espsecure.py generate_signing_key --version 2 secure_boot_signing_key.pem

The bootloader will be compiled with code to verify that an app is signed before booting it. In addition, the signature will be also proofed before updating the firmware and adds significant security against network-based attacks by preventing spoofing of OTA updates.

Console Output

sudo cu -l $ESPPORT -s 115200

Project

dreamdesk
├── CMakeLists.txt
├── README.md
├── main
│   ├── CMakeLists.txt
│   ├── dreamdesk.c
│   ├── dreamdesk.h
│   ├── homekit.c
│   ├── homekit.h
│   ├── ikea.c
│   ├── ikea.h
│   ├── lin.c
│   ├── lin.h
│   ├── logicdata.c
│   ├── logicdata.h
│   ├── main.c
│   ├── sensors.c
│   ├── sensors.h
│   ├── wifi.c
│   └── wifi.h
├── partitions.csv
├── sdkconfig
└── sdkconfig.defaults

TODO

  • IKEA desk testing
  • PCB prototype
  • PCB assembly
  • OTA updates
  • NVS encryption
  • HomeKit memory integration
  • HomeKit sensors integration
  • Sensors (humidity + air + temperature)
  • Google Home support
  • Amazon Alexa support
  • Dump Logicdata firwmare

Feedback & Issues

Issues and feature requests should be raised on GitHub using

dreamdesk's People

Contributors

ma-lwa-re avatar

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.