1 Star 0 Fork 0

疯如初 / smart-home

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

Smart Home

Chinese Version 中文版


This is my smart home solution.

The server is deployed on openwrt router.

The project is not completed yet.

Welcome to contribute it.

Document is updating.

You may carry out secondary development to apply to your furniture.


If you want to learn more about or want to contribute mi home protocal c++ implementation, you might go to miio-cpp.

Demo

front-end-door-img front-end-aircondition-img

Realized furniture

  • Air Condition
    • name: 小米互联网空调X(1.5匹|变频|新一级能效)
    • type: urn:miot-spec-v2:device:air-conditioner:0000A004:xiaomi-mt2:1
    • implement by miio protocol
  • Door
    • access controller: 微耕门禁控制器(WG2051)
    • implement by wiegand SDK

Start

You need a server to depoly the Smart Home

This is my depoly example

I depoly the smart home server on my router:

  • model: NETGEAR WNDR4300
  • firmware version: OpenWrt 19.07.5 r11257-5090152ae3

Set Parameter

BTW, it is not a good idea to set parameter directly into source code. I will optimize it later.

  1. Go to smart-home-server/main.cpp
//TODO: Put your air condition ip address here
#define AIRCONDITION_IP_ADDRESS  ""
//TODO: Put your air condition token here
#define AIRCONDITION_TOKEN ""
  1. Go to smart-home-server/door.cpp
//TODO: Put your door port here
#define DOOR_UDP_SERVER_PORT   0
//TODO: Put your door ip address here
#define DOOR_IP_ADDRESS  ""
  1. Go to front-end/smart-home-api.php
//TODO: put your server api url here
$address = 'http://127.0.0.1:12345/smart-home-api';

Depoly Server

  1. Get the cross compiler in openwrt developer tools

openwrt developer guide

  1. Compile back up part

You maybe want to modify makefile

make type=openwrt
  1. Reserve port 12345 from your server

The http server of smart-home-server will listen the port for api

  1. Run
smart-home-server

Maybe you want to use linux screen

  1. Set the front-end into a http server such as nginx/apache/etc.

Security

Security policy relies on firewall of the router.

Planning to do the account system in the next version.

Code Structure

(To be perfected)

  • front-end Front End
  • smart-home-server Back End

Secondary Develop Guide

For more Mi Home device, you may develop them based on smart-home-server/mi-home-device.*

Mi Home Device Protocal Documentaion will be helpful.

You may treat smart-home-server as a core of furniture to develop (at least I do so).

Go to miio-cpp learn more detail about mi home c++ protocol

Library

Statement

We do not assume any responsibility

Contact

Blog: https://frc6.com

Email: i@frc6.com

QQ: 2093003592

Comments ( 0 )

Sign in for post a comment

About

我的智能家庭解决方案,目前包括了小米空调,微耕门禁,服务器选择部署在软路由上。 expand collapse
C++ and 6 more languages
Cancel

Releases

No release

Contributors

All

Activities

load more
can not load any more
C++
1
https://gitee.com/frccyr/smart-home.git
git@gitee.com:frccyr/smart-home.git
frccyr
smart-home
smart-home
master

Search