Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持OpenIoTHub的接入(自动发现) #5

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 28 additions & 67 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,28 @@
# Continuous Integration (CI) is the practice, in software
# engineering, of merging all developer working copies with a shared mainline
# several times a day < https://docs.platformio.org/page/ci/index.html >
#
# Documentation:
#
# * Travis CI Embedded Builds with PlatformIO
# < https://docs.travis-ci.com/user/integration/platformio/ >
#
# * PlatformIO integration with Travis CI
# < https://docs.platformio.org/page/ci/travis.html >
#
# * User Guide for `platformio ci` command
# < https://docs.platformio.org/page/userguide/cmd_ci.html >
#
#
# Please choose one of the following templates (proposed below) and uncomment
# it (remove "# " before each line) or use own configuration according to the
# Travis CI documentation (see above).
#


#
# Template #1: General project. Test it using existing `platformio.ini`.
#

# language: python
# python:
# - "2.7"
#
# sudo: false
# cache:
# directories:
# - "~/.platformio"
#
# install:
# - pip install -U platformio
# - platformio update
#
# script:
# - platformio run


#
# Template #2: The project is intended to be used as a library with examples.
#

# language: python
# python:
# - "2.7"
#
# sudo: false
# cache:
# directories:
# - "~/.platformio"
#
# env:
# - PLATFORMIO_CI_SRC=path/to/test/file.c
# - PLATFORMIO_CI_SRC=examples/file.ino
# - PLATFORMIO_CI_SRC=path/to/test/directory
#
# install:
# - pip install -U platformio
# - platformio update
#
# script:
# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N
language: python
python:
- '2.7'
sudo: false
cache:
directories:
- "~/.platformio"
install:
- pip install -U platformio
- platformio update
script:
- mkdir build
- platformio ci --keep-build-dir --build-dir ./build --lib="./lib/esp_framework/src" --lib="./lib/esp_framework/include" --project-conf=platformio.ini
src/main.cpp
before_deploy:
- platformio ci -h
- ls -a
- find . -name "*.bin"
# deploy:
# provider: releases
# api_key:
# secure: FNZS+KTgsSo6QAZgncYmZLNHfuqCnD2yRQkjj4GYl5M1vNGTSncmZMTVoH3oFHmpsNG3wZ0G/c8yT48Fxhn1T/aGSAXxlffeJ36XN+5gSrPFk+dkHdV26X9tpCglUTkOMydtlJCQQJBd0km0XlniFKV0guDezWADvwERegHXf/CaiZY/YccorfHbJxDF9e765aYVY+bvkixOoC9iXMYBdbYTACqFPddr5x2LfdRNDMLlP29XYO/5909e9xU3fy06LgisYHQgYpTfAyASYqmxL0Qhugd2Z71VY098NRDfdA1agmnKM9nhjwYG791eqmKVSVZ4UUe7dCjHe9czd0tHMGiP8nz+bxCKNIZsDm/drHwP6FPx0eHyKb8eY3czvRT6onrBdzJHUtCl55NbUgk3W/ijj9U1BlzyA3uSIavNAXsK4R8Tf24G4qXtcq6MJos/STh2viBxHGvboTfAqxy3F/pVwNmgupW4GIZYds0/OZ302xSpUtFO37IR9SaAaMb0/O/3Td768DkuesaWymU7Gv1NDkMMYX3lttGLIOTz/qyXp8FAn5zvDyMhJDkb3xyJ45yQajp+LRwxxZ7bQmmoAzIO18Tst/GWDe8NxpeQCA3eKmLGvjunV+WfIto5O6cSfMjZKtI15WTbh25IXWEIABjD2BMiOoCt7oh6mXIGACM=
# file:
# - "build/.pio/build/dc1/firmware.bin"
# skip_cleanup: true
# on:
# repo: IoTDevice/esp_dc1
# tags: true
20 changes: 20 additions & 0 deletions OpenIoTHubSupport.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@


