75 lines
2.5 KiB
Markdown
75 lines
2.5 KiB
Markdown
spejsiot
|
|
========
|
|
|
|
This is the repository of hswaw spejsiot project, meant to IoTize EVERYTHING easily.
|
|
|
|
This includes simple framework for building appliances compatible with
|
|
[Homie MQTT convention](https://github.com/marvinroger/homie), based on cheapo
|
|
ESP8266 SoCs and [Sming](https://github.com/SmingHub/Sming).
|
|
|
|
It currently supports most of Homie protcol (with `homie/` prefix replaced
|
|
by `iot/`), OTA and preliminary SSL support. (provided by Sming itself, currently
|
|
not enabled)
|
|
|
|
Sample application is present in `switch/` directory. (simple relay device)
|
|
For more information take a look at [project wiki page](https://wiki.hackerspace.pl/projects:spejsiot).
|
|
|
|
|
|
Getting started
|
|
---------------
|
|
|
|
# Create relevant environment variables in your ~/.bashrc
|
|
cat >> ~/.bashrc <<EOF
|
|
# ESP8266 toolchain setup
|
|
export ESP_HOME="$HOME/esp-open-sdk"
|
|
export SDK_BASE="$ESP_HOME/sdk"
|
|
export XTENSA_TOOLS_ROOT="$ESP_HOME/xtensa-lx106-elf/bin"
|
|
export PATH="$XTENSA_TOOLS_ROOT:$PATH"
|
|
|
|
# Sming setup
|
|
export SMING_HOME="$HOME/Sming/Sming"
|
|
export ESPTOOL="$ESP_HOME/xtensa-lx106-elf/bin/esptool.py"
|
|
export ESPTOOL2="$HOME/esptool2/esptool2"
|
|
|
|
# This is for Wemos D1 Mini and some NodeMCU boards
|
|
export ESPPORT="/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0"
|
|
export COM_PORT="$ESPPORT"
|
|
|
|
# Make flashing slightly (4x) faster.
|
|
export ESPBAUD=460800
|
|
export COM_SPEED_ESPTOOL="$ESPBAUD"
|
|
EOF
|
|
|
|
source ~/.bashrc
|
|
|
|
# Setup ESP8266 development environment (some additional packages may be needed)
|
|
git clone --recursive https://github.com/pfalcon/esp-open-sdk.git $ESP_HOME
|
|
pushd $ESP_HOME && make && popd
|
|
|
|
git clone https://github.com/raburton/esptool2 $ESPTOOL2/..
|
|
pushd $ESPTOOL2/.. && make && popd
|
|
|
|
# Setup Sming environment
|
|
git clone --recursive https://github.com/SmingHub/Sming $SMING_HOME/..
|
|
pushd $SMING_HOME && make && popd
|
|
|
|
# Build test spejsiot app
|
|
git clone https://code.hackerspace.pl/informatic/spejsiot
|
|
cd spejsiot/switch/ && make flash
|
|
|
|
**WARNING!** `Sming.reset();` jumps to (serial) bootloader right after flashing.
|
|
This causes OTA to fail with `wdt reset`. External RESET assert is required after
|
|
flashing.
|
|
|
|
Configuration
|
|
-------------
|
|
|
|
Basic node configuration (MQTT broker IP, 802.11 credentials) is present
|
|
in `common/common_config.h`.
|
|
|
|
TODO
|
|
----
|
|
* Store configuration (credentials, broker IP, maybe endpoints?) in
|
|
flash memory
|
|
* Docs, ffs
|