Skip to content

Commit

Permalink
Upstream develop (#5)
Browse files Browse the repository at this point in the history
* 🔥 Remove hardcoded keepalive - fix homieiot#301 (homieiot#314)

Remove hardcoded KeepAlive for MQTT connection.
Default value of 15sec is already present in AsyncMQTT library

* 🐎 Improve uptime accuracy (homieiot#315)

improve uptime accuracy by storing milliseconds and only rounding when
publishing value
drawback: less time before rollover, but still long enough

* 🐛 Fix truncated IP (homieiot#318)

published IP is truncated.

* 🎨 Fix warning with parenthesis

* 🐛 Fix pio library.json bad dependency name

* ✨ Add support for static IP and BSSID/MAC, channel of AP (homieiot#327)

* Support for static IP and BSSID/MAC, Channel of AP

- added parameters to config.json which allow to define static ip, mask,
gateway, dns
- added parameters to config.json which allow to define BSSID and
channel of AP

To run device with defined static IP you have to define ip, mask and
gateway together.

To point device to connect to specific BSSID and channel you haveto
define bssid and channel together.

```
{

	"name": "The kitchen light",
	"device_id": "kitchen-light",
	"wifi": {
		"ssid": "Network_1",
		"password": "I'm a Wi-Fi password!",
		"bssid":
		"DE:AD:BE:EF:BA:BE",
		"channel": 1,
		"ip": "192.168.1.5",
		"mask": "255.255.255.0",
		"gw": "192.168.1.1"
	},
	"mqtt": {
		"host": "192.168.1.10",
		"port": 1883,
		"base_topic": "devices/",
		"auth": true,
		"username": "user",
		"password": "pass" i
	},
	"ota": {
		"enabled": true
	},
	"settings": {
		"param1": 55,
		"param2": "abcdefghijklm",
		"param3": true,
		"param4": false,
		"param5": 2147483647,
		"param6": -2147483647,
		"param7": 55,
		"param8": "abcdefghijklm",
		"param9": true,
		"param10": false
	}
}
```

* Addjustments for travis

* Another addjustments for travis

* Fix problem with prepareToSleep

* 🐎 Pass all callbacks by reference
Still store it by value

* 🐎 Make isActive const

* 🎨 Add custom settings value to initial log

* ✨ Abort if default setting value does not pass validator function
Fix homieiot#324

* 📝 Clarify ISSUE_TEMPLATE docs location for homieiot#331

* 📝 Implement new versioned Git docs (homieiot#341)

* ✨ Add versionned in-repo docs

* 🐛 Attempt to fix encrypted key

* 🐛 Fix permission issue on python exec

* 🐛 Add mission import

* 🐛 Fix relative path

* 🐛 Add missing commit

* ✨ Add index

* 🎨 Change index design

* 📝 Update all URLs to new docs

* 🎨 Fix broken doc link in README

* 📝 Add edit link to docs

* 📝 Move firmware_parser.py to scripts folder

* 🐛 Fix out of limits abort message not showing

* 👕 Be less strict on whitespace in comments

* 📝 Add dummy OTA updater script (TODO)

* 🎨 🐎 Use CircleCi instead of Travis CI (homieiot#348)

* ✨ Add Circle CI build

* 🐛 Add working_directory

* 🐛 Attempt to fix perm issue

* ✨ Generate docs from CircleCI

* 🐛 Fix path

* 🐛 Fix chmod permission

* 🐛 Try to run sudo

* 🐛 Attempt to use remote docker

* 🐛 Change bad directories

* 🐛 Remove dependency on Docker

* 🐛 Fix perm problem

* 🐛 Chamge tmp folder

* 🐎 Use CircleCI instead of Travis CI

* 🎨 Add SonoffDualShutters example

* 🐛 Install current lib to platformio

* 🐛 Actually ignore gh-pages in CI

* 🐛 Add missing SonoffDual dep

* 🐛 Fix ArduinoJSON 5.11.0 (homieiot#363)

* ⬆️ Update pio dependencies

* 🎨 Cleanup code a bit

* 🐛 Make sure every announcements packet are sent - closes homieiot#345

* 🎨 Refactor code and implement new OTA system
Closes homieiot#346

* 👕 Fix lint

* ✅ Use new workflow feature from Circle

* ✅ Ignore gh-pages at workflow level

* ✨ Add OTA_PROGRESS event

* 📝 Update docs for new OTA system

* ⬆️ Upgrade AsyncMqttClient dependency to 0.8.0

* 🐛 IHomieSetting::settings first, HomieNode-settings second! (homieiot#335)

*  IHomieSetting::settings first, HomieNode-settings second!

Set initialization priority of IHomieSetting::settings to value of highest allowed priority (101).

This allows other static variables to be of type HomieSetting<T>.

See https://github.com/euphi/HomieNodeCollection/blob/master/src/RGBWNode.cpp for example.

Note: As shown in the example it makes sense to have a static HomieSetting member, if you have a class that may be instantiated multiple times. (e.g. two LED Strips connected to the same ESP8266, as shown in https://github.com/euphi/ESP-LEDCtrl).

* Removed extra whitespaces

* Removed another whitespace

* 🐛 Fix not returning a value in setConfigurationApPassword (homieiot#378)

`HomieClass& HomieClass::setConfigurationApPassword(const char* password)` did not returned a reference to the Homie instance. This PR fixes this.

* 🐛 Fix crash when starting up without any defined node (homieiot#379)

* Fix crash when starting up without any defined node

Skip node publication if HomieNode::nodes.size() == 0

* Update BootNormal.cpp

* 🐛 Fix topic check for OTA upload (homieiot#375)

* Change topic check for OTA upload

* Change firmware topics to remove the 's'

* 🐛 Rename last OTA topic instance

* ✨ Add OTA updater script (homieiot#384)

* 🐍Add python ota updater script

* 💼 Update documentation of ota update script

* 😑 Add comments to ota updater script

* 🔮 Use 127.0.0.1:1883 as default broker setting

For the ota updater script

* 📝 Add details on how to interact with range property (homieiot#393)

Add hint to help people figure out how to interact with
range properties. Especially document the `_` separator.

* 📝 Add warning to input-handlers.md about concurrency (homieiot#400)

* 🐛 Interpret firmware file as an bytearray (homieiot#403)

Fix homieiot#397

* 📝 Update input-handlers.md (homieiot#401)

* Update input-handlers.md

Sorry, it seems that I used the `!!! warning` block in a wrong way.

* Update input-handlers.md

* Update input-handlers.md

* ✨ Use AsyncWebServer + Refactoring (homieiot#425)

* Initial AsyncWebServer

* Fixed Proccessing Body Requests (JSON)

* Doc Fixes + typo

* Added Missing Method in Timer.cpp

* Lots of Refactoring + Moved Reset Button to its own helper class for boots to use

* 🎨 Update BootNormal.cpp (homieiot#426)

Solve "else" errors from https://circleci.com/gh/marvinroger/homie-esp8266/136#tests/containers/0

* ⬆️ Update dependency to "ESP Async WebServer" (homieiot#434)

* 📝 Add instruction for @platformio (homieiot#435)

* Instruction for @platformio

* Explain how to used tagged version with @platformio

* Explain how to use tagged version with @platformio

* 🐛 Use v2.0.0-beta.2 as a working tagged example for @platformio (homieiot#437)

* 🎨 Simplify CI with @platformio (homieiot#438)

* 🐛 Install library via @platformio with all dependencies (homieiot#439)

* 💚 CI: Install staging version of Arduino Core for ESP8266 & @platformio (homieiot#440)

* 🐛 Pin Shutters dep version

* 🔥 Don't fail on CI docs step when testing a fork

* 🎨 More Refactoring + Deep Sleep + Prevent WiFi Reconnect when reboot (homieiot#432)

* Initial AsyncWebServer

* Fixed Proccessing Body Requests (JSON)

* Doc Fixes + typo

* Added Missing Method in Timer.cpp

* Lots of Refactoring + Moved Reset Button to its own helper class for boots to use

* Lots of Refactoring.

* Refactored ResetHandler + More Refactoring + Testing

* Added deep sleep function + Prevent Wifi reconnect before reboot (homieiot#380)[homieiot#380]

* Small typo fixes

* Small Rearange of code in BootConfig + Minor Refactor of function names

* Minior Commit to Triger a Github Action

* circleci build fix

* 🎨 First pass to fix linting

* 🎨 Second pass of lint

* 🎨 Final lint fix

* 📝 Update docs deps

* 📝 🎨 Update docs manifest

* 📝 🎨 Adjust HTTP JSON API doc

* 📝 Add configurators on website

* 📝 Update links to configurator

* Fix links under Features (homieiot#452)

* Set Device Stats Interval (homieiot#451) (homieiot#455)

* Add last step to uibundle README (homieiot#460)

* Add last step to uibundle README

* Added Arduino Support for doc

* Update updater script addressing quirks (homieiot#461)

* Update API for /wifi/connect from GET to PUT (homieiot#468)

Docs show `/wifi/connect` as `GET` when it should actually be `PUT`

* Proposal to optionally run HomieNode::loop() also in disconnected state

* Show Homie version

* Fix homieiot#446 homieiot#477 (homieiot#501)

* Fix homieiot#446 CORS Issue

* Fix for homieiot#477

* Fix Lint

* Fix Safari not displaying the config bundle HTML page (Fix homieiot#476) (homieiot#502)

* Fix Safari not displaying the config bundle HTML page

Safari cannot deal with gzip files that have a "*.gz" file extension.
Simply faking the filename solves the problem though.

* Update Readme Homie Version

* Fix Warnings (homieiot#503)

* Update Readme - Homie Convention

* Update to Homie Convention v2.0.1 (homieiot#507)
  • Loading branch information
euphi authored Mar 31, 2018
1 parent f976875 commit b99e393
Show file tree
Hide file tree
Showing 92 changed files with 3,983 additions and 1,107 deletions.
11 changes: 11 additions & 0 deletions .circleci/assets/circleci.ignore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/python:2.7
branches:
ignore:
- gh-pages
steps:
- checkout
33 changes: 33 additions & 0 deletions .circleci/assets/configurator_v1.html

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions .circleci/assets/docs_index_template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<!doctype html>
<html lang="en">
<head>
<title>Homie for ESP8266 docs</title>

<meta charset="utf-8">

<style>
body {
background-color: #ef5350;
}

#content {
width: 512px;

margin: auto;

text-align: center;
}

h1, h2, a {
font-family: "Segoe UI", Helvetica, Arial, sans-serif;
}

h1, h2 {
color: white;
}

ul {
list-style-type: none;
}

li {
width: 100%;
height: 50px;

margin-bottom: 10px;

background-color: #ecf0f1;
border-bottom: 3px solid #bdc3c7;

line-height: 50px;
}

a {
display: block;
width: 100%;
height: 100%;

font-size: 30px;
text-decoration: none;
color: #2c3e50;
}

.description {
font-size: 15px;
color: #34495e;
}
</style>
</head>

<body>
<div id="content">
<h1>Homie for ESP8266 docs</h1>

<h2>Configurators</h2>

$configurators_html

<h2>Documentation</h2>

$documentation_html
</div>
</body>
</html>
130 changes: 130 additions & 0 deletions .circleci/assets/generate_docs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import json
import urllib
import urllib2
import tempfile
import zipfile
import glob
import subprocess
import getopt
import sys
import shutil
import os
import string

FIRST_RELEASE_ID=3084382
DOCS_PATH = 'docs'
DOCS_BRANCHES = [
{ 'tag': 'develop', 'description': 'develop branch (development)', 'path': 'develop' },
{ 'tag': 'master', 'description': 'master branch (stable)', 'path': 'stable' }
]
CONFIGURATORS_PATH = 'configurators'
CONFIGURATORS_VERSIONS = [
{ 'title': 'v2', 'description': 'For Homie v2.x.x', 'path': 'v2', 'url': 'https://github.com/marvinroger/homie-esp8266-setup/raw/gh-pages/ui_bundle.html' },
{ 'title': 'v1', 'description': 'For Homie v1.x.x', 'path': 'v1', 'file': '/configurator_v1.html' }
]

current_dir = os.path.dirname(__file__)
output_dir = getopt.getopt(sys.argv[1:], 'o:')[0][0][1]
github_releases = json.load(urllib2.urlopen('https://api.github.com/repos/marvinroger/homie-esp8266/releases'))

def generate_docs(data):
print('Generating docs for ' + data['tag'] + ' (' + data['description'] + ') at /' + data['path'] + '...')
zip_url = 'https://github.com/marvinroger/homie-esp8266/archive/' + data['tag'] + '.zip'
zip_path = tempfile.mkstemp()[1]
urllib.urlretrieve(zip_url, zip_path)

zip_file = zipfile.ZipFile(zip_path, 'r')
unzip_path = tempfile.mkdtemp()
zip_file.extractall(unzip_path)
src_path = glob.glob(unzip_path + '/*')[0]

if not os.path.isfile(src_path + '/mkdocs.yml'): shutil.copy(current_dir + '/mkdocs.default.yml', src_path + '/mkdocs.yml')

subprocess.call(['mkdocs', 'build'], cwd=src_path)
shutil.copytree(src_path + '/site', output_dir + '/' + DOCS_PATH + '/' + data['path'])
print('Done.')

def generate_configurators(data):
print('Generating configurator for ' + data['title'] + ' (' + data['description'] + ') at /' + data['path'] + '...')
file_path = None
if 'file' in data:
file_path = current_dir + data['file']
else: # url
file_path = tempfile.mkstemp()[1]
urllib.urlretrieve(data['url'], file_path)

prefix_output = output_dir + '/' + CONFIGURATORS_PATH + '/' + data['path']
try:
os.makedirs(prefix_output)
except:
pass

shutil.copy(file_path, prefix_output + '/index.html')

print('Done.')

shutil.rmtree(output_dir, ignore_errors=True)

# Generate docs

generated_docs = []

# Generate docs for branches

for branch in DOCS_BRANCHES:
generated_docs.append(branch)
generate_docs(branch)

# Generate docs for releases

for release in github_releases:
if (release['id'] < FIRST_RELEASE_ID): continue

tag_name = release['tag_name']
version = tag_name[1:]
description = 'release ' + version

data = {
'tag': tag_name,
'description': description,
'path': version
}

generated_docs.append(data)
generate_docs(data)

# Generate documentation html

documentation_html = '<ul>'
for documentation_data in generated_docs:
documentation_html += '<li><a href="' + DOCS_PATH + '/' + documentation_data['path'] + '"># ' + documentation_data['tag'] + ' <span class="description">' + documentation_data['description'] + '</span></a></li>'
documentation_html += '</ul>'

# Generate configurators

generated_configurators = []

for version in CONFIGURATORS_VERSIONS:
generated_configurators.append(version)
generate_configurators(version)

# Generate configurators html

configurators_html = '<ul>'
for configurator_data in generated_configurators:
configurators_html += '<li><a href="' + CONFIGURATORS_PATH + '/' + configurator_data['path'] + '"># ' + configurator_data['title'] + ' <span class="description">' + configurator_data['description'] + '</span></a></li>'
configurators_html += '</ul>'

# Generate index

docs_index_template_file = open(current_dir + '/docs_index_template.html')
docs_index_template_html = docs_index_template_file.read()
docs_index_template = string.Template(docs_index_template_html)
docs_index = docs_index_template.substitute(documentation_html=documentation_html, configurators_html=configurators_html)

docs_index_file = open(output_dir + '/index.html', 'w')
docs_index_file.write(docs_index)
docs_index_file.close()
Binary file added .circleci/assets/id_rsa.enc
Binary file not shown.
29 changes: 29 additions & 0 deletions .circleci/assets/mkdocs.default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
site_name: Homie for ESP8266
repo_name: 'marvinroger/homie-esp8266'
repo_url: 'https://github.com/marvinroger/homie-esp8266'

theme:
name: material
palette:
primary: red
accent: red

markdown_extensions:
- meta
- footnotes
- codehilite
- admonition
- toc(permalink=true)
- pymdownx.arithmatex
- pymdownx.betterem(smart_enable=all)
- pymdownx.caret
- pymdownx.critic
- pymdownx.emoji:
emoji_generator: !!python/name:pymdownx.emoji.to_svg
- pymdownx.inlinehilite
- pymdownx.magiclink
- pymdownx.mark
- pymdownx.smartsymbols
- pymdownx.superfences
- pymdownx.tasklist(custom_checkbox=true)
- pymdownx.tilde
101 changes: 101 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
version: 2
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/python:2.7
steps:
- checkout
- run:
name: install PlatformIO
command: sudo pip install -U https://github.com/platformio/platformio-core/archive/develop.zip
- run:
name: install current code as a PlatformIO library with all dependencies
command: platformio lib -g install file://.
- run:
name: install staging version of Arduino Core for ESP8266
command: platformio platform install https://github.com/platformio/platform-espressif8266.git#feature/stage
- run:
name: install exemples dependencies
command: platformio lib -g install [email protected] [email protected]
- run: platformio ci ./examples/CustomSettings --board=esp01 --board=nodemcuv2
- run: platformio ci ./examples/DoorSensor --board=esp01 --board=nodemcuv2
- run: platformio ci ./examples/HookToEvents --board=esp01 --board=nodemcuv2
- run: platformio ci ./examples/IteadSonoff --board=esp01 --board=nodemcuv2
- run: platformio ci ./examples/LightOnOff --board=esp01 --board=nodemcuv2
- run: platformio ci ./examples/TemperatureSensor --board=esp01 --board=nodemcuv2
- run: platformio ci ./examples/LedStrip --board=esp01 --board=nodemcuv2
- run: platformio ci ./examples/Broadcast --board=esp01 --board=nodemcuv2
- run: platformio ci ./examples/GlobalInputHandler --board=esp01 --board=nodemcuv2
- run: platformio ci ./examples/SonoffDualShutters --board=esp01 --board=nodemcuv2

lint:
working_directory: ~/code
docker:
- image: circleci/python:2.7
steps:
- checkout
- run:
name: install cpplint
command: sudo pip install cpplint
- run: make cpplint

generate_docs:
working_directory: ~/code
docker:
- image: circleci/python:2.7
steps:
- checkout
- run:
name: install dependencies
command: sudo pip install mkdocs==0.17.2 mkdocs-material==2.2.0 pygments==2.2.0 pymdown-extensions==4.5.1
- run:
name: generate and publish docs
command: |
if [ -z ${PRIVATE_KEY_ENCRYPT_KEY+x} ]
then
echo "Fork detected. Ignoring..."
exit 0
fi
openssl aes-256-cbc -d -in ./.circleci/assets/id_rsa.enc -k "${PRIVATE_KEY_ENCRYPT_KEY}" >> /tmp/deploy_rsa
eval "$(ssh-agent -s)"
chmod 600 /tmp/deploy_rsa
ssh-add /tmp/deploy_rsa
chmod +x ./.circleci/assets/generate_docs.py
./.circleci/assets/generate_docs.py -o /tmp/site
# make sure we ignore the gh-pages branch
mkdir /tmp/site/.circleci
cp ./.circleci/assets/circleci.ignore.yml /tmp/site/.circleci/config.yml
pushd /tmp/site
git init
git config --global user.name "circleci"
git config --global user.email "[email protected]"
git remote add origin [email protected]:marvinroger/homie-esp8266.git
git add .
git commit -m ":package: Result of CircleCI build ${CIRCLE_BUILD_URL}"
git push -f origin master:gh-pages
popd
workflows:
version: 2
lint_build_generatedocs:
jobs:
- lint:
filters:
branches:
ignore:
- gh-pages
- build:
filters:
branches:
ignore:
- gh-pages
- generate_docs:
filters:
branches:
ignore:
- gh-pages
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ If you have some questions or if you need help, some people might help you on th

Before submitting your issue, make sure:

- [ ] You've read the documentation for *your* release (in the `docs/` folder for the v1, at https://homie-esp8266.readme.io) which contains some answsers to the most common problems (notably the `Limitations and know issues` and `Troubleshooting` pages)
- [ ] You've read the documentation for *your* release (in the `docs/` folder or at http://marvinroger.github.io/homie-esp8266/) which contains some answsers to the most common problems (notably the `Limitations and know issues` and `Troubleshooting` pages)
- [ ] You're using the examples bundled in *your* release, which are in the `examples/` folder of the `.zip` of the release you're using. Examples might not be backward-compatible

Thanks!
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# Output of mkdocs
/site/

/config.json
*.filters
*.vcxitems
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cpplint:
cpplint --repository=. --recursive --filter=-whitespace/line_length,-legal/copyright,-runtime/printf,-build/include,-build/namespace,-runtime/int ./src
cpplint --repository=. --recursive --filter=-whitespace/line_length,-legal/copyright,-runtime/printf,-build/include,-build/namespace,-runtime/int,-whitespace/comments,-runtime/threadsafe_fn ./src
.PHONY: cpplint
Loading

0 comments on commit b99e393

Please sign in to comment.