本文档介绍对于[OpenIoTHub](https://github.com/OpenIoTHub/OpenIoTHub)app的支持.



## app操作界面
* 目前初步是以webUI方式打开,从[v1.2.7](https://github.com/OpenIoTHub/OpenIoTHub/releases/tag/v1.2.7)开始支持,以后通过app升级方式提供native操作界面
![image](./file/images/app/device-list.jpg)
![image](./file/images/app/ui.jpg)
![image](./file/images/app/device-info.jpg)

## 如何配网
1、第一次使用自动进入配网模式
2、以后通过长按【总开关】进入配网模式

## 使用方法
- app下载:https://github.com/OpenIoTHub/OpenIoTHub/releases v1.2.7+
- app打开“智能”选项卡(如图1)即可搜索到之前已经配网成功的插排
- app远程控制可以使用OpenIoTHub[网关](https://github.com/OpenIoTHub/gateway-go) (通过网关可以支持本固件插排的远程使用)
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,23 @@ ioBroker是基于nodejs的物联网的集成平台,为物联网设备提供核
#### 接入方法
ioBroker相关接入问题可以加QQ群776817275咨询

### 3、其他支持mqtt的平台
### 3、OpenIoTHub(云易连)
OpenIoTHub是一个开源的物联网平台,系统由app,网关,服务器组成,支持app配网和发现,通过网关可以是原本只能在局域网操控的设备支持远程操控。
#### 接入方法
详见[OpenIoTHubSupport.md](./OpenIoTHubSupport.md)

### 4、其他支持mqtt的平台
理论上来说,只要是支持MQTT的平台都可以实现接入。

#### 接入方法
添加对应的topic

# 固件截图

![image](https://github.com/qlwz/esp_dc1/blob/master/file/images/tab1.png)
![image](https://github.com/qlwz/esp_dc1/blob/master/file/images/tab2.png)
![image](https://github.com/qlwz/esp_dc1/blob/master/file/images/tab3.png)
![image](https://github.com/qlwz/esp_dc1/blob/master/file/images/tab4.png)
![image](./file/images/tab1.png)
![image](./file/images/tab2.png)
![image](./file/images/tab3.png)
![image](./file/images/tab4.png)

## 致谢
以下排名不分先后,为随机。
Expand Down
Binary file added file/images/app/device-info.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added file/images/app/device-list.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added file/images/app/ui.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 18 additions & 1 deletion lib/esp_framework/src/Http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,24 @@ void Http::begin()
{
module->httpAdd(server);
}
MDNS.begin(UID);
//MDNS.begin(UID);
while (WiFi.status() != WL_CONNECTED) {
Debug::AddInfo("wait wifi connection...");
delay(500);
}
if (!MDNS.begin(UID)) {
Debug::AddInfo("Error setting up MDNS responder!");
}
MDNS.addService("iotdevice", "tcp", globalConfig.http.port);
MDNS.addServiceTxt("iotdevice", "tcp", "name", module->getModuleCNName());
MDNS.addServiceTxt("iotdevice", "tcp", "model", "com.94qing.devices.esp_dc1");
MDNS.addServiceTxt("iotdevice", "tcp", "mac", WiFi.macAddress());
MDNS.addServiceTxt("iotdevice", "tcp", "id", ESP.getSketchMD5());
MDNS.addServiceTxt("iotdevice", "tcp", "author", module->getModuleAuthor());
MDNS.addServiceTxt("iotdevice", "tcp", "email", "[email protected]");
MDNS.addServiceTxt("iotdevice", "tcp", "home-page", "https://github.com/qlwz");
MDNS.addServiceTxt("iotdevice", "tcp", "firmware-respository", "https://github.com/qlwz/esp_dc1");
MDNS.addServiceTxt("iotdevice", "tcp", "firmware-version", module ? module->getModuleVersion() : F("0"));
server->begin(globalConfig.http.port);
Debug::AddInfo(PSTR("HTTP server started port: %d"), globalConfig.http.port);
}
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ board = esp01_1m
board_build.f_cpu = 80000000L
board_build.flash_mode = dout
board_build.ldscript = eagle.flash.1m.ld

lib_ldf_mode = deep
; *** Esp8266 core for Arduino version 2.6.1
platform = [email protected]
build_flags = -D NDEBUG
Expand Down